You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by BRAHMA <br...@emis-intl.com> on 2002/01/28 16:57:12 UTC
How can I dynamically pass data to be formatted??
Hi All,
Again a question...!!
---------------------------------------------------
<?xml version="1.0"?>
<root>
<money>
<net_amount>50000</net_amount>
<vatrate>16%</vatrate>
<vat>8000</vat>
<total_amount>58000</total_amount>
<currency_symbol>DM</currency_symbol>
<ratio>100</ratio>
</money>
</root>
------------------------------------------------------
So I want to format the money value..I can use the format function....
But how can I dynamically select money value from xml file and pass to the format function
of xsl?
------------------------------------------------
<xsl:decimal-format name="eurofrmt"
decimal-separator="," grouping-separator="."/>
<xsl:template match="/">
<xsl:value-of
select="format-number($net_amount, '#.###,00', 'eurofrmt')"/>
</xsl:template>
or
<xsl:template match="/">
<xsl:value-of
select="format-number($total_amount, '#.###,00', 'eurofrmt')"/>
</xsl:template>
--------------------------------------------------------
Any suggestion is a great help for me........ :).
best regards
brahma
---------------------------------------------
Brahmaiah Kurabalakota
Software Developer
eMIS eMerging Information Systems GmbH
Am Friedrichsbrunnen
D-24782 B�delsdorf
Tel.: +49 (4331) 447 1520
Mobile: +49 (172) 5372297
mailto: brahmaiah.kurabalakota@emis-intl.com
www.emis-intl.com
Re: How can I dynamically pass data to be formatted??
Posted by Thierry Gounelle <th...@cgey.com>.
BRAHMA wrote:
> Hi All,
>
> Again a question...!!
> ---------------------------------------------------
> <?xml version="1.0"?>
> <root>
> <money>
> <net_amount>50000</net_amount>
> <vatrate>16%</vatrate>
> <vat>8000</vat>
> <total_amount>58000</total_amount>
> <currency_symbol>DM</currency_symbol>
> <ratio>100</ratio>
> </money>
> </root>
> ------------------------------------------------------
> So I want to format the money value..I can use the format function....
>
> But how can I dynamically select money value from xml file and pass to
> the format function of xsl?
> ------------------------------------------------
> <xsl:decimal-format name="eurofrmt"
> decimal-separator="," grouping-separator="."/>
>
> <xsl:template match="/">
> <xsl:value-of
> select="format-number($net_amount, '#.###,00', 'eurofrmt')"/>
> </xsl:template>
>
You should try
<xsl:template match="/">
<xsl:value-of select="format-number(root/money/net_amount, '#.###,00',
'eurofrmt')"/>
</xsl:template>
This is basic xsl/xpath stuff.
thierry
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org
Re: How can I dynamically pass data to be formatted??
Posted by Thierry Gounelle <th...@cgey.com>.
Hi Brahma,
When you dynamicaly, do you mean that depending on an external parameter
you want, using the same xsl-fo file, write down either the total_amount
or the net_amount?
If so, you can for instance define a XML parameter file you read into
your xsl-fo file with the "document(...)" fonction, and test what you
want to print...
Or you can pass parameters to your xsl-fo template, but I am not sure if
it's possible to do it programatically to-day.
Thierry
BRAHMA wrote:
> Hi All,
>
> Again a question...!!
> ---------------------------------------------------
> <?xml version="1.0"?>
> <root>
> <money>
> <net_amount>50000</net_amount>
> <vatrate>16%</vatrate>
> <vat>8000</vat>
> <total_amount>58000</total_amount>
> <currency_symbol>DM</currency_symbol>
> <ratio>100</ratio>
> </money>
> </root>
> ------------------------------------------------------
> So I want to format the money value..I can use the format function....
>
> But how can I dynamically select money value from xml file and pass to
> the format function of xsl?
> ------------------------------------------------
> <xsl:decimal-format name="eurofrmt"
> decimal-separator="," grouping-separator="."/>
>
> <xsl:template match="/">
> <xsl:value-of
> select="format-number($net_amount, '#.###,00', 'eurofrmt')"/>
> </xsl:template>
>
> or
>
> <xsl:template match="/">
> <xsl:value-of
> select="format-number($total_amount, '#.###,00', 'eurofrmt')"/>
> </xsl:template>
> --------------------------------------------------------
>
> Any suggestion is a great help for me........ :).
>
>
> best regards
> brahma
>
> ---------------------------------------------
> Brahmaiah Kurabalakota
> Software Developer
> eMIS eMerging Information Systems GmbH
> Am Friedrichsbrunnen
> D-24782 B�delsdorf
> Tel.: +49 (4331) 447 1520
> Mobile: +49 (172) 5372297
> mailto: brahmaiah.kurabalakota@emis-intl.com
> www.emis-intl.com
>
>
> ----------------------------------------------------------------
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
> For additional commands, email: fop-dev-help@xml.apache.org
>