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

RE: Problem with Key matching XSLT 1.0

Subject: RE: Problem with Key matching XSLT 1.0
From: "Etheridge, Stephen" <stephen.etheridge@xxxxxxxxxx>
Date: Tue, 14 Sep 2010 11:40:06 +0100
RE:  Problem with Key matching XSLT 1.0
Martin

Many thanks - works perfectly!  I am slowly beginning to understand
context nodes I hope!

Kind regards
Stephen

-----Original Message-----
From: Martin Honnen [mailto:Martin.Honnen@xxxxxx]
Sent: 14 September 2010 11:32
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re:  Problem with Key matching XSLT 1.0

Etheridge, Stephen wrote:

> I am trying to compare two xml documents of the same format.  I have
> successfully transformed the documents to include a field called
ItemKey
> which includes a unique key (comprised of four other elements).  I am
> now trying to match and compare elements based on that key value.
>
> My XSLT includes the following as "global" variables:
>
> <xsl:variable name="file1">test_comp4.xml</xsl:variable>
> <xsl:variable name="old_file"
> select="document($file1)/*"></xsl:variable>
> <xsl:variable name="file2">test_comp4_edited.xml</xsl:variable>
> <xsl:variable name="new_file"
> select="document($file2)/*"></xsl:variable>
> <xsl:output method="xml" indent="yes"/>
> <xsl:key name="test" match="//ItemKey" use="//ItemKey"/>

First of all, in a pattern like the match attribute you never need to
start with "//", match="ItemKey" is enough, doing match="//ItemKey" does

not gain anything.
And
   match="//ItemKey" use="//ItemKey"
looks very odd, usually the "use" attribute selects an attribute (e.g.
use="@foo") or a child element (e.g. use="bar") or the node itself (e.g.

use=".") but putting use="//ItemKey" looks wrong, that way you "key" any

"ItemKey" element on any "ItemKey" element in the document.

--

	Martin Honnen
	http://msmvps.com/blogs/martin_honnen/



Please help Logica to respect the environment by not printing this email  /
Pour contribuer comme Logica au respect de l'environnement, merci de ne pas
imprimer ce mail /  Bitte drucken Sie diese Nachricht nicht aus und helfen Sie
so Logica dabei, die Umwelt zu sch|tzen. /  Por favor ajude a Logica a
respeitar o ambiente nao imprimindo este correio electronico.



This e-mail and any attachment is for authorised use by the intended
recipient(s) only. It may contain proprietary material, confidential
information and/or be subject to legal privilege. It should not be copied,
disclosed to, retained or used by, any other party. If you are not an intended
recipient then please promptly delete this e-mail and any attachment and all
copies and inform the sender. Thank you.

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.