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

selecting elements only if they all have a particular

Subject: selecting elements only if they all have a particular attribute greater than zero
From: Donal Regan <donal_regan10@xxxxxxxxxxx>
Date: Wed, 14 Apr 2004 08:56:24 +0100 (BST)
elements what are they
 Hello all,

I have the following XML 

<property name="Hotel A" id="1">
<vacancy>
<month name="4">
<date date="1" day="Thursday">
<roomType id="1" count="1" type="1R" cost="100"/>
<roomType id="10" count="1"type="2DK" cost="100"/>
<roomType id="13" count="1" type="3DK" cost="100"/>
</date>
<date date="2" day="Friday">
<roomType id="1" count="0" type="1R" cost="100"/>
<roomType id="10" count="1" type="2DK" cost="100"/>
<roomType id="11" count="1" type="2DK" cost="200"/>
<roomType id="12" count="2" type="2LDK" cost="100"/>
</date>
</month>
</vacancy>
</property>

I want to display a radio button for each unique
roomType (determined by id) that has a "count" greater
than zero for both days. I am able to list the
roomTypes without duplication using the XSLT below,
but I can't get my head around how to only deal with
the roomTypes with count>0 for both days in the first
place. Can anyone help?
Cheers,Donal

<xsl:key name="roomTypeId" match="//date/roomType"
use="@id"/>
<xsl:template match="/property">
<table>
<tr><td><xsl:value-of select="@name"/></td></tr>
</table>
<table width="300" border="0" cellspacing="0"
cellpadding="2">
	<tr>
		<td width="22">&#160;</td>
		<td>roomType</td>
		<td>cost</td>
    </tr>
	
	<xsl:apply-templates
select="//date/roomType[count(.|key('roomTypeId',@id)[1])=1
and @count &gt; 0]"/>
</table>
</xsl:template>

<xsl:template match="roomType">
<tr>

	<td>	
		<input type="radio" name="roomType"
onClick="showCalendar(this.id)">
			<xsl:attribute name="id"><xsl:value-of
select="@id"/></xsl:attribute>
		</input>
	</td>
	<td><xsl:value-of select="@type"/></td>
	<td><xsl:value-of select="@cost"/></td>
</tr>
	

</xsl:template>




	
	
		
____________________________________________________________
Yahoo! Messenger - Communicate instantly..."Ping" 
your friends today! Download Messenger Now 
http://uk.messenger.yahoo.com/download/index.html

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.