[Home] [By Thread] [By Date] [Recent Entries]
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 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
|

Cart



