This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: xsl:template node set parameter
- To: xsl-list at mulberrytech dot com
- Subject: Re: xsl:template node set parameter
- From: Gary L Peskin <garyp at firstech dot com>
- Date: Fri, 25 Aug 2000 13:17:43 -0700
- Organization: The Firstech Corporation
- References: <F219qgNjWOiy54DgI6b0000033b@hotmail.com>
- Reply-To: xsl-list at mulberrytech dot com
First, newer versions of Xalan replace the #UNKNOWN with the proper
error object type. The with-param form that you're using generates a
result tree fragment, not a node-set so your error message should be
#RTREEFRAG.
Unfortunately, in the temp template you have an apply-templates with a
select="$p/*". This operation is not allowed on a result tree fragment
which is why you're getting the error message in the first place.
You'll need to convert $p to a node-set. To do this, in Xalan, you need
to use the nodeset extension. Include attributes in your stylesheet
element:
xmlns:nodeset="org.apache.xalan.xslt.extensions.Nodeset"
exclude-result-prefixes="nodeset"
Then, change your select to
select="nodeset:nodeset($p)/*"
HTH,
Gary
xsl list wrote:
>
> Can I pass a set of nodes as a parameter to a template?
> >From the example below, I need to apply templates to node in the parameter
> node set. I expect a template that matches <tag_1> to be invoked. The
> peoblem is, using Xalan, I am getting the XPATH error:
> Can not convert #UNKNOWN to a NodeList!
>
> <xsl:call-template name="temp">
> <xsl:with-param name="p">
> <tag_1><tag_2>V</tag_2></tag_1>
> </xsl:with-param>
> </xsl:call-template>
>
> <xsl:template name="temp">
> <xsl:param name="p"/>
>
> <xsl:apply-templates select="$p/*"/>
> </xsl:template>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list