Register  Login       Search  
Forum  
 
  
 
Forum  Forum     
 
SearchForum Home
  XML Lab Products  nxslt  Xinclude'd cont...
 Xinclude'd content is not getting processed
 
spamagnet
1 posts
Joined
11/28/2007

Xinclude'd content is not getting processed
Posted: 28 Nov 07 8:42 AM (United States) Modified By spamagnet  on 11/28/2007 8:50:30 AM)
Before I get started: Oleg, thank you for this tool! We started using it a few years ago and it's been extremely helpful.

I just upgraded to nxslt2 version 2.3 (I was using 2.1) and some of my transforms have changed behavior. I cannot determine if this is a latent bug in my transform or a bug in nxslt2.

I have boiled it down to a fairly simple example, but even the smallest XML/XSLT examples tend to be fairly verbose. Here are the files:

master.xml file
<?xml version="1.0" encoding="utf-8"?>
<master
    xmlns:xi="http://www.w3.org/2001/XInclude"
    >
    <slave name="not_included">
        <field name="idWhateverNotIncluded" />
        <code>Code for not_included</code>
    </slave>
    <xi:include href="slave.xml" />
</master>

slave.xml file
<?xml version="1.0" encoding="utf-8"?>
<slave name="included">
    <field name="idWhateverIncluded" />
    <code>Code for included</code>
</slave>

process.xslt file
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="2.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" />
<xsl:strip-space elements="*" />
<xsl:template match="/">
    <xsl:apply-templates select="@*|node()" />
</xsl:template>
<xsl:template match="node()">
    <xsl:copy>
        <xsl:apply-templates select="*|@*" />
    </xsl:copy>
</xsl:template>
<xsl:template match="@*">
    <xsl:copy-of select="."/>
</xsl:template>
<xsl:template match="code">
    <xsl:copy-of select="."/>
</xsl:template>
</xsl:stylesheet>

_transform.cmd file

nxslt2.exe master.xml process.xslt -o output.xml
IF [%1]==[] pause

When _transform.cmd is run with  version 2.1, it generates this output:
<?xml version="1.0" encoding="utf-8"?>
<master xmlns:xi="http://www.w3.org/2001/XInclude">
  <slave name="not_included">
    <field name="idWhateverNotIncluded" />
    <code>Code for not_included</code>
  </slave>
  <slave name="included" xml:base="slave.xml">
    <field name="idWhateverIncluded" />
    <code>Code for included</code>
  </slave>
</master>

While version 2.3 generates this (note the missing content for the second <code> tag):
<?xml version="1.0" encoding="utf-8"?>
<master xmlns:xi="http://www.w3.org/2001/XInclude">
  <slave name="not_included">
    <field name="idWhateverNotIncluded" />
    <code>Code for not_included</code>
  </slave>
  <slave name="included" xml:base="slave.xml">
    <field name="idWhateverIncluded" />
    <code />
  </slave>
</master>

  XML Lab Products  nxslt  Xinclude'd cont...
Forum Home  Search