[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
At 2007-11-29 09:35 +0000, Kavita Surana wrote:
Fine. Your objective is then to traverse the source tree at least twice: once during the TOC and once during the body, using the same algorithm for determining TOC members as you use for determining body members.
Yes, this would never work. The result tree is not an addressable construct in XSLT. The id() function (as all other tree-related functions) act on the read-only source tree or, in XSLT 2, temporary in-memory trees declared by the stylesheet, and never on any result tree constructs.
It is very common to have to traverse the same source-tree nodes in the same way but with two different objectives. And, since you know the source-tree is read-only, you are guaranteed that the inputs to your traversals will not be different every time you walk the tree.
I hope this helps.
. . . . . . . . . . . Ken
Re: [xsl] Problem while displaying TOC in XSL-FO
Subject: Re: [xsl] Problem while displaying TOC in XSL-FO From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Thu, 29 Nov 2007 07:55:53 -0500 |
At 2007-11-29 09:35 +0000, Kavita Surana wrote:
In my document few sections and sub-sections will get displayed based on some condition so while displaying Table of Contents my requirement is to display the heading of the section/sub-section in TOC only if it is present in the document.. For instance if
Section1 has 2 subsections ->sub-section1 ->sub-section2
and if the criteria which displays these two subsections is not satisfied then these two will not be present in the document. So in this case while displaying TOC I should not display Section heading as well as subsection heading.
Fine. Your objective is then to traverse the source tree at least twice: once during the TOC and once during the body, using the same algorithm for determining TOC members as you use for determining body members.
I was trying to do that by assigning id to each fo:block which actually holds contents and calling id() function in TOC to check if there is any node present with this id in the document, but it doesn't work at all.
Yes, this would never work. The result tree is not an addressable construct in XSLT. The id() function (as all other tree-related functions) act on the read-only source tree or, in XSLT 2, temporary in-memory trees declared by the stylesheet, and never on any result tree constructs.
It is very common to have to traverse the same source-tree nodes in the same way but with two different objectives. And, since you know the source-tree is read-only, you are guaranteed that the inputs to your traversals will not be different every time you walk the tree.
I hope this helps.
. . . . . . . . . . . Ken
-- Comprehensive in-depth XSLT2/XSL-FO1.1 classes: Austin TX,Jan-2008 World-wide corporate, govt. & user group XML, XSL and UBL training RSS feeds: publicly-available developer resources and training G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995) Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Problem while displaying TOC , Kavita Surana | Thread | [xsl] Problem while displaying TOC , Kavita Surana |
RE: [xsl] include error, Michael Kay | Date | Re: [xsl] Matching namespaces - one, G. Ken Holman |
Month |