Hopefully someone can help me out here, otherwise Ive got a lot of
coding to do...
Throughout a stylesheet I have node-sets created in the form:
<xsl:variable name="foo-rtf">
..
</xsl:variable>
<xsl:variable name="foo" select="exsl:node-set($foo-rtf)"/>
Then I reference the node-sets using:
<xsl:for-each select="$foo">
do whatever
</xsl:for-each>
Now I have to ensure the stylesheets work with Msxml 4.0 as well, which
doesn't support exsl out of the box. The only way I can see of doing
this is to replace each occurance of:
<xsl:for-each select="$foo">
With a choose/when using function available, with the body of the
for-each in a named template:
<xsl:choose>
<xsl:when test="function-available(msxml:node-set)">
<xsl:for-each select="msxml:node-set($foo)">
<xsl:call-template name="$foo-template"/>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:for-each select="exsl:node-set($foo)">
<xsl:call-template name="$foo-template"/>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
This is bloating the code out, making it more difficult to read, and
just feels wrong.
Has anyone got any tips/tricks in this situation?
Is it possible to do the test in a single place, along the lines of:
<xsl:variable name="foo-node-set">
<xsl:choose>
<xsl:when test="function-available(msxml:node-set)">
<xsl:copy-of select="msxml:node-set($foo-rtf)"/>
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="exsl:node-set($foo-rtf)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
...but of coure this still leaves you with a RTF.
cheers
andrew
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list