|
Subject: resetting list counters using <xsl:number> From: Lawrence Mielniczuk <lwm@xxxxxxxxxxxxxxx> Date: Tue, 8 Aug 2000 15:51:30 +0100 (GMT Daylight Time) |
Hello all,
Given the following sample xml file
<?xml version="1.0"?>
<doc>
<page>
<p>Some text...</p>
<list type="ordered" continuation="starts">
<item>first</item>
<item>second</item>
<item>third</item>
</list>
<p>Some more text...</p>
<list type="ordered" continuation="continues">
<item>fourth</item>
<item>fifth</item>
</list>
<p>Yet even more text...</p>
<list type="ordered" continuation="starts">
<item>First Item, Second List</item>
<item>Second Item, Second List</item>
</list>
</page>
</doc>
I should like to tranform to the following HTML
<html>
<head>
<title>doc</title>
</head>
<body>
<p>Some text...</p>
<ol>
<item number="1">first</item>
<item number="2">second</item>
<item number="3">third</item>
<ol>
<p>Some more text...</p>
<ol>
<item number="4">fourth</item>
<item number="5">fifth</item>
</ol>
<p>Yet even more text...</p>
<ol>
<item number="1">First Item, Second List</item>
<item number="2">Second Item, Second List</item>
</ol>
</body>
</html>
The bit I'm having troube with is the `from' attribute in <xsl:number> as follows:
<xsl:template match="item">
<item>
<xsl:attribute name="value">
<xsl:number level="any" from="list[@type='starts']"/>
</xsl:attribute>
<xsl:value-of select="."/>
</item>
</xsl:template>
</xsl:transform>
Is it possible to reset the count based on an attribute? Any help much appreciated.
---L---
-------------------------------------
Lawrence Mielniczuk
Room 314
Bodleian Library
Oxford OX1 3BG
Tel: (01865) 277 114
Mobile: 0794 101 5689
-------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Finality of XSLT specs (was: xslt q, David_Marston | Thread | RE: resetting list counters using <, Ben Robb |
| RE: Still can't sort conditionally, Heather Lindsay | Date | Re: key() Re: Saxon VS XT, Paul Tchistopolskii |
| Month |