[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[xsl] selecting elements only if they all have a particular attribute greater than zero
Subject: [xsl] 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) |
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"> </td> <td>roomType</td> <td>cost</td> </tr> <xsl:apply-templates select="//date/roomType[count(.|key('roomTypeId',@id)[1])=1 and @count > 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] processing code embedded , Wendell Piez | Thread | RE: [xsl] selecting elements only i, Jarno.Elovirta |
Re: [xsl] Problem with rendering of, Julian Reschke | Date | RE: [xsl] selecting elements only i, Jarno.Elovirta |
Month |