[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[xsl] XSLT 1.0: How to apply-templates while copying the content of a template parameter?
Subject: [xsl] XSLT 1.0: How to apply-templates while copying the content of a template parameter? From: Alain Gilbert <AGilbert@xxxxxxxxx> Date: Wed, 9 Sep 2009 14:48:51 -0400 |
Hi, I have the simplified stylesheet that follows this message. I have a problem with the usage of the "addInlineText" template which simply tries to copy the nodes defined at the call site. It is also important to apply-template on the copied nodes to further apply transformations defined elsewhere. Xalan fails to process the template and seems to fail to build a node-set for the for-each instruction. I get this error: SystemID: print.xsl; Line#: 9; Column#: 33 org.apache.xpath.XPathException: Can not convert #RTREEFRAG to a NodeList! at org.apache.xpath.objects.XObject.error(XObject.java:703) at org.apache.xpath.objects.XObject.iter(XObject.java:406) at org.apache.xpath.Expression.asIterator(Expression.java:250) at org.apache.xalan.templates.ElemForEach.transformSelectedNodes(ElemForEach.jav a:333) Is it possible to rewrite the addInlineText template to be Xalan compliant? The stylesheet is: <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:html="http://www.w3.org/1999/xhtml" version="1.0" exclude-result-prefixes="html"> <xsl:output method="html" version="1.0" omit-xml-declaration="yes" /> <xsl:template name="addInlineText"> <xsl:param name="value" /> <xsl:for-each select="$value" > <xsl:copy/> <xsl:apply-templates/> </xsl:for-each> </xsl:template> <xsl:template match="/"> <html> <head> <title>Test</title> </head> <body> <xsl:call-template name="addInlineText"> <xsl:with-param name="value"> <html:p>Testing HTML in labels</html:p> </xsl:with-param> </xsl:call-template> </body> </html> </xsl:template> <xsl:template match="html:p"> <p><xsl:value-of select="text()"/></p> </xsl:template> <!-- The identity transformation. --> <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> </xsl:stylesheet> Regards, Alain Gilbert
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] XSLT Comparison of Two Tr, Martin Honnen | Thread | Re: [xsl] XSLT 1.0: How to apply-te, Martin Honnen |
Re: [xsl] XSLT Comparison of Two Tr, Martin Honnen | Date | Re: [xsl] XSLT 1.0: How to apply-te, Martin Honnen |
Month |