Subject: RE: Dealing without global counters
From: "Robert Ogden" <Robert.Ogden@xxxxxxxx>
Date: Fri, 14 Nov 2003 07:55:51 -0600
|
Thank you Michael! It works like a charm, thanks for pointing out the
ease of simplicity.
Robert Ogden
IETM Developer
Navy Programs
(763) 572-7121
>>> mhk@xxxxxxxxx 11/12/03 04:01AM >>>
The easiest way to do this is with a two-phase transformation. First
generate the output records in the right order on a temporary tree,
then
use xsl:number (or simply position()) to add the numbers while copying
to a final tree.
Michael Kay
> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of
> Robert Ogden
> Sent: 12 November 2003 00:25
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Dealing without global counters
>
>
> I have done a bit of reading, and it seems global counters are not
the
> answer in XSLT. That being said I have a problem (normally solved by
a
> global counter) I need to solve. I'm building a TOC for an XML
> document.
> The best way is to offer xml structure and intended output.
>
> XML:
> <chapter>
> <para>
> </para>
> <para>
> </para>
> <image>
> </image>
> <para>
> </para>
> <image>
> </image>
> <table>
> <table>
> <para>
> <para>
> </chapter>
>
> Output (this output is a javascript array for an expandable TOC)
> db[1]=new dbRecord(chapter stuff)
> db[2]=new dbRecord(first para stuff)
> db[3]=new dbRecord(second para stuff)
> db[4]=new dbRecord(third para stuff)
> db[5]=new dbRecord(fourth para stuff)
> db[6]=new dbRecord(first image stuff)
> db[7]=new dbRecord(second image stuff)
> db[8]=new dbRecord(first table stuff)
>
> What I want to do is output a chapter, all text in a chapter, then
all
> images for a chapter, and lastly all tables for a chapter.
> This is done repetitively for each chapter.
>
> For the text, calling a template that contains <xsl:number>
> would work.
> I would get a sequential numbering in the db[] (which IS required,
> db[number] where number is sequential 1 to N). But as you see the
> figures and tables are interlaced in the XML, and not desired
> to be that
> way in the TOC.
>
> Any help would be appreciated.
> Thanks,
>
> Robert Ogden
> IETM Developer
> Navy Programs
> (763) 572-7121
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
>
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 |
|
Michael Kay - Wed, 12 Nov 2003 05:02:00 -0500 (EST)
Robert Ogden - Fri, 14 Nov 2003 09:01:12 -0500 (EST) <=
|
|