Peter Boot | 2 Nov 2007 00:46
Picon
Picon
Favicon

Re: automatic line numbering with XSLT?

> I am using  <at> n where needed in order to manually override the line
numbering,
> so as to reflect modifications of line numbering by editors and this
template (albeit primitive) achieves that. What I have not been able to
achieve on my own, is for xsl:number not to add numbering according to
the position of each tei:l node (as currently happening)  but to
continue from the last   <at> n value (e.g. if one verse has  <at> n=149 numbering
of the next verse
> should be 150 regardless of its position in the xml tree). Is this
possible?

In a similar situation I once did something like this, not using xsl:number:

<xsl:choose>
    <xsl:when test=" <at> n">
        <xsl:value-of select=" <at> n"/>
    </xsl:when>
    <xsl:when test="preceding-sibling::l[ <at> n]">
        <xsl:variable name="posbasis">
            <xsl:value-of
select="count(preceding-sibling::l[ <at> n][1]/preceding-sibling::l)"/>
        </xsl:variable>
        <xsl:variable name="poscurrent">
            <xsl:value-of select="count(preceding-sibling::l)"/>
        </xsl:variable>
        <xsl:value-of select="preceding-sibling::l[ <at> n][1]/ <at> n + $poscurrent
- $posbasis"/>
    </xsl:when>
    <xsl:otherwise>
        <xsl:value-of select="count(preceding-sibling::l) + 1"/>
(Continue reading)


Gmane