This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: XSL-loop
- To: xsl-list at lists dot mulberrytech dot com
- Subject: Re: [xsl] XSL-loop
- From: Larry Garfield <lgarfiel at students dot depaul dot edu>
- Date: Thu, 22 Mar 2001 20:53:50 -0600
- Organization: DePaul University
- References: <002a01c0b2cc$cd23c580$4ae8c0c3@eggym.dk>
- Reply-To: xsl-list at lists dot mulberrytech dot com
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@students.depaul.edu
Do you have a PalmOS Organizer? Click here to add me to your address book:
http://signature.coola.com/?lgarfiel@students.depaul.edu
-- "If at first you don't succeed, skydiving isn't for you." :-)
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list