Given the following simple input, I’d like to produce the simple output that follows that:
2. | h
3. | | g
4. | | q
The content to the right of the line number is easy with code like this:
<xsl:variable name="level" select="count(ancestor::row-source)"/>
<xsl:variable name="line-number" select="???"/>
<xsl:value-of select="string-join(for $i in 1 to $level return $HIERARCHY, '')"/>
My question is: Is there an [efficient] XSLT idiom that I can use to set the value of line-number to the right line number? My case seems like it should be simple, because the right line number is simply the position of the current node within the sequence ancestor:parent//a.
I don’t like the thought of having to use an intermediate tree and walk it by position, but I know how to do it if that’s the right way.
Hotsos Enterprises, Ltd.
Nullius in verba
- Performance Diagnosis 101: 1/4 Calgary
- SQL Optimization 101: 11/8 Dallas, 12/13 Atlanta
- Hotsos Symposium 2005: March 6–10 Dallas
- Visit www.hotsos.com for schedule details...