Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: [xsl] What does the phrase "duplicates removed" mean precisely?

From: "Mark Wilson" <drmark@--------------->
To:
Date: 2/1/2006 12:04:00 PM
David,

Thank you again for a very clear explaination. The last paragraph in your 
answer was the information I was seeking, and the difference between 1.0 and 
2.0 was most helpful.

Mark



----- Original Message ----- 
From: "David Carlisle" <davidc@xxxxxxxxx>

To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>

Sent: Tuesday, January 31, 2006 7:54 PM

Subject: Re: [xsl] What does the phrase "duplicates removed" mean precisely?










Note that the terminology (and the facts) changes between XSLT1 and
XSLT2 and your message refered to Michael Kay's 2.0 book, and Dave P's
1.0 FAQ. So I'll give two answers, but it would probably simplify things
for you if you fixed on one or other version initially.

a "node" is the generic term for all kinds of structured value in xpath,
element nodes, attribute nodes, comment nodes etc.

In XSLT1 the basic data type is a "node set" and sets by definition
never have duplicates, so if you look at sets of integers, the set
{1,3,1,1} is the same as the set {1,3} and has two members.
Similarly in Xpath node sets if you (say) select the union of all the
attributes, and one specific attribute
select="@*|@this" then this is the same as just selecting all attributes
select="@*" yiu don't get the attribute this="that" twice, just as the
set {1,3,1,1} only has  member equal to 1.

In Xpath2 th ebasic data type is no longer a set but a sequence (that is
an ordered lists) and if we again look at lists of integers  the
sequences
(1,3) and (1,3,1,1) are different, one has length 2, and one has length
4,with 1 appearing threee times.

given <foo this="that" a="b" c="d"/>



so @*|@this again only contains the this="that" attribute once, although
in xpath2 (unlike xpath1) you have the possibilty of having a sequence
where it appears twice, for example select="@*,@this"

Are there any other kind  of "duplicates" removed?

Note that it is duplicates by _identity_ not by value.
Given
<x>
<y>a</y>
<y>a</y>
</x>

if the current node is x then select="y" will select both y element
nodes, th efact that they have the same content doesn't make them
duplicates. However of you select the same element twice for example
select="y[last()]|y[2]" selects the second one twice in this case
then this dupication is rempved and the result is a node set (in xpath1)
or sequence (in xpath2) with just one y element.

David




________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent