Subject: Re: [xsl] 'apply-templates' on parameter of 'call-template' From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Fri, 09 Apr 2004 14:03:34 -0400 |
Is it legitimate to invoke 'xsl:apply-templates' on a parameter passed to 'xsl:call-template'?
In other words, should the following fragment be expected to work:
<xsl:template match="/"> <xsl:call-template name="test"> <xsl:with-param name="body"> <p>This is my body</p> <matchable id="123"/> </xsl:with-param>
</xsl:call-template> </xsl:template>
<xsl:template name="test"> <xsl:param name="body">no body</xsl:param>
The Xalan error ("can not convert #RTREEFRAG to a nodelist") hints that I'm trying to do something basically contrary to the spirit of XSL, or at least XSL 1.0.
What I'd like to do can be described as follows: use 'call-template' to 'surround' an arbitrary block of XML, _contained in the XSL stylesheet_, by additional XML content - and have templates applied to the contained block in the usual way.
<xsl:stylesheet xmlns:myns="my-namespace" exclude-result-prefixes="myns"
<myns:data1> <p>This is my body</p> <matchable id="123"/> </myns:data1>
... <xsl:with-param name="body" select="document('')/*/myns:data1/node()"/>
As to why I want to do this particularly horrible thing, put it down to someone else's questionable design decisions. If the nodes that I want to 'surround' were in the XML rather than the XSL, this would be trivial.
-- Public courses: Spring 2004 world tour of hands-on XSL instruction Each week: Monday-Wednesday: XSLT/XPath; Thursday-Friday: XSL-FO Hong Kong May 17-21; Bremen Germany May 24-28; Helsinki June 14-18
World-wide on-site corporate, govt. & user group XML/XSL training. G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995) Male Breast Cancer Awareness http://www.CraneSoftwrights.com/s/bc
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] 'apply-templates' on para, M. David Peterson | Thread | Re: [xsl] 'apply-templates' on para, Wendell Piez |
RE: [xsl] 'apply-templates' on para, M. David Peterson | Date | RE: RE: [xsl] Saxon servlet and xsl, Michael Kay |
Month |