You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Alvaro Moraleda <am...@srg.aut.uah.es> on 2009/07/30 16:59:01 UTC
variable start-indent property
Hi everybody!
I'm using XSLT and FOP to convert XML to PDF. I need to indent a text
block depending on the number of initial tabs. Example:
--- XML ---
<tab><tab>hello world!!
--- XSLT ---
<fo:block start-indent="$initialTabs * 20mm">
...
</fo:block>
Where initialTabs is the number of the tabs at the beginning of each
text block (2 tabs in this case).
How can I do that?
Thanks
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
RE: variable start-indent property
Posted by "Amick, Eric" <Er...@mail.house.gov>.
Since count() is an XPath function, you could also do
<block start-indent="{count(tab) * 20}mm">
<xsl:value-of select="." />
</block>
or even (more readably)
<block start-indent="{count(tab)} * 20mm">
<xsl:value-of select="." />
</block>Eric Amick
Legislative Computer Systems
Office of the Clerk
-----Original Message-----
From: Andreas Delmelle [mailto:andreas.delmelle@telenet.be]
Sent: Friday, July 31, 2009 4:55
To: fop-users@xmlgraphics.apache.org
Subject: Re: variable start-indent property
On 30 Jul 2009, at 16:59, Alvaro Moraleda wrote:
Hi
> I'm using XSLT and FOP to convert XML to PDF. I need to indent a text
> block depending on the number of initial tabs. Example:
>
> --- XML ---
> <tab><tab>hello world!!
>
>
> --- XSLT ---
> <fo:block start-indent="$initialTabs * 20mm"> ...
> </fo:block>
It depends a bit on the exact format of the input. If you have:
<text><tab/><tab/>hello world!</text>
Then all you would need to achieve the desired result is something like:
<xsl:template match="text">
<block>
<xsl:attribute name="start-indent">
<xsl:value-of select="count(tab) * 20" /><xsl:text>mm</xsl:text>
</xsl:attribute>
<xsl:value-of select="." />
</block>
</xsl:template>
HTH!
Regards
Andreas
Andreas Delmelle
e-mail: andreas.delmelle.AT.telenet.be
Skype: adlm0608
Jabber: mandreas@jabber.org
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
Re: variable start-indent property
Posted by Andreas Delmelle <an...@telenet.be>.
On 30 Jul 2009, at 16:59, Alvaro Moraleda wrote:
Hi
> I'm using XSLT and FOP to convert XML to PDF. I need to indent a text
> block depending on the number of initial tabs. Example:
>
> --- XML ---
> <tab><tab>hello world!!
>
>
> --- XSLT ---
> <fo:block start-indent="$initialTabs * 20mm">
> ...
> </fo:block>
It depends a bit on the exact format of the input. If you have:
<text><tab/><tab/>hello world!</text>
Then all you would need to achieve the desired result is something like:
<xsl:template match="text">
<block>
<xsl:attribute name="start-indent">
<xsl:value-of select="count(tab) * 20" /><xsl:text>mm</xsl:text>
</xsl:attribute>
<xsl:value-of select="." />
</block>
</xsl:template>
HTH!
Regards
Andreas
Andreas Delmelle
e-mail: andreas.delmelle.AT.telenet.be
Skype: adlm0608
Jabber: mandreas@jabber.org
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org