This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: Select each child node


Or even simpler, just use <xsl:apply-templates/> -- this
command by default selects each child (down the full hierarchical
tree) and applies the template that most closely matches each
child (without knowing ahead of time what children it might
encounter). And if you just need the text output, the default
template will give you that without specifying any other 
templates. 

> -----Original Message-----
> From: Tim Watts [mailto:timw@3d3.com]
> Sent: Tuesday, May 01, 2001 5:49 PM
> To: xsl-list@lists.mulberrytech.com
> Subject: RE: [xsl] Select each child node
> 
> 
> Of course - simply use <xsl:for-each select="child::node()">
> 
> Sorry to bother you all :)
> 
> -----Original Message-----
> From: owner-xsl-list@lists.mulberrytech.com
> [mailto:owner-xsl-list@lists.mulberrytech.com]On Behalf Of Tim Watts
> Sent: Wednesday, 2 May 2001 10:06 AM
> To: XSL Mailing List (E-mail)
> Subject: [xsl] Select each child node
> 
> 
> How would I go about selecting each child node of an element 
> to be printed?
> 
> If I had a XML
> 
> <root>
>   <stats>
>     <stat>
>        <element1>value<element1>
>        <element2>value<element2>
>        <element3>value<element3>
>        <element4>value<element4>
>     </stat>
>     <stat>
>        <element1>value<element1>
>        <element2>value<element2>
>        <element3>value<element3>
>        <element4>value<element4>
>     </stat>
>   </stats>
> </root>
> 
> that the XSLT would print out each value of the nodes.
> 
> In pidgin XSLenglish it would be like...
> <tr>
> <xsl:apply-templates select="stat" />
> </tr>
> ...
> <xsl:template match="stat">
>   For each element, what-ever the element name
>   <td>
>     <xsl:value-of select="." />
>   </td>
>   Run through each element until done.
> </xsl:template>
> 
> Thanks for your help with this xpath question... :)
> 
> Tim
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]