I couldn't find a solution to this in the archives.
I'm also an XSLT newbie so go easy :)
I have the following XML snippit:
<catalogue>
<star>
<name>OGLE-TR-56</name>
<planet>
<reference cite="konacki2003" />
</planet>
</star>
<citation id="konacki2003" title="A New Transiting Extrasolar Giant
Planet" author="Konacki et al." year="2003" journal="Nature"
volume="421" pages="507" href="http://arxiv.org/abs/astro-ph/0301052"
/>
</catalogue>
Which is processed by this XSLT fragment:
<xsl:for-each select="reference">
<xsl:text disable-output-escaping="yes"><![CDATA[<a
href="#]]></xsl:text><xsl:value-of select="@cite"/><xsl:text
disable-output-escaping="yes"><![CDATA[">]]></xsl:text>
<xsl:value-of select="id(@cite)/@author" />
<xsl:if test="id(@cite)/@year != ''"><xsl:text>
</xsl:text><xsl:value-of select="id(@cite)/@year" /></xsl:if>
<xsl:text disable-output-escaping="yes"><![CDATA[</a>]]></xsl:text>
<xsl:if test="position() != last()"><xsl:text>, </xsl:text></xsl:if>
</xsl:for-each>
Producing this XHTML:
<a href="#konacki2003">Konacki et al. 2003</a>
What my problem is, is that references like the above are supposed to
be suffixed by a lower case alphabetic character ('a', 'b', etc.) after
the year if there are multiple 'citation' elements with identical
values for 'author' and 'year'. I have no idea how to go about doing
this. Can anyone suggest how to do this?
Breaking it down:
1) get the <citation> element with the id given in @cite
2) get the author and year attributes from that citation
3) search though all <citation> elements for any with matching (author
&& year) values
4) if count > 1, see which search result corresponds to the ID we want
and append the appropriate letter of the alphabet (i.e. 'c' if the
original ID was the third found in step 3)
Thanks for reading.
- Nick.