RE: [xsl] preceding axis and context switching (was re: configuring conditionals)

Subject: RE: [xsl] preceding axis and context switching (was re: configuring conditionals)
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 31 May 2005 22:35:55 +0100
> Actually, I wasn't understanding how the preceding axis was working,
> nor exactly how your posted code.  So I left out the position
> conditional, which was the problem.  This works:
> 
>   <xsl:function name="bib:ibid" as="xs:boolean">
>     <xsl:param name="citation" as="node()"/>
>     <xsl:value-of select="$citation/db:biblioref/@linkend =
> $citation/preceding::db:biblioref[1]/@linkend"/>
>   </xsl:function>
> 

You should follow the advice to use xsl:sequence

xsl:value-of creates a text node containing the string "true" or "false",
which by virtue of the as="xs:boolean" is then cast to the boolean true() or
false(). Using xsl:sequence would avoid this.

Saxon isn't yet smart enough to avoid the round trip from a boolean to a
text node and back again. It does in fact round trip correctly, because
xs:boolean("false") unlike fn:boolean("false") is false.

Michael Kay
http://www.saxonica.com/

Current Thread