[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: container list display problem

Subject: RE: container list display problem
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Thu, 02 May 2002 15:46:38 -0400
container houses
Loren,

I hate to catch Mike out (hee :-), but when he writes:

I haven't tried to understand your detailed logic but the
parent::c02[last()] test looks wrong. A node has exactly one parent so the
predicate [last()] is always true.

He's forgetting that when a predicate expression is reduced to a simple number (as [last()] would be), it's inferred to be shorthand for [position()=last()], so the problem isn't there. [XPath 2.4]


The basic problem of your tests using preceding-sibling:: might be alleviated by shifting to the preceding:: axis. While I know EAD, like Mike I can't see deeply into your problem without seeing an example of source code. (As you know there are many ways to do EAD.)

You can test whether the parent of the <did> that houses the <container> has the same number by going up *two* levels -- "../../@n = @n".

But it sounds like since the tracking of the microfilm reels has no relation to the XML structure of the source, the preceding:: axis may be a winner. If you want to check ancestors as well as preceding elements (you may), check both preceding:: and ancestor:: axes.

Also, problems like yours are often made considerably easier with a two-pass solution. This is especially the case if there's any sorting involved (but it sounds like your stuff is already sorted). Even if this isn't so for you, checking preceding:: can get expensive of processing cycles (the axis goes all the way back to the start of the document), and this can be alleviated by running two passes.

For more explicit help, please post a sample of your source (trimmed for clarity) with the applicable bit of stylesheet.

Regards,
Wendell

At 05:42 PM 5/1/2002, you wrote:
Michael,
I am sure I'm doing this wrong as I am a newbie at coding XSL. I am trying to find if the parent of the container ¯ the parent of the <did> that houses the <container> tag ¯ also has the same container number. So if the subseries ends and another series starts, but they are both microfilmed on the same reel, then the reel number is not repeated.
How do I test that in XSL? I tried your suggestion, but unfortunately it doesn't solve the problem.
Thanks very much for responding so quickly. I am really amazed at the generosity of people on this list to help even newbies like me.
Loren


¯------------------------------------------------------------
Date: Wed, 1 May 2002 15:01:55 +0100
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Subject: RE:  container list display problem

> I have been using a style sheet that supports an XML DTD
> called EAD - Encoded Archival Description. ....
>
> <xsl:when test="(../preceding-sibling::c03[1]//did/container
> @type='reel']=$reelnumber
> or  parent::c02[last()]/did/container[@type='reel']=$reelnumber)">
>
I haven't tried to understand your detailed logic but the
parent::c02[last()] test looks wrong. A node has exactly one parent so the
predicate [last()] is always true. You obviously don't want to select the
"last parent" because there is only one. Perhaps you want to test whether
the parent is the last child of its own parent? In that case the condition
would be parent[not(following-sibling::*)].


======================================================================
Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.