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

Simple m-n numbering within deeper m-m-...-n structure

Subject: Simple m-n numbering within deeper m-m-...-n structure
From: "Trevor Nicholls" <trevor@xxxxxxxxxxxxxxxxxx>
Date: Thu, 21 Jul 2005 11:47:29 +1200
mm n
Hi

Doubtless this is trivial to anyone but a novice - but I'm a novice.

I have a document structure that contains sections nested to arbitrary
depth. Sections may have complex content but their ancestry will consist
only of sections (up to the document root).

I can number my sections (1, 2, 2-1, 2-1-1, 2-2, 3 etc.) but my problem is
where I want to generate labels for some of the components within the
sections (namely figures and tables). The numbers I generate for these need
to reflect their sequence within the top-level section (in other words, if
each of the sections in the above list contains a single table, then these
tables should be labelled 1-1, 2-1, 2-2, 2-3, 3-1).

I'm using the following expression:
  Table<xsl:text> </xsl:text>
  <xsl:number count="/document/section" level="single"/>
  <xsl:text>-</xsl:text>
followed by another <xsl:number>; but I can't figure out the right
expression for it:

  <xsl:number level="any"/>
      gives me 1-1, 2-2, 2-3, 2-4, 3-5
  <xsl:number count="/document/section//table"/>
      gives me 1-1, 2-1, 2-1, 2-1, 3-1

I expected both of those results but they aren't what I want.
I imagine that what I really want is
  <xsl:number count="table" from="{the /document/section node which is in
the context node's ancestral set}"/>

I'm sure there's an elegant way of putting that, but it is eluding me.

Cheers
Trevor

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.