[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: hierarchic counting in flat structures
At 2012-11-02 11:16 +0100, Norbert Heidbrink wrote:
Hi everyone,
I think you want this (which I don't have the time to throw into a quick test): <xsl:template match="H4"> <xsl:text>
 H4: </xsl:text> <xsl:value-of select="1 + count( preceding-sibling::H4 ) - count( preceding-sibling::H3[1]/preceding-sibling::H4 )"/ </xsl:template> One of the exercises on day 2 of my class brings this approach to axes to light by mimicking the conversion of scanned legacy content into a structure. In a sentence the above is determining: "the difference between the count of all preceding sibling H4's and the count of the H4's that precede the closest preceding H3" ... which will give you the count of H4's up to to the closest preceding H3. Then add 1 for the given H4. A similar technique is done when analyzing table column position differences. </xsl:template>
I hope this helps. . . . . . . . . . Ken
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|