Subject: Re: [xsl] Using "except" where some nodes are copies (not the original)? From: Dimitre Novatchev <dnovatchev@xxxxxxxxx> Date: Wed, 28 Dec 2011 17:02:24 -0800 |
Anyway, I think that mixing together two kind of identities (node identity and value identity) is not a safe practice. My first answer uses value-identity entirely. On Wed, Dec 28, 2011 at 4:59 PM, Dimitre Novatchev <dnovatchev@xxxxxxxxx> wrote: > Perhaps: > > (A, B, C) > B B B B [for $n in . > B B B B B return > B B B B B B B not( ($B, C) > B B B B B B B B B B B B [deep-equal(., $n)] > B B B B B B B B B B ) > B B B B ] > > > > > On Wed, Dec 28, 2011 at 3:17 PM, Costello, Roger L. <costello@xxxxxxxxx> 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> >> B B <A/> >> B B <B/> >> B B <C/> >> </Test> >> >> Set <Test> as the context node. >> >> This operation: >> >> B B (A, B,, C) except (B, C) >> >> returns: >> >> B B (A) >> >> Nice. >> >> Now, make a copy of B and store it into a variable: >> >> B B B <xsl:variable name="B" as="element(B)"> >> B B B B B B B B <xsl:copy-of select="B" /> >> B B B </xsl:variable> >> >> Run the same operation, but using the variable: >> >> B B (A, B, C) except ($B, C) >> >> Returns: >> >> B B (A, B) >> >> Ouch! >> >> B I don't want that behavior. I want: >> >> B B (A, B, C) except ($B, C) >> >> to return: >> >> B B (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 >> > > > > -- > 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. -- 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.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Using "except" where some, Dimitre Novatchev | Thread | Re: [xsl] Using "except" where some, Michael Kay |
Re: [xsl] Using "except" where some, Dimitre Novatchev | Date | Re: [xsl] Using "except" where some, Michael Kay |
Month |