[xsl] count elements in variable

Subject: [xsl] count elements in variable
From: Torsten Schassan <schassan@xxxxxx>
Date: Tue, 15 Oct 2013 10:09:10 +0200
Hi there,


I define a variable and traverse through a folder to collect files which
I want to process. (XSLT2)

<xsl:variable name="descriptions"
select="collection(iri-to-uri('file:///d:/mss?select=tei-msDesc.xml;recurse=yes'))"/>



Next I process single elements:

<xsl:apply-templates select="$descriptions/descendant::tei:msDesc">
  <xsl:sort select="descendant::tei:msIdentifier/tei:idno/@sortKey"/>
</xsl:apply-templates>



Within the template I want to add a running number to each element:

<xsl:template match="tei:msDesc">
 <xsl:variable name="docKey">
   <xsl:value-of select="count(preceding::tei:msDesc)"/>
 </xsl:variable>
...
</xsl:template>


But this last step simply doesn't work. Does anybody have a clue what
I'm missing here?

Best, Torsten


-- 
Torsten Schassan
Digitale Editionen
Abteilung Handschriften und Sondersammlungen
Herzog August Bibliothek, Postfach 1364, D-38299 Wolfenbuettel
Tel.: +49-5331-808-130 (Fax -165), schassan {at} hab.de

Handschriftendatenbank: http://diglib.hab.de/?db=mss

Current Thread