xpath for price with currency

Asked by At
<category>
    <Movi Name="Test">
        <Price>$3.95</Price>
    </Movi>
    <Movi Name="test d">
        <Price>$13.95</Price>
    </Movi>
</category>

can anyone help on this XML to find movie greater than $11 with XPath

2 Answers

2
igneus On Best Solutions

Given all prices are in the same currency and format, this bit of XPath does the job:

/category/Movi[number(substring(./Price/text(), 2)) > 11]
0
Jack Fleeting On

Just for the sake of completeness, another option is:

//Price[number(translate(text(), '$','')) > 11]