xsl-list
[Top] [All Lists]

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

2005-05-31 14:35:55
 

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/



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--