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

RE: outputting unknown amount of child elements

Subject: RE: outputting unknown amount of child elements
From: cknell@xxxxxxxxxx
Date: Thu, 05 Feb 2004 07:49:03 -0500
xsl unknown items
This is what recursion is for. In your template that matches "item" output the value of the first text node "text()[1]", then apply-templates again. That will call the "item" template again. Your transformer will automatically stop processing when the source document runs out of "item" elements.
--
Charles Knell
cknell@xxxxxxxxxx - email



-----Original Message-----
From:     David Elsmore <delsmore@xxxxxxxxxxxxx>
Sent:     Thu, 05 Feb 2004 12:09:33 +0000
To:       xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:   outputting unknown amount of child elements

Given the following consisting of embedded elements with a common name:
<items>
   <item>Level 1
         <item>Level 2
               <item>A</item>
                 <item>B</item>
                       <item>Level 3
               --- etc.----
               </item>
           </item>
      <item>
</items>

How can I process this so all child elements (regardless of the depth) are outputted in a way that mirrors the structure structure of the original document. For example the uoutput may look something like this:

Heading Level 1
   Heading Level 2
         A
         B
      Heading Level  3

I would find this straightforward if there was a fixed number of levels but in this case the amount varies and is unknown.

Thanks for your help

--
David Elsmore



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




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.