I have a calculated column that is a number field. It basically adds to other number fields. When I look at the item through the website I see the format as "1,050" (with the comma).

In a DVWP using XSLT when I try to find the max value using 'ddwrt:Max(...)' it does not find the true max because it seems to be treating the values as strings where 900 is greater than 1000.

Here is a snippet of the dsQueryResponse and my XSLT.

The dsQueryResponse:

        <Row nCcTileRightEdge="125" ></Row>
        <Row nCcTileRightEdge="225" ></Row>
        <Row nCcTileRightEdge="325" ></Row>
        <Row nCcTileRightEdge="425" ></Row>
        <Row nCcTileRightEdge="525" ></Row>
        <Row nCcTileRightEdge="625" ></Row>
        <Row nCcTileRightEdge="725" ></Row>
        <Row nCcTileRightEdge="825" ></Row>
        <Row nCcTileRightEdge="925" ></Row>
        <Row nCcTileRightEdge="1,025" ></Row>

The XSLT in question:

<xsl:variable name="maxRightEdge" select="ddwrt:Max(/dsQueryResponse/Rows/Row/@nCcTileRightEdge)" />

And this is returning 925.

How can I get the true max?

1 Answer 1


You should be able to change your variable definition to convert the string to a number first:

<xsl:variable name="maxRightEdge" select="ddwrt:Max(number(/dsQueryResponse/Rows/Row/@nCcTileRightEdge))" />

Details: https://www.w3.org/TR/xpath/#function-number

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.