|
Subject: Re: [xsl] Processing Nested Lists From: Florent Georges <darkman_spam@xxxxxxxx> Date: Tue, 27 Feb 2007 10:21:31 +0100 (CET) |
Adam Retter wrote:
Hi
> <xsl:template name="processNode">
> <xsl:parameter name="node"/>
> <tr>
> <td><xsl:value-of select="{node-name($node)}"/></td>
> </tr>
> <xsl:for-each select="$node/child::node">
> <xsl:call-template name="processNode">
> <xsl:with-parameter name="node" select="."/>
> </xsl:call-template>
> </xsl:for-each>
> </xsl:template>
> <xsl:for-each select="/TopTag/TaxonomyEntries/TaxonomyNode">
> <xsl:call-template name="processNode">
> <xsl:with-parameter name="node" select="."/>
> </xsl:call-template>
> </xsl:for-each>
This is exactly the kind of stuff template rules are for. In other
words, to apply code to some sequence of nodes: apply template rules to
nodes instead of calling named template passing nodes by parameters and
using xsl:for-each.
For example, the code above can be written (the intention above is
not precisely clear, but you'll got the idea):
<xsl:template match="*">
<tr>
<td>
<xsl:value-of select="name(.)"/>
</td>
</tr>
<xsl:apply-templates select="*"/>
</xsl:template>
...
<xsl:apply-templates
select="/TopTag/TaxonomyEntries/TaxonomyNode">
Regards,
--drkm
___________________________________________________________________________
Dicouvrez une nouvelle fagon d'obtenir des riponses ` toutes vos questions !
Profitez des connaissances, des opinions et des expiriences des internautes sur Yahoo! Questions/Riponses
http://fr.answers.yahoo.com
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] Processing Nested Lists, Adam Retter | Thread | [xsl] Outside of crop box text, Steve Ylvisaker |
| [xsl] XML Tag to Output Math type f, Byomokesh | Date | [xsl] How to display the previous p, Ranjitha Murthy Rao |
| Month |