Re: [xsl] XSL-loop

Subject: Re: [xsl] XSL-loop
From: Larry Garfield <lgarfiel@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 22 Mar 2001 20:53:50 -0600
If you have a small, known number of layers, then probably the most straight-forward solution would be several different templates, like so:

<xsl:template match="p">
    <h1><xsl:value-of select="@title" /></h1>
    <xsl:apply-templates />
</xsl:template>

<xsl:template match="p/p">
    <h2><xsl:value-of select="@title" /></h2>
    <xsl:apply-templates />
</xsl:template>

<xsl:template match="p/p/p">
    <h3><xsl:value-of select="@title" /></h3>
    <xsl:apply-templates />
</xsl:template>

That would require less processing.  If you need to have an arbitrary number, I'm not quite sure.

Mark Gray wrote:

> In my DTD i've created a P-tag. It can contain many different elements - also other P's. A P-element has an attribute called Title. It contains the title of a block of text (p for paragraph!). I would like to display the titles of the different P-elements with a different headersize for each title depending on its position in the XML-tree (how many P-ancestors does it have).
>
> Mark
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

--
Larry Garfield
lgarfiel@xxxxxxxxxxxxxxxxxxx

Do you have a PalmOS Organizer?  Click here to add me to your address book:
http://signature.coola.com/?lgarfiel@xxxxxxxxxxxxxxxxxxx

-- "If at first you don't succeed, skydiving isn't for you." :-)



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


Current Thread