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:[email protected]]
Sent: Friday, July 31, 2009 4:55
To: [email protected]
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: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]