[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Line Numbering

Subject: Re: Line Numbering
From: Steve <subsume@xxxxxxxxx>
Date: Fri, 4 Aug 2006 14:42:58 -0400
Re:  Line Numbering
Hmm... you could use substring() and a recursive template.

That's what I'd do.

I'd start it off by something like

<xsl:call-template name="para">
  <xsl:with-param name="lineNumber" select="1" />
  <xs:with-param name="para" select="$para" />
</xsl:call-template>

<xsl:template name="para">
<xsl:param name="lineNumber">1</lineNumber>
</xsl:param name="para" />
<output line='{$lineNumber}' text="substring($para,0,29)" />
<xsl:if test="test if length of $para is greater than 29" >
  <xsl:call-template name="para">

  <xsl:with-param name="lineNumber" select="$lineNumber + 1"/>
  <xsl:with-param name="para" select="substring($para,30)" />
</xsl:call-template>
</xsl:if>
</xsl:template>

...approximately.

-S

On 8/4/06, Luke Jones <ljones@xxxxxxxxxxxxxxxxxx> wrote:
Hi,

I'm trying to number the lines of multiple paragraphs.

For example:
xml--
<bill>
...
<para>
FOR AN ACT relating to crimes and offenses; to amend sections 28-101,
28-201 and 28-932, Revised Statutes Cumulative Supplement, 2004; to
change provision relating to assault by a confined person; to create the
offense of assault...(etc)
</para>

I would need xsl code that makes the output look like so...

1       FOR AN ACT relating to crimes and offenses; to amend sections
2       28-101, 28-201 and 28-932, Revised Statutes Cumulative
3       Supplement, 2004; to change provision relating to assault by a
4       confined person; to creat the offense of assault...(etc)

Can anyone help me with this?  I just getting my feet wet with xsl, any
help would be much appreciated.

Thanks,
Luke

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.