Re: [xsl] XML overlap - processing a node-set defined by <start/> and <end/>

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
yes, clix is the next step,

http://www.mulberrytech.com/Extreme/Proceedings/html/2004/Piez01/EML2004Piez01.html

is another good paper.

there are a few ways to skin this cat;

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

u could even eschew start and end and just use single text:mark element

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...

u could prob optimise using xsl:key as well.

dont know, dont have enough time to try it myself.

Is there any possibility to cache this?

there is a possibility to compile your xslt using xsltc, I think latest saxon supports this.

gl, James Fuller

Current Thread