new archive

OK, I managed to get fairly far with a new version. I’ve posted it
here:

http://www.users.muohio.edu/darcusb/files/citeproc.tar.gz

I’ve packaged it with an oXygen project file.

I’m happy with how I’ve handled the bibliographic stuff (in other
words, the bibliography list that gets printed at the end of a
document). It’s all handled in variables apart from the main document,
such that printing it is as simple as:

       <div id="bibliography">
         <xsl:copy-of select="$formatted-biblist"/>
       </div>

… and writing out the raw modsCollection is as easy as:

 <xsl:if test="$biboutfile">
   <xsl:result-document href="{$biboutfile}">
     <xsl:copy-of select="$raw-biblist"/>
   </xsl:result-document>
 </xsl:if>

The citations currently more-or-less work, but they don’t have the
elegance of the bibliography stuff. David, if you find time, perhaps
you can work out this part? I really don’t know how to handle it.

Also, note the example doc – test.xhtml – has a problem that I don’t
know how to fix either. It results in this:

(Thrift, 1990; Tilly, 2000aTilly, 2002b; Times, 2001)

… which should be:

(Thrift, 1990; Tilly, 2000a, b; Times, 2001)

Note punctuation is wrong, and shortening depending on position within
multi-level grouping doesn’t get switched on (as it did in my earlier
version).

Bruce

Bruce D’Arcus wrote:

Also, note the example doc – test.xhtml – has a problem that I don’t
know how to fix either. It results in this:

(Thrift, 1990; Tilly, 2000aTilly, 2002b; Times, 2001)

… which should be:

(Thrift, 1990; Tilly, 2000a, b; Times, 2001)

You are not using the same year in the citations. Shouldn’t both be 2000?

The file test.xml has:

    <biblioref linkend="Tilly2000a"/>
    <biblioref linkend="Tilly2002a"/>

So the expected output would be:

(Thrift, 1990; Tilly, 2000, 2002; Times, 2001)

Just a little thing I wanted to note. I don’t know much about XSLT yet
to help you out on this problem further, and with my Mac stolen :frowning:
it’s not going to improve much soon… I should get a replacement soon
though…

Johan Kool

So the expected output would be:

(Thrift, 1990; Tilly, 2000, 2002; Times, 2001)

Right, right! I spent too much time with it yesterday and started
seeing things.

My first problem was just the missing punctuation. The logic of how
the citation formatting works is that there are two grouping levels.

author (constructed by concatenating authors names)
	year

It’s because whether the delimiter is there or not is dependent on the
reference’s position within the citation. The delimiter is added to
all references that are not the last in the citation. So, there’s
something wrong about my code where it’s applying the position within
the author group, rather than the citation.

Just a little thing I wanted to note. I don’t know much about XSLT yet
to help you out on this problem further, and with my Mac stolen :frowning:

That sucks!

it’s not going to improve much soon… I should get a replacement soon
though…

FWIW, I recently bought oXygen, largely because of its XSLT support,
which is much more integrated than I can figure out with emacs. If you
do want to play with the code, I suggest giving oXygen a demo. It’ll
likely make learning a lot easier. Oh, and David has started a new
blog for learning XSLT:

http://understandingxslt.com/

Bruce

So the expected output would be:

(Thrift, 1990; Tilly, 2000, 2002; Times, 2001)

Well, I figured out one piece of the problem, and I now get this:

(Thrift, 1990; Tilly, 2000a, Tilly, 2002b; Times, 2001)

I’m not quite sure how to adjust the position() tests to correctly
shorten here (removing the name, but not the year), and I don’t
understand why it worked in the old version, but not here. Must be
something about the context. I may need to send this to the XSL list.

<xsl:template match=“db:citation”>

<xsl:variable name=“citation” select=“.”/>
<xsl:variable name=“idref” select=“db:biblioref/@linkend”/>
<xsl:variable name=“bibref”
select=“$enhanced-biblist/mods:modsCollection/mods:mods[@ID=$idref]”/>
<xsl:value-of select=“$style-citation/cs:prefix”/>
<xsl:for-each-group select=“$bibref” group-by=“bib:grouping-key(.)”>
<xsl:sort select=“current-grouping-key()”/>
<xsl:for-each-group select=“current-group()” group-by=“bib:year”>
<xsl:sort select=“current-grouping-key()”/>

<xsl:variable name=“position” select=“position()”/>
<xsl:for-each select=“current-group()”>

<xsl:if test=“position() = 1”>
xsl:choose
<xsl:when test=“mods:name”>
<xsl:apply-templates select=“mods:name” mode=“short”/>
</xsl:when>
xsl:otherwise
<xsl:value-of select=“bib:noname-substitute”/>
</xsl:otherwise>
</xsl:choose>
<xsl:value-of
select=“$style-citation/cs:creator/cs:suffix”/>
<xsl:value-of select=“bib:year”/>
</xsl:if>
<xsl:apply-templates select=“bib:key”/>

<xsl:if test=“$citation/db:biblioref/@begin”>
<xsl:value-of
select=“$style-citation/cs:point/cs:prefix”/>
<xsl:value-of select=“$citation/db:biblioref/@begin”/>
<xsl:if test=“$citation/db:biblioref/@end”>
xsl:text–</xsl:text>
<xsl:value-of
select=“bib:number-condense($citation/db:biblioref/@begin,
$citation/db:biblioref/@end)”/>
</xsl:if>
</xsl:if>

</xsl:for-each>
<xsl:if test=“$position != last()”>, </xsl:if>
</xsl:for-each-group>
<xsl:if test=“position() != last()”>
<xsl:value-of select=“$style-citation/@delimiter”/>
</xsl:if>
</xsl:for-each-group>
<xsl:value-of select=“$style-citation/cs:suffix”/>
</xsl:template

click on test.xml tab
go to configure transformation button
choose “citeproc.xsl” as the xsl file
add a “citation-style” parameter of "author-year"
specify an output file (because I have the parameter set to write out
the raw mods file, you must specify an output)

Bruce