xsl-list
[Top] [All Lists]

RE: [xsl] selecting for variable based on attribute

2006-08-18 09:21:44
Both the items in your example have @hardware='0', so why would you expect
the condition [(_at_)hardware ne '0'] to select them?

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

-----Original Message-----
From: Rick Roen [mailto:Rick(_at_)LakeValleySeed(_dot_)com] 
Sent: 18 August 2006 17:10
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] 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


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>