Re: [xsl] Getting WordprocessingML p style

Subject: Re: [xsl] Getting WordprocessingML p style
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 2 Feb 2007 19:19:15 GMT
>   Mmh, just use eq if you compare an atomic value to an other one, and
> = if you test if an atomic value is equal to one of several values,
> isn't it?

It isn't just the cardinality rules that are different, the way
comparing values of different types are handled differs as well, with =
being more lenient than eq (and even more lenient in backward
compatibilty mode). Generally speaking I find the = behaviour more
natural, and easier to type (which is an important consideration:-)

compare the stylesheet below which returns
$ saxon8 -it main eq.xsl 
Error on line 6 of file:/c:/tmp/eq.xsl:
  XPTY0004: Cannot compare xs:decimal to xdt:untypedAtomic
Failed to compile stylesheet. 1 error detected.

change the eq to = and it returns
$ saxon8 -it main eq.xsl 
<?xml version="1.0" encoding="UTF-8"?>true


<xsl:stylesheet version="2.0"
<xsl:variable name="x">
  <xsl:template name="main">
    <xsl:value-of select="2.0 eq $x"/>

Current Thread