Re: [xsl] Select All Except First and Last

Subject: Re: [xsl] Select All Except First and Last
From: Graydon <graydon@xxxxxxxxx>
Date: Mon, 2 Dec 2013 16:34:04 -0500
On Mon, Dec 02, 2013 at 04:10:13PM -0500, Nathan Tallman scripsit:
> I'm using XSLT 2.0 and Saxon EE 9.4; I thought (and hoped) that the
> below would work, alas it's not.
> <xsl:for-each select="extent[not(extent[1])]">
>     <xsl:value-of select="." separator=", "/>
> </xsl:for-each>

The constraint has the context of the node given in the select, so
you're asking for the extent that hasn't got an extent child.

I think you want

<xsl:for-each select="extent[not(position() = (1,last()))]">
     <xsl:value-of select="." separator=", "></xsl:value-of>

Though I'd generally question using for-each here.

-- Graydon

Current Thread