Subject: Re: [xsl] complex positioning problem From: Geert Josten <Geert.Josten@xxxxxxxxxxx> Date: Wed, 03 Nov 2004 08:58:48 +0100 |
Wendell noted correctly that your input document doesn't cover all situations. Even more, I think it is just not complex enough for the general problem of numbering citations.
I'm afraid it's going to have to be.
BTW, I'm using XSLT 2.0 (I should have stated that again), and my strategy has been to create a temporary tree with enhanced data that I use for subsequent processing.
Current code is here:
http://www.users.muohio.edu/darcusb/files/xbiblio.tar.gz
There are two ways to order numbered citations. One is based on occurrence within the document (e.g. the biblioref elements), and the other is to sort the bibliography as you would in an author-year style, number those, and then use them in the citation. This is an absolutely silly style that results in markers like [34, 2] and [1, 23], but it should be that hard I guess because I already the author-year style working fine.
It is probably not the most efficient code, but it works.
This is what I wondered about; particularly whether there are some new functions in XSLT 2.0 that would get me the functionality I need, as well as decent performance.
Note also that I didn't solve the ordering of the bibliorefs within one citation. That can be done, by gathering the positions in a variable again and doing the sorting magic as you like.
XSLT 2.0 grouping can handle that.
Anyway, let me see if I understand what you've done conceptually....
<xsl:key name="bibrefs" match="d:biblioref" use="'all'" /> <xsl:key name="bibrefs" match="d:biblioref" use="@linkend" /> <xsl:key name="biblio" match="d:mods" use="@ID" />
OK, use keys to index the biblioref elements. I don't really have experience with using keys, so wasn't sure if I needed them, or how to use them here. One thing to note is that the biblioref elements can be all over the document: at various levels of section depth, or in footnotes, for example.
<xsl:variable name="unique-bibrefs">
<xsl:for-each select="key('bibrefs', 'all')">
<xsl:if test="generate-id(.) = generate-id(key('bibrefs', @linkend)[1])">
What is the above doing?
<xsl:template match="/"> <bibrefs> <xsl:for-each select="key('bibrefs', 'all')"> <xsl:copy-of select="." /> </xsl:for-each>
The above three lines could have been: <xsl:copy-of select="key('bibrefs', 'all')" />
</bibrefs> <unique-bibrefs> <xsl:copy-of select="$unique-bibrefs" /> </unique-bibrefs> <xsl:apply-templates select="node()"/> </xsl:template>
And the above?
<xsl:template match="d:biblioref" mode="get-bibref-position"> <xsl:variable name="linkend" select="@linkend" /> <xsl:for-each select="msxsl:node-set($unique-bibrefs)/*"> <xsl:if test="@linkend = $linkend"> <xsl:value-of select="position()" /> </xsl:if> </xsl:for-each> </xsl:template>
I'm not quite following this either.
Greets, Geert
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] complex positioning probl, Geert Josten | Thread | Re: [xsl] complex positioning probl, Bruce D'Arcus |
Re: [xsl] complex positioning probl, Geert Josten | Date | RE: [xsl] Auto sizing of text, Pawson, David |
Month |