Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   XML (http://www.velocityreviews.com/forums/f32-xml.html)
-   -   How to insert variable number of linebreaks for pdf output? (http://www.velocityreviews.com/forums/t303773-how-to-insert-variable-number-of-linebreaks-for-pdf-output.html)

michga 06-14-2006 03:04 AM

How to insert variable number of linebreaks for pdf output?
 
Hello,

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
linebreak:

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

and this in the xml file where I need it:

<?linebreak?>

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">
<xsl:param name="currentnumber"/>
<xsl:param name="linenumber"/>
<xsl:if test="$currentnumber &lt;= $linenumber">
<fo:block>
 
</fo:block>
<xsl:call-template name="linebreakn">
<xsl:with-param name="currentnumber" select="$currentnumber + 1"/>
<xsl:with-param name="linenumber" select="$linenumber"/>
</xsl:call-template>
</xsl:if>
</xsl:template>

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

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



All times are GMT. The time now is 03:16 PM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57