Re: [xsl] outputting unknown amount of child elements

Subject: Re: [xsl] outputting unknown amount of child elements
From: "Emmanuil Batsis (Manos)" <mbatsis@xxxxxxxxxxx>
Date: Thu, 05 Feb 2004 14:37:16 +0200

Upon reading "apply-templates", the proccessor will pick the appropriate template per node (using the match attribute to determine that); you dont have to do it your self. Text should be outputted per the default behavior (AFAIK) thus:



<xsl:template match="items"> <xsl:apply-templates/> </xsl:template>

<xsl:template match="item">
	Heading <xsl:apply-templates/>
</xsl:template>





David Elsmore wrote:

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


-- Manos Batsis

    _  __    __                    __
   / |/ /__ / /____ __ _ ___ _____/ /_
  /    / -_) __(_-</  ' Y _ `/ __/ __/
 /_/|_/\__/\__/___/_/_/_|_,_/_/  \__/


http://www.netsmart.gr mailto:mbatsisSPAM_TRAP@xxxxxxxxxxx tel:+302103240940 http://forte.netsmart.gr/foaf/manos_foaf.rdf



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


Current Thread