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

RE: mixing recursive template calls and for-each

Subject: RE: mixing recursive template calls and for-each
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Thu, 4 Jul 2002 09:09:31 +0100
RE:  mixing recursive template calls and for-each
> 
> Here his an example of the template i could manage to write...
> 
>    <xsl:template match="place:list-of">
>      <!-- the node to iterate on -->
>      <xsl:variable name="node" select="@node" />
>      <!-- the nodes which are not under source node, that 
> will be copied -->
>      <xsl:variable name="present"
>                    select=".//*[not( ancestor-or-self::source)]" />
>      <!-- iterate on workitems -->
>      <xsl:for-each select="source//*[name() = $node]">
>        <!-- keep info on the current workitem -->
>        <xsl:variable name="currentWI" select="xalan:nodeset(.)" />
>        <!-- go through the nodes to treat -->
>        <xsl:for-each select="$present">
>          <xsl:choose>
...
> 
>    Here is my problem, for each given node under <source>, i 
> would like 
> to generate the tags inside place:list-of and at the same time change 
> place:value-of for the corresponding value.
> 
>    Of course, <place:list-of> is intended to be generic and 
> should work 
> for any tags under <source> and i don't know at what depth i 
> will find 
> <place:value-of> tags...
> 
First principle: if you want to write XSLT code that can handle
variability of structure, don't use <xsl:for-each>, use template rules
and <xsl:apply-templates/>.

I'm afraid I haven't had time to look at your particular problem in
depth.

Michael Kay
Software AG
home: Michael.H.Kay@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx 


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


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.