xsl-list
[Top] [All Lists]

Re: [xsl] Line Numbering

2006-08-04 11:43:18
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(_at_)unicam(_dot_)state(_dot_)ne(_dot_)us> 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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>