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

Re: use-when attribute?

Subject: Re: use-when attribute?
From: Bruce D'Arcus <bdarcus@xxxxxxxxxxxxx>
Date: Sat, 18 Dec 2004 07:43:36 -0500
xsl use when
On Dec 18, 2004, at 5:30 AM, Geert Josten wrote:

you could use the following:

<xsl:key name="citerefs" match="db:biblioref/@linkend" use="'all'" />
<xsl:key name="citerefs" match="cite:biblioref/@cite:key" use="'all'" />
<xsl:key name="citerefs" match="tei:cit/@href" use="'all'" />


And use key('citerefs', 'all') instead of $citerefs..

I was originally using keys (at your suggestion, in fact), but Mike Kay at one point seemed to suggest it better for my purposes to use a variable. I didn't quite understand why, but here's his explanation:


====
I don't really see what a key with a constant "use" expression achieves.
Apart from the fact that it applies to whichever document is current at the
time, you could just as well (and probably better) use a global variable


<xsl:variable name="citekey" select="//db:biblioref/@linkend"/>
====

The code subsequently gets used in these two variables:

<!--+ ==============================================================
| create a table against which to measure relative citation position
+-->
<xsl:variable name="cite-position">
<bib:refs>
<bib:all>
<xsl:for-each select="$citerefs">
<bib:ref position="{position()}" id="{generate-id()}" key="{.}"/>
</xsl:for-each>
</bib:all>
<bib:unique>
<xsl:for-each-group select="$citerefs" group-by=".">
<bib:ref position="{position()}" id="{generate-id()}" key="{.}"/>
</xsl:for-each-group>
</bib:unique>
</bib:refs>
</xsl:variable>
<!--+ ==============================================================
| construct a list of unique references to pass to a query
+-->
<xsl:variable name="citekeys">
<xsl:text>(</xsl:text>
<xsl:for-each-group select="$citerefs" group-by=".">
<xsl:if test="position() &gt; 1">,%20</xsl:if>
<xsl:text>'</xsl:text>
<xsl:value-of select="."/>
<xsl:text>'</xsl:text>
</xsl:for-each-group>
<xsl:text>)</xsl:text>
</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.