Re: [xsl] Processing Nested Lists

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:


> <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="*">
          <xsl:value-of select="name(.)"/>
      <xsl:apply-templates select="*"/>






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

Current Thread