xsl-list
[Top] [All Lists]

RE: [xsl] comparing a part of the XML tree

2007-07-16 03:48:00
Then you want

some $o in original/* satisfies deep-equal(selection/*, $o)

or if you prefer

original/*[deep-equal(., selection/*)]

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

-----Original Message-----
From: Jethro Borsje [mailto:jethro(_at_)jesdesign(_dot_)nl] 
Sent: 16 July 2007 11:44
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] comparing a part of the XML tree

I can not manage to make the deep-equal function work with 
the node() 
function.

change node() (which is not a function) to *

deep-equal(body/selection/*, body/original/*)

This works well when I have 1 element as child of the "original" 
element, however when using the following input:
<body>
      <selection>
              <z color="blue" flavor="vanilla">test 1</z>
      </selection>
      <original>
              <x color="red" flavor="chocolate">test 2</x>
              <z color="blue" flavor="vanilla">test 1</z>
      </original>
</body>

With this stylesheet:
<xsl:template match="/">
      <xsl:choose>
              <xsl:when test="deep-equal(body/selection/*,
body/original/*)">true</xsl:when>
              <xsl:otherwise>false</xsl:otherwise>
      </xsl:choose>
</xsl:template>

It results in "false", while there is a node in <original> 
which is equal to the node in <selection>.

--
Best regards,
Jethro Borsje

http://www.jborsje.nl

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



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