Stephen is correct in that
../preceding-sibling::*//DID[CONTAINER[@type='box']=$box-number] does meet
both tests. Chalk it up to my early learning curve.
actually I believe that
../preceding-sibling::*//did
and
../preceding-sibling::c02//did
return the same node set. For a c02, the only preceding sibling that would
have a did child or descendant would be another c02. I wonder if the later
is marginally faster, being more specific.
More importantly, there is a simpler syntax for the whole test, not just
this part of it, that will be used in the next version of the Cookbook.
Unfortunately I do not have it before me at the moment but will post it
tomorrow.
Michael
-----Original Message-----
From: Stephen Yearl [mailto:[log in to unmask]]
Sent: Monday, July 22, 2002 8:16 AM
To: [log in to unmask]
Subject: Re: XPath deconstruction
Rick:
Looks to me like //did/[etc] is going to match those dids who are children
of c02-nested c03s, c04s et seq. I'm not sure, however, why the axis
"preceding-sibling::c02" is there (but, not being familiar with the cookbook
stylesheets, I don't know what node the template from which this snippet is
from is matching). At first blush, and without testing, might not
../preceding-sibling::*//DID[CONTAINER[@type='box']=$box-number]) fulfill
both conditions?
St.
Stephen Yearl
Systems Archivist
Yale University Library::Manuscripts and Archives
At 06:03 PM 7/21/2002 -0500, you wrote:
>Deconstructing EAD style sheets,
>Looking at the cookbooks style sheets, I am trying to understand some
>of the XPaths.
>For example:
>When deciding to display a box number or not, we want to know if it has
>changed from
>the preceding sibling, so we use logic like this:
>
><xsl:choose>
><xsl:when
>test="not(../preceding-sibling::C02/DID[CONTAINER[@type='box']=$box-number]
>or ../preceding-sibling::C02//DID[CONTAINER[@type='box']=$box-number])">
><xsl:call-template name="showbox-C02-box" />
></xsl:when>
><xsl:otherwise>
><xsl:call-template name="hidebox-C02-box" />
>
>"If not (the preceeding c02 node has a did child, which has a container
>child whose type is box and value = box number)
>then show the box number,
>otherwise hide the box"
>But the second condition, where we have the "//" (any descendant), I
>don't quite get,
>"If the preceeding C02 has any did child at any level with a matching
>container type box value" --
>Is it possible for this expression to be true for some "did" 's, but
>they don't immediately
>preceed this one, so we should show the box number anyway?
>I "express" my thanks in advance,
>Rick
>
>---
>Rick Silterra
>Implementation Technical Consultant
>Endeavor Information Systems, Inc.
>2200 E. Devon Ave. Suite 382
>Des Plaines, IL, USA 60018-4505
>Voice: (847) 296-2200 x2625
>Fax: (847) 296-5636
>Toll Free: (800) 762-6300 x2625
>Email: [log in to unmask]
>
>Any opinions expressed in this message are those only
>of the sender and not of Endeavor Information Systems, Inc.
|