xsl-list
[Top] [All Lists]

Re: use-when attribute?

2004-12-18 05:43:36

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


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>