Subject: Re: [xsl] XML overlap - processing a node-set defined by <start/> and <end/>|
From: "James Fuller" <james.fuller.2007@xxxxxxxxx>
Date: Sat, 17 Feb 2007 22:59:15 +0100
Until I found out more about the later mentioned validator build on Saxon, my XSLT related question is this:
Is the best (performant) way to work on the selection the following?
<xsl:variable name="precedingStarts" select="count(preceding::text:start)"/>
<xsl:if test="$precedingStarts != 0"> <xsl:variable name="followingEnds" select="count(following::text:end)"/> <xsl:if test="$precedingStarts = $followingEnds"> <!-- do something --> </xsl:if> </xsl:if>
don't know, though it smells like you could just work off some alternating thing as in theory starts and ends should match (and alternate), should save xslt from calculating a few count() operations each time.
its like the alternate row colour problem for tables, e.g. (position() - 1) mod 2
irregardless of how you are keying your text: element(s) where just remember that your 1st text:element to 2nd text:element would be your first range, 3rd text:element to 4th text:element be your second range, etc...
Is there any possibility to cache this?
there is a possibility to compile your xslt using xsltc, I think latest saxon supports this.