xsl-list
[Top] [All Lists]

RE: WITH-PARAM with node as argument?

2003-04-25 10:27:05
Your code *is* passing a node as the argument - specifically, it is
passing an attribute node. To pass an element node, just use a path
expression that selects the element instead of the attribute - 

<xsl:with-param name="label" select="comp/attribute[(_at_)name='country']"/>

Michael Kay
Software AG
home: Michael(_dot_)H(_dot_)Kay(_at_)ntlworld(_dot_)com
work: Michael(_dot_)Kay(_at_)softwareag(_dot_)com 

-----Original Message-----
From: owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com 
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com] On Behalf Of 
Andreas Schlegel
Sent: 25 April 2003 17:12
To: mulberrytech-xsl-list
Subject: [xsl] WITH-PARAM with node as argument?


Hi,

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. The following example is my current 
code which 
has to much arguments (IMHO). It would be great if I could 
reduce it to 
only 1 argument.

<xsl:call-template name="textfield">
   <xsl:with-param name="label" 
select="comp/attribute[(_at_)name='country']/@label"/>
   <xsl:with-param name="name" 
select="comp/attribute[(_at_)name='country']/@name"/>
   <xsl:with-param name="size" 
select="comp/attribute[(_at_)name='country']/@size"/>
   <xsl:with-param name="value" 
select="comp/attribute[(_at_)name='country']/@value"/>
</xsl:call-template>


<xsl:template name="textfield">
   <xsl:param name="label"/>
   <xsl:param name="name"/>
   <xsl:param name="size"/>
   <xsl:param name="value"/>
   <tr>
     <th align="left"><xsl:value-of select="$label"/></th>
     <td align="left" colspan="1">
       <xsl:element name="input">
         <xsl:attribute name="type">text</xsl:attribute>
         <xsl:attribute name="name"><xsl:value-of 
select="$name"/></xsl:attribute>
         <xsl:attribute name="size"><xsl:value-of 
select="$size"/></xsl:attribute>
         <xsl:attribute name="value"><xsl:value-of 
select="$value"/></xsl:attribute>
       </xsl:element>
     </td>
   </tr>      
</xsl:template>


Greetings,
Andreas



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>