RE: [xsl] Number of elements with a given attribute

Subject: RE: [xsl] Number of elements with a given attribute
From: Syd Bauman <Syd_Bauman@xxxxxxxxx>
Date: Mon, 21 Dec 2009 10:08:31 -0500
This thread has encouraged me to dust off some previous work, tidy it
up a bit, and post it with the hopes that someone with XSLT expertise
will take a look and explain what I could have done better, and why
it would be better.

The stylesheets at
  http://wiki.tei-c.org/index.php/PartLines1.xslt
and
  http://wiki.tei-c.org/index.php/PartLines2.xslt
are proof-of-concept stylesheets that do the same thing in XSLT 1 and
XSLT 2, respectively. Each one reads in a standard TEI P5 file and
generates an XHTML table of the metrical lines within. Each metrical
line has its line number with respect to its parent line group
associated with it, and partial lines are taken into account.

In TEI P5 a metrical line is encoded using an <l> element, line
groups (e.g., stanzas or verses) are encoded using an <lg> element,
and partial lines are indicated in a variety of ways. The method
these stylesheets look for is a part= attribute whose value may be
one of 
* I (for "initial"),
* M (for "medial"), or
* F (for "final").
(NB that the TEI part= attribute may also be 'Y' or 'N', but my
stylesheets ignore these values.) These are, I believe, analogous 
to the OP Faehndrich Philippe's <verse> elements with part= of
"beginning", "continuation", and "end".

For example, if the input TEI document contains

      <lg type="verse">
        <l>Asked a girl what she wanted to be</l>
        <l part="I">She said</l>
        <l part="F"><said>baby, can't you see</said></l>
        <l><said>I wanna be famous, a star on the screen</said></l>
        <l><said>But you can do something in between</said></l>
      </lg>

the corresponding output table will look something like

Current Thread