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

Re: modes and temp trees (was Re: grouping + glo

Subject: Re: modes and temp trees (was Re: grouping + global variable (?))
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Tue, 17 Aug 2004 15:26:16 +0100
Re:  modes and temp trees (was Re:  grouping + glo
Hi Bruce,

> One remaining problem is how to collapse (Doe, 1999a; Doe, 1999c) into
> (Doe, 1999a, c).  Remindr, in DocBook NG, citations now look like:
>
> <citation>
>     <biblioref linkend="one"/>
>     <biblioref linkend="two"/>
> </citation>
>
> Clearly the problem is something about the if test flagged below. I
> would have thought the position in the current group would get me
> what I want, but it doesn't. If I remove the [...] on the bibref
> variable select statement, however, I can get the collapsing to
> work, but I get all of the document citations.

The test you've got is:

  ../mods:mods[position() = 1]

This tests if the current node's parent has a <mods:mods> element
(whose position is 1 -- this will only and always be true if there's a
<mods:mods> element at all, so the test is equivalent to
"../mods:mods"). Since the current element is a <mods:mods> element,
the test is guaranteed to be true.

What you want is simply:

  <xsl:if test="position() = 1">
    ...
  </xsl:if>

This tests whether the current <mods:mods> element is the first within
the group of <mods:mods> elements that you're looking at.

By the way, you really should be using a key rather than doing:

  //mods:mods[@ID=$idref]

Declare it like:

<xsl:key name="mods" match="mods:mods" use="@ID" />

and use it like:

  <xsl:variable name="bibref" select="key('mods', $idref)" />

Keys are much faster and neater than searching through the entire
document using a predicate. If you rather use a predicate, at least
limit the search by using an explicit path down to the <mods:mods>
elements rather than searching the entire document with //mods:mods.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/

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.