Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > How to insert variable number of linebreaks for pdf output?

Thread Tools

How to insert variable number of linebreaks for pdf output?

Posts: n/a

Using docbook 4.4, docbook-xsl 1.70.1 and fop, I've successfully used
this snippet of code in a customized-layer stylesheet to insert one

<xsl:template match="processing-instruction('linebreak')">
<fo:block> </fo:block>

and this in the xml file where I need it:


Problem is with this, that I need to put x times <?linebreak?> in the
xml file when I need x line breaks.

I would like to have a recursive template, say linebreakn, which can
add n linebreaks, n being a variable.

I've written down the following code (which does not work):

<xsl:template name="linebreakn">
<xslaram name="currentnumber"/>
<xslaram name="linenumber"/>
<xsl:if test="$currentnumber &lt;= $linenumber">
<xsl:call-template name="linebreakn">
<xsl:with-param name="currentnumber" select="$currentnumber + 1"/>
<xsl:with-param name="linenumber" select="$linenumber"/>

<xsl:template match="processing-instruction('linebreakn')">
<xslaram name="linenumber"/>
<xsl:call-template name="linebreakn">
<xsl:with-param name="linenumber" select="$linenumber"/>

And in the xml file:

<?linebreakn 5?> for example

Could someone tell me what I'm doing wrong here as I'm a complete
newbye to templates?

Thanks in advance

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
PDF::Writer, create pdf and insert in other pdf file. Ricardo Pog Ruby 1 03-26-2008 08:24 PM
linebreaks in a text area meltedown HTML 3 10-20-2005 04:43 AM
stringtokenizer that traps ASCII linebreaks Java 2 02-11-2004 10:04 PM
Replacing linebreaks with <br> Stefan Landgraf ASP .Net 2 08-19-2003 03:35 PM