Subject: RE: selecting for variable based on attribute
From: "Rick Roen" <Rick@xxxxxxxxxxxxxxxxxx>
Date: Fri, 18 Aug 2006 09:20:24 -0700
|
Sorry, ignore this!
Brain fatigue - should be "@hardware eq 0"
-----Original Message-----
From: Rick Roen [mailto:Rick@xxxxxxxxxxxxxxxxxx]
Sent: Friday, August 18, 2006 9:10 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: selecting for variable based on attribute
XSLT 2.0
I have an xml like this snippet:
<items>
<item print="1" hardware="0" packetdescription="FLOWER " sku="">
<itemnum>3</itemnum>
<location>687</location>
<qty_order>5</qty_order>
<qty_ship>5</qty_ship>
<upc>051178000033</upc>
<rack>1</rack>
<tray>1</tray>
<pocket>2</pocket>
<name>ALYSSUM BASKET GOLD</name>
<eta/>
<retail>1.49</retail>
<cost>0.708</cost>
<total>3.54</total>
</item>
<item print="1" hardware="0" packetdescription="FLOWER "
sku="">
<itemnum>4</itemnum>
<location>686</location>
<qty_order>5</qty_order>
<qty_ship>5</qty_ship>
<upc>051178000040</upc>
<rack>1</rack>
<tray>1</tray>
<pocket>3</pocket>
<name>ALYSSUM CARPET OF SNOW</name>
<eta/>
<retail>0.99</retail>
<cost>0.470</cost>
<total>2.35</total>
</item>...
</items>
And an xslt snippet like this:
<xsl:variable name="rack" select="items/item[rack
castable as xs:integer and tray castable as xs:integer and pocket castable
as xs:integer and @hardware ne '0' ]"/>
This returns an empty sequence for $rack. When I leave out the "@hardware
ne '0'" then it returns what I would expect, i.e. the items/item.
How do I test for the hardware attribute <> 0?
Rick
|