Title: Nodeset within a variable
Hi list,
I encountered a problem where I can’t find a proper solution:
I’m using a named template that does certain constant tasks for me.
Now I want to pass a nodeset with some attributes to that template to perform the task. Problem is that this nodeset is not part of the XML file, but was created within the XSL-file. Here’s an example:

<xsl:template name=”foo”>
   <xsl:param name=”var”/>

... Some code, var contains a nodeset, so I’m referring to it like this:
    <xsl:for-each select=”$var/val/@name”>

Etc.

At another template, I’m calling this template like this:

<xsl:call-template name=”foo”>
    <xsl:with-param name=”var”>
        <val name=”some_value”/>
        <val name=”some_other_value”/>
    </xsl:with-param>
</xsl:call-template>

Sounds mean, but no comes the astonishing part: It works... At least with the XMLSpy built-in processor. What makes this example mean, is that it doesn’t work in other processors.

Xalan-J produces an error that says that variable “var” has to reference a nodeset. So I feel that my problem is to “cast” my “var”-string to an element.
Am I right with that? And how can I achieve that?

This function saves a lot of code for me...


Thanks for any help,

Jürgen

Reply via email to