I have to use XSL 1.0 and I have an xslt variable containing a result tree fragment. I want to apply template styles to that variable.
<xsl:template match="item">
<p>
<xsl:apply-templates />
</p>
</xsl:template>
<xsl:template match="html_embed">
<xsl:variable name="htmlContents">
<item>hello ian</item>
<item>how are you?</item>
</xsl:variable>
<xsl:choose>
<xsl:when test="function-available('msxsl:node-set')">
<xsl:apply-templates select="msxsl:node-set($htmlContents)/node()" />
</xsl:when>
<xsl:otherwise>
<p>node set not available</p>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
I'm using the node-set function to turn the tree fragment into a node-set but it either isn't working or it can't find a template match because all that's ever returned is this text, on one line, without the markup:
hello ianhow are you?
Any idea's on how I can transform the item nodes?
hello ian
how are you?
`. Note that I used Visual Studio to run this transformation (so the processor was XslCompiledTransform). I vaguely remember that the native xslt processor behaved a bit differently. I would try `msxsl:node-set($htmlContents)//*` and then `msxsl:node-set($htmlContents)/*/*` and then try replacing the last `*` with `item` – Pawel Oct 25 '12 at 23:23