Subject: [xsl] grouping and context (?) From: Bruce D'Arcus <bdarcus@xxxxxxxxxxxxx> Date: Fri, 27 Aug 2004 10:45:54 -0400 |
<xsl:key name="citekey" match="db:biblioref" use="@linkend" /> <!-- author-year class processing --> <xsl:template match="db:citation[$citation-class='author-year']"> <xsl:variable name="idref" select="db:biblioref/@linkend"/> <!-- use a key to access mods records based on lindend value --> <xsl:variable name="bibref" select="key('bibref', $idref)" /> <xsl:value-of select="$citation-before"/> <!-- group and sort by authors-string --> <xsl:for-each-group select="$bibref" group-by="bib:grouping-key(.)"> <xsl:sort select="current-grouping-key()"/> <!-- within an authors group, sort by year --> <xsl:for-each-group select="current-group()" group-by="mods:year"> <xsl:sort select="current-grouping-key()"/> <xsl:for-each select="current-group()"> <!-- since we're now working with the mods source, the only way I can see to get back to the biblioref code is to use a key again; unfortunately doesn't work correctly ** --> <xsl:variable name="citekey" select="key('citekey', @ID)" /> <a href="#{@ID}"> <xsl:if test="position() = 1"> <xsl:choose> <xsl:when test="mods:name"> <xsl:apply-templates select="mods:name" mode="citation"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="mods:noname-substitute"/> </xsl:otherwise> </xsl:choose> <xsl:text>, </xsl:text> <xsl:value-of select="mods:year"/> </xsl:if> <!-- apply suffix if applicable --> <xsl:apply-templates select="mods:key"/> <!-- render point citation details if present --> <xsl:if test="$citekey/@begin"> <xsl:value-of select="$point-cite-before"/> <xsl:value-of select="@begin" /> <xsl:text>-</xsl:text> <xsl:choose> <xsl:when test="string-length(@begin) = 1"> <xsl:value-of select="@end" /> </xsl:when> <xsl:when test="string-length(@begin) = 2"> <xsl:value-of select="substring(@end, 2, 1)" /> </xsl:when> <xsl:otherwise> <xsl:value-of select="substring(@end, last() - 1)" /> </xsl:otherwise> </xsl:choose> <xsl:if test="position() != last()">, </xsl:if> </a> </xsl:for-each> </xsl:for-each-group> <xsl:if test="position() != last()">; </xsl:if> </xsl:for-each-group> <xsl:value-of select="$citation-after"/> </xsl:template>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] RE: Does Java Script Supp, cknell | Thread | Re: [xsl] grouping and context (?), David Carlisle |
RE: [xsl] RE: Does Java Script Supp, cknell | Date | Re: [xsl] grouping and context (?), David Carlisle |
Month |