On 07/01/2013 10:20 AM, Brad Scott wrote:
Hello everyone
How do you tend to deal with "Ibid" and "op cit" references?
Some BiBTeX or biblatex styles do this themselves. I originally relied
on one of them that detected such things, but the journal style
requirements changed, and I haven't converted the process to use the new
biblatex style yet, so right now it's done in the XSLT. The following is
untested, as I have redacted a whole heap of internal stuff which would
just clutter an example.
<xsl:template match="db:biblioref[@endterm]">
<xsl:choose>
<!-- if the previous citation is to the exact same place in the
same work as the current citation -->
<xsl:when
test="@endterm=preceding::db:biblioref/@endterm and
@units=preceding::db:biblioref/@units and
@start=preceding::db:biblioref/@start and
((@end and @end=preceding::db:biblioref/@end)
or (not(@end) and not(preceding::db:biblioref/@end)))">
<xsl:text>\textit{Loc.~cit.}</xsl:text>
</xsl:when>
<!-- if the first author of the immediately preceding citation
is the same as the first author of the current citation -->
<xsl:when test="//db:biblioentry
[@xml:id=current()/preceding::db:biblioref[1]/@endterm]
[descendant::author[1]/@xml:id
=
//db:biblioentry[@xml:id=current()/@endterm]
/descendant::author[1]/@xml:id]">
<!-- code for testing multi-authored works
is left as an exercise for the reader -->
<xsl:choose>
<!-- detect gender from initial letter of authorID -->
<xsl:when test="starts-with(//db:biblioentry
[@xml:id=current()/@endterm]
/descendant::author[1]/@xml:id,'F')">
<xsl:text>\textit(Eadem}, </xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>\textit(Idem}, </xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:call-template name="makeref">
<xsl:with-param name="format" value="'omitauthor'"/>
</xsl:call-template>
</xsl:when>
<!-- if the immediately preceding citation is the same work -->
<xsl:when
test="preceding::db:biblioref[1][@endterm=current()/@endterm]">
<xsl:text>\textit{Ibid.}</xsl:text>
<xsl:call-template name="makeref">
<xsl:with-param name="format" value="'location'"/>
</xsl:call-template>
</xsl:when>
<!-- if there was any previous reference to this work -->
<xsl:when
test="preceding::db:biblioref[@endterm=current()/@endterm]">
<xsl:call-template name="makeref">
<xsl:with-param name="format" value="'author'"/>
</xsl:call-template>
<xsl:text>, \textit{op.~cit.}</xsl:text>
</xsl:when>
<!-- otherwise is gets the full treatment -->
<xsl:otherwise>
<xsl:call-template name="makeref"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
It doesn't handle multiple citations in the same biblioref element yet:
I need to redefine @endterm to be IDREFS (as it should have been!)
///Peter
---------------------------------------------------------------------
To unsubscribe, e-mail: docbook-unsubscr...@lists.oasis-open.org
For additional commands, e-mail: docbook-h...@lists.oasis-open.org