Just a note that you will need to be working in xpath 2.0 (and
therefore xslt 2.0) to use the distinct-values() function.
I didn't read this thread too carefully but if you're trying to get
the unique types of all container elements in the document regardless
of where they are, you don't need to use that absolute path to the dsc
just to select all its descendant containers like that
/ead/archdesc/dsc/descendant::container
You can just do
//container
The double slash will select them no matter where they are in the tree.
Sorry if I totally misunderstood what you're doing, in that case just
note my first point about xpath 2.0 :)
Joyce
On Thu, Apr 26, 2012 at 1:57 PM, Custer, Mark <[log in to unmask]> wrote:
> One possible re-write, depending on what this is being used for (which I’m
> still unclear about):
>
> <xsl:variable name="uniqueTypes"
> select="distinct-values(/ead/archdesc/dsc/descendant::container/@type)" />
>
>
>
> Mark
>
>
>
>
>
> From: Encoded Archival Description List [mailto:[log in to unmask]] On
> Behalf Of Michele R Combs
> Sent: Thursday, April 26, 2012 12:36 PM
>
>
> To: [log in to unmask]
> Subject: Re: Help parsing a node
>
>
>
> Thanks! That helps. So let’s talk about that context thing for a second.
> The <xsl:variable...> line appears right at the top of the file, but
> $uniqueTypes is then used later at various points. For example, there are a
> couple of <xsl:for-each select=”$uniqueTypes”> where the code then does
> something however many times it takes to account for all the unique types.
>
>
>
> So first, I’m unclear as to what set of <container>s it’s looking at to
> determine uniqueness. The entire document? Just <container>s in whatever
> c0# it happens to be in when the variable is used? All the child c0#s
> within it as well?
>
>
>
> Since the variable is used in various places in the code, I’m also unclear
> as to whether the value of $uniqueTypes will be different at these different
> locations.
>
> Finally, if you were writing this statement, how would you write it?
>
>
>
> Thanks!
>
>
>
> Michele
>
>
>
> From: Encoded Archival Description List [mailto:[log in to unmask]] On
> Behalf Of Ethan Gruber
> Sent: Thursday, April 26, 2012 11:58 AM
> To: [log in to unmask]
> Subject: Re: Help parsing a node
>
>
>
> It should get the container type for every node with a container which is
> not the same @type for other containers at that context. That's probably
> not how I would construct that XPATH statement. I am not sure how
> differently descendant::*/container will function from
> descendant::container.
>
>
>
> Ethan
>
> On Thu, Apr 26, 2012 at 11:47 AM, Ethan Gruber <[log in to unmask]> wrote:
>
> What do you actually expect it to do?
>
>
> Ethan
>
>
>
> On Thu, Apr 26, 2012 at 11:43 AM, Michele R Combs <[log in to unmask]> 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"
> />
>
> 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
> [log in to unmask]
> scrc.syr.edu
> library-blog.syr.edu/scrc
>
>
>
>
--
Joyce Chapman
Triangle Research Libraries Network
CB# 3926, Wilson Special Collections Library
Chapel Hill, NC 27514-8890
Phone: (919) 962-1345
Email: [log in to unmask]
Website: www.trln.org/ccc
|