You try something like this in a customization
layer. It is not extensively tested. It recursively parses the text node in a
programlisting based on the line ending character 
, inserts the line
number, and recurses to the next line.
<xsl:template
match="programlisting/text()">
<xsl:call-template
name="line.numbering">
<xsl:with-param
name="content" select="."/>
<xsl:with-param
name="count" select="1"/>
</xsl:call-template>
</xsl:template>
<xsl:template
name="line.numbering">
<xsl:param name="content"
select="."/>
<xsl:param name="count"
select="1"/>
<xsl:number value="$count" format="01
"/>
<xsl:choose>
<xsl:when test="contains($content,
'
')">
<xsl:value-of
select="substring-before($content,
'
')"/>
<xsl:text>
</xsl:text>
<xsl:variable
name="rest" select="substring-after($content,
'
')"/>
<xsl:if
test="string-length($rest)">
<xsl:call-template
name="line.numbering">
<xsl:with-param name="content"
select="$rest"/>
<xsl:with-param name="count" select="$count +
1"/>
</xsl:call-template>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<!-- we are done
-->
<xsl:value-of
select="$content"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
Bob Stayton
Sagehill Enterprises
----- Original Message -----
From:
Stock,
Jan
To:
Sent: Tuesday, November 11, 2008 6:01
AM
Subject: [docbook-apps] line numbering
with xsltproc
Hello,
I am trying to insert line
numbering in my PDFs. I read that only
Saxon and Xalan provide that
function. Does anyone know how to implement line numbering in DocBook XML
files which are parsed with xsltproc?
I would be pleased to receive any
help concerning that problem. My extensive online search resulted in no
solution.
Regards,
Jan
*******************************************
Harman Becker Automotive Systems GmbH
Management Board: Dr. Klaus Blickle (Chairman), Dr. Udo
Hüls, Michael Mauser, Regis Baudot
Chairman of the Supervisory Board: Ansgar Rempp | Domicile:
Karlsbad |
Local Court Mannheim: Register No. 361395
*******************************************
Diese E-Mail
enthaelt vertrauliche und/oder rechtlich geschuetzte Informationen. Wenn Sie
nicht der richtige Adressat sind oder diese E-Mail irrtuemlich erhalten haben,
informieren Sie bitte sofort den Absender und loeschen Sie diese Mail. Das
unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht
gestattet.
This e-mail may contain confidential and/or privileged
information. If you are not the intended recipient (or have received this
e-mail in error) please notify the sender immediately and delete this e-mail.
Any unauthorized copying, disclosure or distribution of the contents in this
e-mail is strictly forbidden.
*******************************************