I have an XML document where the number of decimal places a particular xs:decimal
should be reported in is held in a sibling node. I'm currently struggling to find a simple way to output this via the format-number
function.
I can build a picture string with some other functions, but this seems terribly long-winded for what should be (at least imo) a relatively straightforward and common task.
e.g. what I'm currently doing is something like this:
<xsl:value-of
select="format-number(myNode/DecimalValue,
concat('#0.',
string-join(for $i in 1 to myNode/DecimalPlaces return '0'))"
/>
Is there a better way?