Re: [xsl] preceding axis and context switching (was re: configuring conditionals)

Subject: Re: [xsl] preceding axis and context switching (was re: configuring conditionals)
From: Bruce D'Arcus <bdarcus@xxxxxxxxx>
Date: Sat, 28 May 2005 18:18:11 -0400
I finally had a chance to get back to this.

On 5/25/05, Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> wrote:

> So if your calling a new template switches the context back to the
> $cite-ref, pass the db:citation context as a parameter as you do so. Then
> in the cite-ref context, assuming the db:citation is bound to $citation,
> your test would look like
>
> count($citation/../db:citation) = 1 and
> $citation/@linkend = $citation/preceding::db:citation[1]/@linkend
>
> (See those location paths start from a node bound to a parameter, instead
> of implicitly from the current node, which has switched.)

Yes. Unfortunately, the "ibid" handling is now being applied to both
the first and the following duplicate citation (it should only be for
the latter).  I can't figure out why that should be the case.

Here's my function:

  <xsl:function name="bib:ibid" as="xs:boolean">
    <xsl:param name="citation" as="node()"/>
    <xsl:value-of select="count($citation/db:biblioref)=1 and
$citation/db:biblioref/@linkend =
$citation/preceding::db:citation/db:biblioref/@linkend"/>
  </xsl:function>

Invoked like so from within a template called from a db:ctiation template:

            <xsl:when test="bib:ibid(.)">
              <bib:a class="citation" href="#{db:biblioref/@linkend}">
                <xsl:text>ibid.</xsl:text>
              </bib:a>
            </xsl:when>

With this input doc:

<article xmlns="http://docbook.org/ns/docbook";>
  <info>
    <title>CiteProc Test</title>
  </info>
  <section>
    <info>
      <title>Introduction</title>
    </info>
    <para>A citation with page number detail: <citation>
        <biblioref linkend="Veer1996a" units="page" begin="23" end="24"/>
        <biblioref linkend="TimesP2001a"/>
      </citation>.</para>
    <section>
      <info>
        <title>More</title>
      </info>
      <para>Some text:
        <blockquote>
          <para>Quote.</para>
          <para>More.</para>
        </blockquote>
        Some more text.</para>
      <para>Some more citations: <citation>
          <biblioref linkend="Tilly2002a"/>
        </citation>. And now, a citation <footnote>
          <para>... in a footnote <citation>
              <biblioref linkend="Tilly2002a" begin="234"/>
            </citation>
          </para>
        </footnote>.</para>
      <para><citation><biblioref linkend="NW2000-0207"/><biblioref
linkend="NW2000-0424a"/></citation></para>
      <para><citation><biblioref linkend="Tremblay2001a"/><biblioref
linkend="Thrift1990a"/></citation></para>
    </section>
  </section>
  <bibliography/>
</article>

The "Tilly2002a" references both become "ibid."  Why??

Bruce

Current Thread