evilsoldier
evilsoldier

Reputation: 163

XSL select value of xml attribute as integer

i am trying to select some xml attributes from decimal values to integers. For example

<ItemIn quantity="1.0">

The value of @quantity must be selected as integer i.e. only 1.

I am using

<xsl:value-of select="@quantity">

Is there a way to select quantity as integer i.e. as 1 ?

Thanks.

Upvotes: 0

Views: 2779

Answers (1)

zx485
zx485

Reputation: 29042

Use the XSLT format-number() Function with a single # as format like this:

<xsl:value-of select="format-number(@quantity, '#')" />

Upvotes: 1

Related Questions