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

RE: can I give xsl:number a starting position?

Subject: RE: can I give xsl:number a starting position?
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Wed, 4 Sep 2002 09:33:28 +0100
xsl number start
I think you will have to do something along the lines of:

<xsl:number
value="count(ancestor::chapter/preceding-sibling::chapter)+$start-chapte
r"
format="1"/>
<xsl:text>.</xsl:text>
<xsl:number value="count(ancestor::h1/preceding-sibling::h1)+$start-h1"
format="1"/>
<xsl:text>.</xsl:text>
<xsl:number value="count(ancestor::h2/preceding-sibling::h2)+$start-h2"
format="A"/>

etc.

Michael Kay
Software AG
home: Michael.H.Kay@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx 

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> Jeff Rosler
> Sent: 04 September 2002 02:56
> To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  can I give xsl:number a starting position?
> 
> 
> Hi All,
> 
> I would like to use xsl:number to handle section numbering in 
> my document, but I need to tell it a section number to start 
> with (i.e. not 1). Can someone tell me if there is an easy 
> way to do this? I was trying the following -
> 
> <xsl:number count="chapter|h1|h2|h3|h4" format="1.1.A.1.A" 
> level="multiple"/>
> 
> This works fine, but always starts at 1.1.A.1.A. I tried 
> setting format to the section that I want it to start, but 
> that didn't work. At the moment, I'm thinking that I'll need 
> to write some convoluted code using
> position() for each section number, but I thought I'd try and 
> post this and see if anyone else has solved this problem 
> before reinventing the wheel :-).
> 
> Basically, my problem is that I have an XML document that's 
> been chunked up into smaller pieces. I need to convert each 
> of those pieces to HTML separately, with the correct section 
> numbers. In my case, I am doing this by running some Java 
> code that uses JAXP to call the transform (and set a 
> parameter for the XSL with the correct starting section 
> number). My thinking is that I can use the param in my XSL as 
> a starting position to xsl:number (maybe something like the 
> following) -
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet version="1.0"
>   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>   xmlns="http://www.w3.org/1999/xhtml"
> >
> <xsl:output indent="yes" method="html" 
> omit-xml-declaration="no" encoding="ISO-8859-1"
>   doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
>  
> doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transit
> ional.dtd"
> />
> 
> <xsl:param name="starting_section" />
> 
> ...
> 
> <xsl:number count="chapter|h1|h2|h3|h4" 
> format="$starting_section" level="multiple"/>
> 
> ...
> 
> However, since I can't get it to work with a hard coded 
> value, I haven't added the code for the starting_section param
> 
> Thanks for any and all feedback,
> 
> Jeff Rosler
> Consultant
> Flatirons Solutions Corp
> 2555 55th Street
> Suite 100D
> Boulder, CO  80301
> 303-544-0514 x11
> jeff.rosler@xxxxxxxxxxxxxxxxxxxxxx
> 
> 
>  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.