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


Daviid

<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:xs="http://www.w3.org/2001/XMLSchema";>
<xsl:variable name="x">
  <x>2</x>
</xsl:variable>
  <xsl:template name="main">
    <xsl:value-of select="2.0 eq $x"/>
  </xsl:template>
</xsl:stylesheet>

Current Thread