xsl-list
[Top] [All Lists]

Re: [xsl] Using "except" where some nodes are copies (not the original)?

2011-12-28 19:00:30
Perhaps:

(A, B, C)
        [for $n in .
           return
              not( ($B, C)
                         [deep-equal(., $n)]
                    )
         ]




On Wed, Dec 28, 2011 at 3:17 PM, Costello, Roger L. 
<costello(_at_)mitre(_dot_)org> 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


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




-- 
Cheers,
Dimitre Novatchev
---------------------------------------
Truly great madness cannot be achieved without significant intelligence.
---------------------------------------
To invent, you need a good imagination and a pile of junk
-------------------------------------
Never fight an inanimate object
-------------------------------------
To avoid situations in which you might make mistakes may be the
biggest mistake of all
------------------------------------
Quality means doing it right when no one is looking.
-------------------------------------
You've achieved success in your field when you don't know whether what
you're doing is work or play
-------------------------------------
Facts do not cease to exist because they are ignored.
-------------------------------------
I finally figured out the only reason to be alive is to enjoy it.

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

<Prev in Thread] Current Thread [Next in Thread>