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

Re: Table of contents - for-each question

Subject: Re: Table of contents - for-each question
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 24 Jan 2006 17:21:16 GMT
content nesting
Please don't take things off list (see the xsl-list guidelines).
As I suspected your c03 elements are children of the c02 elements (so
not children of the current node at the point of the for-each.

You could use something like //*[self::c02 or self::c03]
                                [head or @level="subseries" or @level="series"]

But if your table of content nesting mirrors the nesting of your input
elements the normal thing to do is not try to work out indents and such
up front, but just simply use apply-templates to walk down the tree,
making a table of contents as you go, something like

<xsl:template match ="*[self::c02 or self::c03]
                                [head or @level="subseries" or
                                @level="series"]" mode="toc">
<div class="toc">
  <a href="#{generate-id()}">....</a>
  <xsl:if test="*[self::c02 or self::c03]
                                [head or @level="subseries" or
                                @level="series"]">
   <div class="toc">
   <xsl:apply-templates select="*[self::c02 or self::c03]
                                [head or @level="subseries" or
                                @level="series"]"/>
   </div>
  </xsl:if>
</div>



together with some css for class toc that indents. This way, if the
current node has any subsections you styart up a child div in the output
(which will then increase the total indent) and process each of those
children.

David


________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

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.