[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: compare two nodes (the child elements, not the str

Subject: Re: compare two nodes (the child elements, not the string values) in XSLT 1.0
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Thu, 07 Jul 2011 12:00:39 -0400
Re:  compare two nodes (the child elements
Dear Wolfhart,

On 7/7/2011 12:55 AM, Wolfhart Totschnig wrote:
For my particular case, I found a less complicated solution than
Wendell's, but it's a particular solution, not a general one:

<xsl:variable name="last" select="last"/>
<xsl:if test="path/person/last=last and (not(first) or
path/person[last=$last]/first=first) and (not(middle) or
path/person[last=$last]/middle=middle)">

Yes, but that will fail if you have two persons, one with the same last and first names and another with the same last and middle names ...


The reason this is hard is that "equality" for node comparison purposes is impossible to specify adequately for the general case (largely but not entirely due to whitespace-related issues), so even a good general definition (such as in 2.0 deep-equal()) is only somewhat useful. So more powerful means have to be applied.

I am amazed that there is no simple general solution for this kind of
problem in XSLT 1.0. I thought I must be overlooking something obvious.
XSLT 2.0 indeed makes life easier!

I think part of the reason why XSLT 1.0 was so successful was that they limited the scope to a set of problems already well understood, deliberately leaving it to be filled out later. If they had tried to be more comprehensive and general, they might well have botched it. (Plus, we wouldn't have the useful alignment with XQuery as well as other advantages.)


In other words, XSLT 2.0 is the correct approach even from the XSLT 1.0 point of view.

Cheers, Wendell

--
======================================================================
Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.