I have XML input:
<?xml version="1.0"?>
<packages>
<package>
<category>Applications/Internet</category>
<install-name>test</install-name>
and want to duplicate this as output using the XSLT input:
<xsl:template match="/">
<xsl:element name="packages">
<xsl:for-each select="packages/package">
<xsl:element name="package">
<xsl:copy-of select="category"/>
<xsl:if test="string(category)">
<xsl:text> </xsl:text>
</xsl:if>
...
</xsl:element>
</xsl:for-each>
</xsl:element>
</xsl:template>
Using xsltproc 1.0.23 I get:
<?xml version="1.0"?>
<packages>
<package><category>Applications/Internet</category>
</package>
</packages>
If I remove:
<xsl:if test="string(category)">
<xsl:text> </xsl:text>
</xsl:if>
I get:
<?xml version="1.0"?>
<packages>
<package>
<category>Applications/Internet</category>
</package>
</packages>
So why does inserting a newline mess up the output?
--
albert chin (china(_at_)thewrittenword(_dot_)com)
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list