[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Line Numbering


Subject: Re: [xsl] Line Numbering
From: Steve <subsume@xxxxxxxxx>
Date: Fri, 4 Aug 2006 15:28:15 -0400

Nope, meant output. It could have been <hello  or <steve. Its just a
quick way to be able to go "{$var}" (a neat shortcut for xsl:value-of
you can only do within a tag).

Ideally, you'd replace the <output> with whatever format you're using
to print this stuff out...(between P tags?, then <p><xsl:variable
name="$para" /></p>).

-Steve

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

Thanks for responding so quickly.  I'm trying to use your idea with a
recursive call but I'm confused on a couple of things.  Firstly, on the
line "<output line='{$lineNumber}' text="substring($para,0,29)" />"  I
assume you meant <xsl:output>.  However, I don't think that <xsl:output>
can go in that particular spot.  It has to be a child to <stylesheet> or
<transform>.  That being said, its entirely possible that its my setup
that is causing this problem.  Would you object if I pasted my xsl in an
e-mail, and then you show me how to implement this into my existing code
if you have the time?

On Fri, 2006-08-04 at 14:42 -0400, Steve wrote:
> 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
Keywords
xsl