[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl]Problem with Position()?


Subject: Re: [xsl]Problem with Position()?
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Sat, 13 Oct 2007 18:25:19 +0200

Jay Bryant wrote:

Try changing the test to use the preceding-sibling axis, thus:


<xsl:when test="count(preceding-sibling::p) = 0">

That test catches the first p in a series of neighboring p elements.



Be aware that with large input files and with a not-too-optimizing processor, this test might perform quadratic. If that happens, you can try changing it to:

<xsl:when test="not(preceding-sibling::p[1])">

which will behave the same but is easier optimized by the processor.

A note to the OP: in your xsl:otherwise statement you have na added xsl:if which seems redundant there because it tests for the inverse of the xsl:when. If so intended, you can remove it.

Cheers,
-- Abel Braaksma


Current Thread