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

How best to use recursion/call-templates?

Subject: How best to use recursion/call-templates?
From: "David T." <kujhawk@xxxxxxxxxxxxxx>
Date: Wed, 27 Feb 2002 17:37:16 -0500 (EST)
how to use recursion
If I have this XML fragment:

<xml>
 <row>
    <account>32</account>
    <name>Smith</name>
 </row>
 <row>
    <account>32</account>
    <name>Jones</name>
 </row>
 <row>
     <account> 35</account>
     <name>White</name>
 </row>
</xml>

....then I'd like this output

<span> 32
   <a>smith</a>
   <a>Jones</a>
</span>
 <span>  35
    <a> White </a>
 </span>

In other words:  each account number is in its own <span> tag, and each
name that has that account # is a link (<a>) inside that span tag.  Since
Jones and Smith both have the same account #, they are inside the same
span tags.  Since White has a different account number, there is a
separate <span> tag.

1.  How can I achieve this output?
2.  Should I use recursion to achieve this?
3.  Is this a procedural problem and should I rethink my approach? 

What I have tried:  I have tried a number of call-template functions but I
never seem to get the right result, primarily because I never quite nail
down the right params to send. I've also tried using preceding-sibling to
work through this, but I got deeper into trouble.  I'd post my XSL but
it's terribly convoluted now.   I am admittedly lost. Any suggestions?

David.


 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.