[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] Help parsing a node

Subject: RE: [xsl] Help parsing a node
From: Michele R Combs <mrrothen@xxxxxxx>
Date: Thu, 26 Apr 2012 16:38:35 +0000

Hi David --

I didn't write this line of code -- it's in a style sheet I'm attempting to
comprehend -- so I don't want to change anything until I understand what it's
doing.  But more to the point, it actually is working 99% of the time.
There's just one single case where it's counting something as unique when it
shouldn't and I have no idea why,, which is why I'm trying to understand
precisely what it is selecting and how.  The line I cited:

<xsl:variable name="uniqueTypes"
iner/@type)]/@type" />

appears at the very start of the style sheet, at which point yes, there is an
element <ead> and yes, it will find something. Hence my first question: what
precisely is this selecting and how?  I *think* that it is selecting certain
@type attributes from various <container> elements but I'm not sure which
ones, or how it knows that they're unique.

The variable $uniqueTypes is then used later at various places in the code,
for example:

<xsl:for-each select="$uniqueTypes">

Hence my second question, whether $uniqueTypes  is the same no matter where it
gets used later.

Sorry if I didn't give enough info, but I'm not looking for a code fix, just
to understand what's happening.  If in fact it's operating from the context
node, then when the variable is used in a for-each further down in the tree,
then it should (as you said) find nothing -- but that's not the case.
Alternatively, if the variable is set at the top and retains its value, then
it should yield the exact same results every time it's used in a for-each --
yet it doesn't.

Hence my head-scratching.


-----Original Message-----
From: David Carlisle [mailto:davidc@xxxxxxxxx]
Sent: Thursday, April 26, 2012 12:17 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Cc: Michele R Combs
Subject: Re: [xsl] Help parsing a node

On 26/04/2012 16:56, Michele R Combs wrote:
> Sorry -- in this particular tag set,<ead>  *is*  the root element so I was

you may know that (and call it the root element) but xpath doesn't know that
(and doesn't call the topmost element the root either) so

it selects descendants of the _current node_ and if (as sounds like it is the
case) the current node deesn't have any ead children, it will select nothing.
you want select="/ead....


google plus: https:/profiles.google.com/d.p.carlisle

The Numerical Algorithms Group Ltd is a company registered in England and
Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is powered
by MessageLabs.

Current Thread