Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

xsl for-each select with filter for field with currency

Status
Not open for further replies.

harpconn

Technical User
Jul 15, 2002
15
0
0
US
I have xml with a field "UsedPrice" which has values like $5.25 and $9.89. I need to select with a filter that returns only items with prices higher than a threshhold, say $3.00. I will want to combine (and) the price filter with other filters, such as "Media="Paperback", etc.

Here's what I've tried.

<xsl:for-next select=&quot;ProductInfo/Details[number(substring-after(UsedPrice,'$'))>3.00]&quot;>

and

<xsl:for-next select=&quot;ProductInfo/Details[number(substring-after(UsedPrice,'$'))>3.00 and Media=&quot;Paperback&quot;]&quot;>

I get the following unhelpful error:
&quot;We encountered an error processing your request. Please retry.&quot;

Anybody got suggestions or see what I did wrong?

Thanks.
 
Can you change the format of the XML?

If you can, add an attribute named &quot;value&quot; to your element that contains the dollar amount with no formatting in it (no currency symbols or thousands-separators -- only a decimal point).

Chip H.

 
No, I can't change the XML. It is a feed from Amazon.com.
 
<xsl:for-next select=&quot;ProductInfo/Details[number(substring-after(UsedPrice,'$')) &gt; 3.00 and Media=&quot;Paperback&quot;]&quot;>

don't use < > inside <xsl:.... > try it with &gt; or &lt;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top