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

Re: Dynamic numbering of lists in xslt

Subject: Re: Dynamic numbering of lists in xslt
From: cknell@xxxxxxxxxx
Date: Mon, 08 Jan 2007 14:50:13 -0500
Re:  Dynamic numbering of lists in xslt
That response reminded me of one of my favorite lawyer jokes.

Without seeing your XSLT, we can only give you a very general answer. Given what I see in your source code, and assuming that you have a template that matches the "section" element, I would use this:

<xsl:template match="section">
  <xslt:value-of select="position()" />.<xslt:value-of select="." />
</xslt:template>
-- 
Charles Knell
cknell@xxxxxxxxxx - email



-----Original Message-----
From:     xslt.new <xslt.new@xxxxxxxxx>
Sent:     Mon, 8 Jan 2007 13:20:41 -0600
To:       xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:  Re:  Dynamic numbering of lists in xslt

Hi:

Thank you for your reply. Can you give me an idea of how this can be achieved?

On 1/8/07, Alexey Nickolaenkov <nikolaenkov@xxxxxxxxxxxx> wrote:
> yes.
>
> Monday, January 8, 2007, 10:04:47 PM, you wrote:
>
> xn> Hi:
>
> xn> I am a newbie to xslt and XSLFO. I have to do a numbering which offers the
> xn> flexibility to reorder elements if an element in between is being removed.
>
> xn> I will try to demonstrate with an example input.
>
> xn> <chapter1>
> xn>    <section>first section<section>
> xn> </chapter1>
> xn> <chapter1>
> xn>   <section>second section</section>
> xn> </chapter1>
> xn> <chapter1>
> xn>   <section>third section</section>
> xn> </chapter1>
> xn> <chapter1>
> xn>   <section>fourth section</section>
> xn> </chapter1>
>
> xn> So, I want my output to look like
>
> xn> 1. first section
> xn> 2. second section
> xn> 3. third section
> xn> 4. fourth section
>
> xn> and so on. Suppose one chapter1 element is removed in between, lets say
> xn> second section, then the numbering should reset itself so that now the
> xn> output looks like:
>
> xn> 1. first section
> xn> 2. third section
> xn> 3. fourth section
>
> xn> Is it possible to achieve this in xslt and XSLFO?
>
> xn> Please do let me know.
>
> xn> Thanks
>
>
> --
> Alexey                            mailto:alexey.nikolaenkov@xxxxxxxxxxxx

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.