XSL 2
I've clearly got a fundamental blindspot with the count function.
In a nutshell, I'm trying to figure out how deeply nested a certain
element is.
I'm finding that this construct:
\xA0 \xA0 <xsl:value-of select="my:repeat-string('\xA0 \xA0 ', count(ancestor::li or
ancestor::step))" />
is always producing the same output no matter how many ancestor lists
there are
It turns out that "count(ancestor::li or ancestor::step)" always
evaluates to 1 even when there are no ancestors at all
I've "corrected" my stylesheet so that it uses
\xA0 \xA0 <xsl:value-of select="my:repeat-string('\xA0 \xA0 ', count(ancestor::li) +
count(ancestor::step))" />
which works exactly as I'd expect.
Why doesn't the single count(a or b) give the same result as count(a) +
count(b)?
cheers
T
\xA0
| Current Thread |
- the count function
- Trevor Nicholls trevor@xxxxxxxxxxxxxxxxxx - 2 Oct 2026 15:03:50 -0000 <=
|
|