[Home] [By Thread] [By Date] [Recent Entries]
Houghton,Andrew wrote:
The above doesn't handle namespaces, processing-instructions,comments,or mixed content, but it could be hacked to do so. Is there a reason why this approach would not work in XSL 1.0 to satisfy his needs?Yes, the reason is that you can't do the apply-templates on the result tree fragment, you would first need to convert it to a node-set with an extension function. A result tree fragment is not a string but it is also not a node set. If you have e.g. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="/">
<xsl:variable name="rtf">
<html>
<body>
<p>Example</p>
</body>
</html>
</xsl:variable>
<xsl:apply-templates select="$rtf" mode="m1"/>
</xsl:template> <xsl:template match="/" mode="m1">
<xsl:copy-of select="."/>
</xsl:template></xsl:stylesheet> then for instance Saxon 6.5 will complain "Error at xsl:apply-templates on line 13 [...]. Cannot process a result tree fragment as a node-set under XSLT 1.0". -- Martin Honnen http://JavaScript.FAQTs.com/
|

Cart



