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

Re: Using "except" where some nodes are copies (not th

Subject: Re: Using "except" where some nodes are copies (not the original)?
From: Michael Kay <mike@xxxxxxxxxxxx>
Date: Thu, 29 Dec 2011 09:57:01 +0000
Re:  Using "except" where some nodes are copies (not th
replace ($X except $Y) by

$X[not(some $y in $Y satisfies deep-equal(., $y))]

It's likely to be an expensive operation.

Michael Kay
Saxonica


On 28/12/2011 23:17, Costello, Roger L. wrote:
Hi Folks,

How do I do set subtraction where some of the nodes in the two sets may be copies (not originals)?

Please allow me to explain.

Consider this XML document:

<Test>
     <A/>
     <B/>
     <C/>
</Test>

Set<Test> as the context node.

This operation:

(A, B,, C) except (B, C)

returns:

(A)

Nice.

Now, make a copy of B and store it into a variable:

       <xsl:variable name="B" as="element(B)">
                 <xsl:copy-of select="B" />
        </xsl:variable>

Run the same operation, but using the variable:

(A, B, C) except ($B, C)

Returns:

(A, B)

Ouch!

I don't want that behavior. I want:

(A, B, C) except ($B, C)

to return:

(A)

How do I achieve the behavior I desire?

That is, how do I do set subtraction where some of the nodes in the two sets may be copies?

/Roger

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.