Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old May 16th, 2007, 12:50 PM
Authorized User
Join Date: Feb 2007
Posts: 51
Thanks: 3
Thanked 0 Times in 0 Posts
Default Display Outline Format from Nested XML Structure

I have an XML input file that has elements organized hirarchically in a giant tree structure. I desire to organize the html output file such that each node has an identifier that corresponds to it relative position in the tree, both with respect to its peers and it ancestors. Something like an MSWord doc outline:

1 top level
 1.1 2nd level
     1.1.1 3rd level
     1.1.2 3rd level 4th level
     1.1.3. 3rd level
 1.2 2nd level
2 top level

I use recursion in my xslt, with a:
<xsl:apply-templates select="foobar">

structure. Unfortunately, this always restarts the numbering at the new child level, rather than what I am trying to achieve above.

Any help is greatly appreciated. Thanks!

Old May 16th, 2007, 12:59 PM
mhkay's Avatar
Wrox Author
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts

Take a look at <xsl:number level="multiple">

Michael Kay
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
Old May 16th, 2007, 03:43 PM
Authorized User
Join Date: Feb 2007
Posts: 51
Thanks: 3
Thanked 0 Times in 0 Posts

That worked great. Thanks Michael!

Similar Threads
Thread Thread Starter Forum Replies Last Post
Directory structure to XML. harshm XML 2 March 8th, 2013 04:55 PM
Convert Flat structure to Nested dani1 XSLT 2 October 29th, 2008 02:51 AM
Display checkbox inside Table like structure in Vb remya1000 General .NET 0 May 15th, 2008 03:59 PM
XML structure for easy XSLT coldstar XSLT 2 September 10th, 2006 04:09 PM
backslash in XML structure crmpicco Classic ASP Basics 0 May 3rd, 2005 06:45 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.