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

Re: configuring a conditional

Subject: Re: configuring a conditional
From: Bruce D'Arcus <bdarcus@xxxxxxxxx>
Date: Mon, 23 May 2005 21:54:06 -0400
Re:  configuring a conditional
On May 23, 2005, at 10:38 AM, David Carlisle wrote:

Aside: I've still not worked out HOW to deal with this first/subsequent
business generally.


It's easy enough (although possibly expensive) to know if you are the
first citation to a particular reference, eg you could use xsl:number
and see if you get the number 1, or perhaps better havs an xsl:key that
matches all references, keyed on the reference id then you just have to
ask if the current node is the first node in document order in the
sequence returned by the key for this reference.
so for example if the syntax is

<xref linkend="foo"/>

and you want to know if this is the first such reference

<xsl:key name="xr" match="xref use="@linkend"/>
..
<xsl:template match="xref">

<xsl:if test=". is key('xr',@linkend)[1]">
 I'm first

OK, I tried to implement this in my rather complicated code, but am stuck.


    <xsl:param name="cite-ref" as="element()*"/>
    <xsl:message>
      <xsl:if test="$cite-ref is key('refs',@linkend)[1]">FIRST</xsl:if>
    </xsl:message>

The message is result is always blank.

Since I don't have really any template for db:citation/db:biblioref, I instead pass the cite-ref parameter from the db:citation template where its value is this variable:

<!-- earlier the cite-ref variable was defined as just element(), but
for some reason this yielded an empty-sequence error in one case -->
<xsl:variable name="cite-ref" as="element()*">
<xsl:sequence select="$citation/db:biblioref[@linkend=$id]"/>
</xsl:variable>


Bruce

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.