|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: WITH-PARAM with node as argument?
[Andreas Schlegel]
> I would like to write a with-param statement with a node as
> argument and
> handle this node in a template. But I don't know if it is possible or
> even what is the syntax.
Yes it is possible and you were almost there - all you had to do was to
try it out. You can also simplify the "textfield" template by using
attribute value templates. Assuming that comp/attribute are the
elements you are interested in (as it seems from your example), it
would look like this (modifying your templates a little) -
<xsl:call-template name="textfield">
<xsl:with-param
name='comp' select='comp'/>
</xsl:call-template>
....
<xsl:template name='textfield'>
<xsl:param name='comp'/>
<tr>
<th align="left"><xsl:value-of
select="{$comp/attribute[@name='country']/@label}"/></th>
<td align="left" colspan="1">
<input type='text'
name="{$comp/attribute[@name='country']/@name}"/>
... and so on
</xsl:template>
Now, in this particular case it would not give you any advantage if you
could arrange things so that "comp" is the context node when you call
the template - since call-template keeps the same context in effect and
so you would not need a parameter at all - but there are plenty of other
cases where it is extremely useful to be able to pass a node-set
(possibly containing just one node) as a parameter.
Cheers,
Tom P
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








