As others have noted, union, except and intersect use node-identity
based comparison.
You can have a look at the set datatype I implemented recently in
XPath 3.0 -- this should be usable with early implementations of XPath
3.0 and is working fine with Saxon EE 9.3.04 -- XQuery 3.0.
https://dnovatchev.wordpress.com/2011/02/20/the-set-datatype-implemented-in-xpath-3-0/
I expect that a few bugs uncovered in the XSLT processor of Saxon EE
9.3.04 will be fixed soon and then the set datatype will be usable
from XSLT 3.0 too.
--
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
-------------------------------------
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.
On Sun, Mar 20, 2011 at 5:48 AM, Alex Muir
<alex(_dot_)g(_dot_)muir(_at_)gmail(_dot_)com> wrote:
Hi,
I'm confused as to why I'm not able to get intersect and except to
work with the following node sets.
Given list of new an old office codes:
<newOfficeCodeList>PT,BX,FR</newOfficeCodeList>
<oldOfficeCodeList>BX,FR</oldOfficeCodeList>
I create some node sets:
<xsl:template name="codeListAsXML">
<xsl:param name="OfficeCodeList"/>
<xsl:param name="OfficeCodeArgSeperator"/>
<xsl:variable name="result" as="node()*">
<xsl:analyze-string select="$OfficeCodeList"
regex="{$OfficeCodeArgSeperator}">
<xsl:non-matching-substring>
<code>
<xsl:value-of select="normalize-space(.)"/>
</code>
</xsl:non-matching-substring>
</xsl:analyze-string>
</xsl:variable>
<xsl:sequence select="$result"/>
</xsl:template>
The old set of office codes:
<xsl:variable name="oldOfficeCodeListXML" as="node()*">
<xsl:call-template name="codeListAsXML">
<xsl:with-param name="OfficeCodeList" select="$oldOfficeCodeList"/>
<xsl:with-param name="OfficeCodeArgSeperator" select="','"/>
</xsl:call-template>
</xsl:variable>
The new set of office codes:
<xsl:variable name="newOfficeCodeListXML" as="node()*">
<xsl:call-template name="codeListAsXML">
<xsl:with-param name="OfficeCodeList" select="$newOfficeCodeList"/>
<xsl:with-param name="OfficeCodeArgSeperator" select="','"/>
</xsl:call-template>
</xsl:variable>
I tried some different ways to get the except and or intersect in the
following variables with the result following the ==>
<newOfficeCodeList>PT,BX,FR</newOfficeCodeList>
<oldOfficeCodeList>BX,FR</oldOfficeCodeList>
<xsl:variable name="exceptOldNewOfficeCode"
select="$newOfficeCodeListXML except $oldOfficeCodeListXML"/>
==> <exceptOldNewOfficeCode>PT BX FR</exceptOldNewOfficeCode>
<xsl:variable name="intersectOldNewOfficeCode"
select="$newOfficeCodeListXML intersect $oldOfficeCodeListXML"/>
==> <intersectOldNewOfficeCode/>
<xsl:variable name="DSexceptOldNewOfficeCode"
select="distinct-values($newOfficeCodeListXML[not(. =
$oldOfficeCodeListXML)])"/>
==> <DSexceptOldNewOfficeCode>PT</DSexceptOldNewOfficeCode>
<xsl:variable name="DSintersectOldNewOfficeCode"
select="distinct-values($newOfficeCodeListXML[. =
$oldOfficeCodeListXML])"/>
==> <DSintersectOldNewOfficeCode>BX FR</DSintersectOldNewOfficeCode>
It would seem that the variables that use the distinct method are
correct and the variables using except and intersect are incorrect.
So what am I doing wrong?
Regards
--
Alex
-----
Currently:
Freelance Software Engineer 6+ yrs exp
Previously:
https://sites.google.com/a/utg.edu.gm/alex/
A Bafila, is two rivers flowing together as one:
http://www.facebook.com/pages/Bafila/125611807494851
--
Alex
-----
Currently:
Freelance Software Engineer 6+ yrs exp
Previously:
https://sites.google.com/a/utg.edu.gm/alex/
A Bafila, is two rivers flowing together as one:
http://www.facebook.com/pages/Bafila/125611807494851
--~------------------------------------------------------------------
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>
--~--
--~------------------------------------------------------------------
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>
--~--