This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: XSL-loop


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]