[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: help with numbering (xsl:number)

Subject: Re: help with numbering (xsl:number)
From: "element" <element@xxxxxxxxxxx>
Date: Mon, 17 Jan 2000 11:38:57 +0800
xsl number chapter
Hi, Jerry

You should make two template to match separately for each layer of chapter.
You can't separate the 'chapter' and the 'chapter/chapter' if you select
'//chapter'.
There is a good example in my xsl example of own homepage:
http://www.nease.net/~element/xml/xmltable.xml

Hope you enjoy it.

Ji Yuchun
1370 8989 632
http://www.precomtech.com/jyc

----- Original Message -----
From: Jerry Ventura <jventura@xxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxx>
Sent: Saturday, January 15, 2000 7:10 AM
Subject: help with numbering (xsl:number)


> I've come across an example of how to use xsl:number - but I'm having a
> problem with it. Can someone take a look at this xsl and tell me what I
may
> be doing wrong:
>
>
> <xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
> <xsl:template match="*|/"><xsl:apply-templates/></xsl:template>
> <xsl:template match="text()|@*"><xsl:value-of select="."/></xsl:template>
> <xsl:template match="/">
>  <TABLE BORDER="1">
>  <TR><TH>Number</TH><TH>text</TH></TR>
>  <xsl:for-each select="//chapter">
>  <TR><TD>
>  <xsl:number/>
>  </TD><TD>
>  <xsl:value-of select="./text()"/>
>  </TD></TR>
>  </xsl:for-each>
>  </TABLE>
>  </xsl:template>
> </xsl:stylesheet>
>
>
>
> The associated xml is:
> <?xml version="1.0"?>
>  <xslTutorial >
>  <chapter>First Chapter</chapter>
>  <chapter>Second Chapter
>  <chapter>Subchapter 1</chapter>
>  <chapter>Subchapter 2</chapter>
>  </chapter>
>  <chapter>Third Chapter
>  <chapter>Subchapter A</chapter>
>  <chapter>Subchapter B
>  <chapter>sub a</chapter>
>  <chapter>sub b</chapter>
>  </chapter>
>  <chapter>Subchapter C</chapter>
>  </chapter>
>  </xslTutorial>
>
>
>
> My html output is:
> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> <TABLE BORDER="1">
>   <TR>
>     <TH>Number</TH>
>     <TH>text</TH>
>   </TR>
>   <TR>
>     <TD></TD>
>     <TD>First Chapter</TD>
>   </TR>
>   <TR>
>     <TD></TD>
>     <TD>Second Chapter
>     </TD>
>   </TR>
>   <TR>
>     <TD></TD>
>     <TD>Subchapter 1</TD>
>   </TR>
>   <TR>
>     <TD></TD>
>     <TD>Subchapter 2</TD>
>   </TR>
>   <TR>
>     <TD></TD>
>     <TD>Third Chapter
>
>     </TD>
>   </TR>
>   <TR>
>     <TD></TD>
>     <TD>Subchapter A</TD>
>   </TR>
>   <TR>
>     <TD></TD>
>     <TD>Subchapter B
>
>     </TD>
>   </TR>
>   <TR>
>     <TD></TD>
>     <TD>sub a</TD>
>   </TR>
>   <TR>
>     <TD></TD>
>     <TD>sub b</TD>
>   </TR>
>   <TR>
>     <TD></TD>
>     <TD>Subchapter C</TD>
>   </TR>
> </TABLE>
>
>
> The desired output (according to the example I got this from) should be:
> <TABLE BORDER="1">
>  <TR>
>  <TH>Number</TH>
>  <TH>text</TH></TR>
>  <TR>
>  <TD>1</TD>
>  <TD>First Chapter</TD></TR>
>  <TR>
>  <TD>2</TD>
>  <TD>Second Chapter
>  </TD></TR>
>  <TR>
>  <TD>1</TD>
>  <TD>Subchapter 1</TD></TR>
>  <TR>
>  <TD>2</TD>
>  <TD>Subchapter 2</TD></TR>
>  <TR>
>  <TD>3</TD>
>  <TD>Third Chapter </TD></TR>
>  <TR>
>  <TD>1</TD>
>  <TD>Subchapter A</TD></TR>
>  <TR>
>  <TD>2</TD>
>  <TD>Subchapter B </TD></TR>
>  <TR>
>  <TD>1</TD>
>  <TD>sub a</TD></TR>
>  <TR>
>  <TD>2</TD>
>  <TD>sub b</TD></TR>
>  <TR>
>  <TD>3</TD>
>  <TD>Subchapter
>  C</TD></TR></TABLE>
>
>
> As you can see, the output I get does not insert the number. Any help is
> appreciated.
> Thanks
>
>  - Jerry
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.