[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Result tree fragment to string?
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/
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|