xsl-list
[Top] [All Lists]

Re: [xsl] Help parsing a node

2012-04-26 16:20:53


On 26/04/2012 16:51, Michele R Combs wrote:
Hi all --

Can someone translate this into plain English for me?

<xsl:variable name="uniqueTypes" 
select="ead/archdesc/dsc/descendant::*/container[not(@type=following::*/container/@type)]/@type"
 />
Roughly, it selects all the @type attributes provided there is no @type attribute later in the document with the same value.

And it does this very inefficiently (n*2 performance where n is the document size) - it can be done much more efficiently using keys.

It also doesn't do quite what I said. Assuming it's used with "/" as the context item, It's actually looking for all @type attributes whose path is /ead/archdesc/dsc//container, provided they aren't the same as a following @type attribute whose path is //container. If there are @type attributes that match the first path and not the second, that could lead to some strange effects.

It could even select duplicates. If there happens to be a structure like this:

<container type="x">
<container type="x"/>
</container>

then both type attributes will be selected, because the second is not "following" the first.

Michael Kay
Saxonica

What exactly will this select?  And (since it starts with the root node) will 
it select the exact same thing no matter where it's used?

I thought I knew but it isn't behaving at all the way I expected.

Thanks --

Michele
+++++++++++++++
Michele Combs
Lead Archivist
Special Collections Research Center
Syracuse University
315-443-2081
mrrothen(_at_)syr(_dot_)edu
scrc.syr.edu
library-blog.syr.edu/scrc



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

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