Nodeset within a variable 2003-03-05 - By J=?ISO-8859-1?B?/A==?=rgen Sieben
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/@(protected)²>
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
<HTML> <HEAD> <TITLE>Nodeset within a variable</TITLE> </HEAD> <BODY> <FONT FACE="Verdana">Hi list,<BR> I encountered a problem where I can’t find a proper solution:<BR> I’m using a named template that does certain constant tasks for me.<BR> 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:<BR> <BR> <xsl:template name=”foo”><BR> <xsl:param name=”var”/><BR> <BR> ... Some code, var contains a nodeset, so I’m referring to it like this: <BR> <xsl:for-each select=”$var/val/@(protected)”> ;<BR> <BR> Etc.<BR> <BR> At another template, I’m calling this template like this:<BR> <BR> <xsl:call-template name=”foo”><BR> <xsl:with-param name=”var”><BR> <val name=”some_value& #8221;/><BR> <val name=”some_other _value”/><BR> </xsl:with-param><BR> </xsl:call-template><BR> <BR> 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.<BR> <BR> 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 & #8220;var”-string to an element.<BR> Am I right with that? And how can I achieve that?<BR> <BR> This function saves <I>a lot</I> of code for me...<BR> <BR> <BR> Thanks for any help,<BR> <BR> Jürgen</FONT> </BODY> </HTML>
|
|