|
Subject: Re: QUESTION about xsl:number From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Fri, 05 May 2000 16:53:59 -0400 |
My question is how to number its child nodes as:
XML
1. Definition 1.1 XML 1.2 XSL
2. Implementation
I have tried <xsl:number level="multiple" format="1. " />, but the document looks like:
XML
1. Definition 1. XML 2. XSL
2. Implementation
T:\ftemp>type test2.xml <document>
<section type="title" shownumber="no">
XML sample
</section>
<section type="index" shownumber="yes">
Definition
<definition>
XML
</definition>
<definition>
XSL
</definition>
</section>
<section type="index" shownumber="yes">
Implementation
</section>T:\ftemp>type test2.xsl <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="text"/>
<xsl:template match="/"> <!--root rule--> <xsl:apply-templates select="//section"/> </xsl:template>
<xsl:template match="section">
<xsl:if test="@shownumber='yes'">
<xsl:number count="section[@shownumber='yes']"/>
</xsl:if>
<xsl:apply-templates/>
</xsl:template><xsl:template match="definition">
<xsl:number count="section[@shownumber='yes']
|definition"
level="multiple" format="1."/>
<xsl:value-of select="."/>
</xsl:template> XML sample
1
Definition
1.1.
XML 1.2.
XSL 2
Implementation
-- G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (Fax:-0995) Web site: XSL/XML/DSSSL/SGML services, training, libraries, products. Practical Transformation Using XSLT and XPath ISBN 1-894049-04-7 Next instructor-led training: 2000-05-11/12,2000-05-15, - 2000-06-12,2000-06-13,2001-01-27
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| QUESTION about xsl:number, Kelvin Zheng | Thread | RE: Sibling text() Content Match [w, Selva, Francis |
| Re: select attribute in apply-templ, Mike Brown | Date | Issues of practicality and scale-up, CBurdick |
| Month |