When I rewrite the addInlineText template as: <xsl:template name="addInlineText"> <xsl:param name="value" /> <fo:block> <xsl:for-each select="$value" > <xsl:copy/> <xsl:apply-templates/> </xsl:for-each> </fo:block> </xsl:template>
I do get the desired behavior with the Altova XSLT engine, built in the XMLSpy product. However, when trying the same with Xalan, I get this error: SystemID: print.xsl; Line#: 20; 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.java:333) Any help greatly appreciated, Alain Gilbert -----Original Message----- From: Alain Gilbert Sent: Tuesday, September 08, 2009 10:31 AM To: 'xalan-j-users@xml.apache.org' Subject: How to xsl:apply-templates while xsl:copy-of? Hi, I'm using xalan-2.7.0 (the same applies to version 2.7.1) and I'd like the transform to apply-templates while copying a set of nodes from the template into the result document. I have attached the print.xsl template. Look at line 18 of print.xsl for the template "addInlineText" declaration and at line 10 for its call. At line 21, how to apply-templates while copying the template parameter? In other words, I'd like the template that match "html:p" to be applied when the template "addField" is called with the parameter "value" with a set of node as value. Is it possible to do it with XSLT 1.0? I'd like to avoid a second pass to apply the html:* templates. Thanks, Alain Gilbert