xsl-list
[Top] [All Lists]

Re: [xsl] compare two nodes (the child elements, not the string values) in XSLT 1.0

2011-07-06 14:15:56
Thanks for the fast reply! But deep-equal is not an XSLT 1.0 function. The script will be processed by a browser (Firefox), and so I have to remain within XSLT 1.0.

Wolfhart


Robby Pelssers wrote:
http://www.w3.org/TR/xpath-functions/#func-deep-equal

-----Original Message-----
From: Robby Pelssers [mailto:Robby(_dot_)Pelssers(_at_)nxp(_dot_)com] Sent: Wednesday, July 06, 2011 8:57 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] compare two nodes (the child elements, not the string 
values) in XSLT 1.0

Try the deep-equal function...
Robby

-----Original Message-----
From: Wolfhart Totschnig [mailto:wolfhart(_at_)totschnig(_dot_)org] Sent: Wednesday, July 06, 2011 8:55 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] compare two nodes (the child elements, not the string values) in 
XSLT 1.0

Hello,

I have a seemingly simple xslt problem to which I cannot find the solution. I want to test whether the context node, which is an <author> element with the form (first?, middle?, last), is equal to one of a set of <person> elements. By "equal" I mean having the same child elements and values of these elements. At first, I thought it would be as easy as

test="path/person = ."

But then I realized that the "=" operator compares the string values of the nodes, such that

<author>
<first>John</first>
<last>Doe</last>
</author>

and

<person>
<last>JohnDoe<last>
</person>

will be evaluated as equal, which I want to avoid. So how can I check, in XSLT 1.0, whether two nodes are equal in the sense I intend?

Thank you for your help!
Wolfhart


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


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