Re: [xsl] Q: Passing constructed elements as parameters

Subject: Re: [xsl] Q: Passing constructed elements as parameters
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 31 Jan 2001 19:27:04 GMT

   Hi, I'm trying to do something like:

     <xsl:with-param name="foo">
       <xsl:element name="bar"> ... </xsl:element>

assuming you mean <xsl:template match="xxx"> here

     <xsl:param name="foo"/>
     <xsl:for-each select="$foo/bar"/>

   But something seems to be lost in the translation.  Is there some conversion 
   step I'm missing?


if the xxx element that matches the second template is a direct
child of the template that has the apply-templates code at the top
then it will see the seting of the foo parameter. (otherwise it won't as
parameters are not passed on by default)

However if you go

<xsl:with-param name="foo">

rather than

<xsl:with-param name="foo" select="..."/>

then $foo wilkl be a result tree fragment rather than a node set,
so you can not query into it with  <xsl:for-each select="$foo/bar"/>

It's not clear from what you've posted whether you want to use th e
<xsl:with-param name="foo" select="..."/> for and have $ foo
being a set of nodes in the input document, or whether you did intent to 
construct a new node set, in which case you processor may have a
node-set() extension function, used as

 <xsl:for-each select="xt:node-set($foo)/bar"/>


 XSL-List info and archive:

Current Thread