[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Applying templates to Result Tree Fragment


Subject: Applying templates to Result Tree Fragment
From: "James Lynn" <jiml@xxxxxxx>
Date: Mon, 2 Oct 2000 15:26:04 +0100

Let's say I define a variable thus:
<xsl:variable name="somedata">
<NODE>
	<SUBNODE>data</SUBNODE>
	<MOREDATA>some more</MOREDATA>
</NODE>
<NODE>
	<SUBNODE>a different piece of data</SUBNODE>
	<MOREDATA>and some more</MOREDATA>
</NODE>
</xsl:variable>

so that $somedata contains the XML data as a result tree fragment.

Is it then permissible to do the following:

<xsl:apply-templates select="$somedata"/>

and have my stylesheet (which has match templates for the NODE SUBNODE and
MOREDATA elements) process the nodes from the RTF instead of from the source
XML document?

I ask because I've done this exact thing using the May release of the
microsoft parser and it worked beautifully, but when I tried the same
stylesheet with the July release this no longer worked (nothing was output
by the apply-templates call). I'm worried that what I'm trying to do
violates some subtle rule in the XSLT spec, but it could just as easily be a
bug in the MS release. I need to know which it is, because I'd like to
migrate to the newer MS releases, but I can't if this feature is impossible.

If it *is* disallowed by the XSLT spec, how would people recommend I achieve
the same result (i.e. including XML data in the same format as the source
document, and applying templates to it. I'd rather not use document() just
to keep it all inline (my feeling is there would be a significant
performance hit).

Any and all advice would be appreciated.

Jim Lynn.
http://www.h2g2.com


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread
Keywords