[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: selecting for variable based on attribute

Subject: RE: selecting for variable based on attribute
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 18 Aug 2006 17:21:27 +0100
RE:  selecting for variable based on attribute
Both the items in your example have @hardware='0', so why would you expect
the condition [@hardware ne '0'] to select them?

Michael Kay
http://www.saxonica.com/
 

> -----Original Message-----
> From: Rick Roen [mailto:Rick@xxxxxxxxxxxxxxxxxx] 
> Sent: 18 August 2006 17:10
> 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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.