[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Processing Nested Lists

Subject: Re: Processing Nested Lists
From: Florent Georges <darkman_spam@xxxxxxxx>
Date: Tue, 27 Feb 2007 10:21:31 +0100 (CET)
Re:  Processing Nested Lists
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.