NealWalters
NealWalters

Reputation: 18207

XSLT: How to do math on an xpath result in a value-of select statement

I'm trying to simply divided a number by 100. Can I do this without going thorugh a variable? Have to use XSLT 1.0 to work with BizTalk.

<ns0:InvoiceTotal>
    <xsl:value-of select="number(Header/BeginningSegmentForCarriersInvoice/@NetAmountDue) / 100" />
</ns0:InvoiceTotal>

Above returns errors:

Unexpected token '100' in the expression. ...arriersInvoice/@NetAmountDue) / -->100<--

Upvotes: 0

Views: 102

Answers (1)

michael.hor257k
michael.hor257k

Reputation: 117073

The operator for division in XPath/XSLT is div. Try:

<xsl:value-of select="number(Header/BeginningSegmentForCarriersInvoice/@NetAmountDue) div 100" />

Upvotes: 1

Related Questions