On Aug 10, 2004, at 4:45 AM, Jeni Tennison wrote:
I've spent a bit of time on this since it uses some interesting XSLT
Thanks Jeni!! I was hoping someone would see it as an interesting
challenge. I'll spend some time studying it.
In the meantime, a couple of quick notes:
[Note that this shouldn't be allowed by a Basic XSLT 2.0 processor
because such processors shouldn't support the xs:gYear datatype. I've
tested this with Saxon 8.0B, and it works OK there, but that might
change when Mike makes it conformant. You could use xs:integer()
rather than xs:gYear() here to make it work with conformant Basic XSLT
This is exactly the problem that prompted my other post on xs:date. I
can't use either xs:gYear or xs;date because some dates are in the form
YYYY and some are YYYY-MM, and still others YYYY-MM-DD. So, I had to
change to substring(.,1,4) to get the stylesheet to compile.
I really wish xs:date would count all of these as valid.
My other issue is how to use your stylesheets to get each reference --
instead of each group -- wrapped in proper tags.
What I really need ultimately are:
1) Output like:
<p id="doesmith2000"><span class="creator">Doe, J and S. Smith</span>
<span class="year"><(2000)</span> <span class="title">Some
TItle</title>, <span class="container">In <span class="title">Some
Book</span>, Edited by <span class="creator">J. Smith</span>, <span
(<a href="doesmith2000">Doe and Smith, 2000a</a>, <a
The details aren't important; I just need to be able to wrap each
record in a p (or li) tag, stick a period on the end of it, etc., and
to be able to do:
... and within those templates to do some minimal processing.
So how would you modify your example? Would you rework the below
template, for example, somehow into variables that get used in another
template (matching mods:mods?)??
<xsl:variable name="mods" select="mods:mods" />
<xsl:for-each-group select="$mods" group-by="mods:grouping-key(.)">
<xsl:apply-templates select="." mode="names" />
<xsl:sort select="current-grouping-key()" />
<xsl:variable name="first" as="xs:boolean" select="position() =
<xsl:if test="not($first and position() = 1)">-----. </xsl:if>
<xsl:if test="last() > 1">
<xsl:number value="position()" format="a" />