xsl-list
[Top] [All Lists]

Re: [xsl] Getting WordprocessingML p style

2007-02-02 12:19:38

  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>


--~------------------------------------------------------------------
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>
--~--