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]
Other format: [Raw text]

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@ntlworld.com
work: Michael.Kay@softwareag.com 


 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]