Hi all,
I have this bit of XSL:
<xsl:template match="tight">
.BR <xsl:value-of select="." /><xsl:text/>
<xsl:choose>
<xsl:when test="position() != last()">, </xsl:when>
<xsl:when test="position() = last()">. </xsl:when>
</xsl:choose>
</xsl:template>
that matches this bit of XML:
<tight><link>mget</link></tight>
<tight><link>medit</link></tight>
Using Xalan, I get output like this:
mget, medit.
Using Saxon, I get output like this:
mget,
medit,
I want the the output from Saxon to look like Xalan's output . Any ideas
what I can do to fix this?
Without a complete example, it's we have to guess what your inputs look
like, but I reconstructed the following:
---------------------------------
<?xml version="1.0"?>
<doc>
<tight><link>mget</link></tight>
<tight><link>medit</link></tight>
</doc>
---------------------------------
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="doc">
<out>
<xsl:apply-templates/>
</out>
</xsl:template>
<xsl:template match="tight">
.BR <xsl:value-of select="." /><xsl:text/>
<xsl:choose>
<xsl:when test="position() != last()">, </xsl:when>
<xsl:when test="position() = last()">. </xsl:when>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
---------------------------------
Using Xalan-C++, I get the following output:
<?xml version="1.0" encoding="UTF-8"?>
<out>
.BR mget,
.BR medit,
</out>
The output from Saxon and MSXSL is pretty the same.
If I use the following input document:
<?xml version="1.0"?>
<doc><tight><link>mget</link></tight><tight><link>medit</link></tight></doc>
I get:
<?xml version="1.0" encoding="UTF-8"?>
<out>
.BR mget,
.BR medit. </out>
If you're expecting the latter, you need to change your source document, or
use the xsl:strip-space instruction to strip whitespace from the
appropriate elements.
It's likely you've found a bug in Xalan, if it is producing what you say it
is. What version of Xalan are you using?
Dave
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list