[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] incrementing dates with variables?


Subject: [xsl] incrementing dates with variables?
From: "Mac Rost" <mrost@xxxxxxxxxxxxx>
Date: Tue, 17 Dec 2002 09:13:43 -0600

List:
I have a problem that is just outright bugging me. What I need to do is take the arrivalDate which is a param at top-level and then depending on how many nightlyRates are under NightlyRates element in the XML, increment depending on how many nights there are.
xml snippiet:
<HotelAvailabilityListResults size="20">
	<Hotel>
		<hotelID>129475</hotelID>
		<marketingLevel>2</marketingLevel>
		<confidence>79</confidence>
		<name>WARWICK</name>
		<address1>1776 GRANT STREET</address1>
		<address2/>
		<address3></address3>
		<city>DENVER</city>
		<stateProvince>CO</stateProvince>
		<country>US</country>
		<postalCode>80203</postalCode>
		<airportCode>DEN</airportCode>
		<phone1>1 303 8612000</phone1>
		<phone2/>
		<fax>1 303 8320320</fax>
		<lowRate>89.0</lowRate>
		<highRate>255.0</highRate>
		<HotelProperty>
			<latitude/>
			<longitude/>
			<id>DEN WARW</id>
			<chaincode/>
			<amenityCount>0</amenityCount>
			<name>WARWICK</name>
			<description>Standard 1-2 People</description>
			<rating>4.0</rating>
			<location>DOWNTOWN</location>
			<totalRate>417.00</totalRate>
			<policy/>
			<nonRefundable>N</nonRefundable>
			<specialRate>N</specialRate>
			<NightlyRates size="3" dispCurrencyCode="USD">
				<nightlyRate>119.95</nightlyRate>
				<nightlyRate>119.95</nightlyRate>
				<nightlyRate>119.95</nightlyRate>
			</NightlyRates>
		</HotelProperty>
		<supplier id="2" chainCode="DEN"/>
		<supplier id="3" chainCode="WK"/>
		<supplier id="10" chainCode="WK"/>
	</Hotel>
....Truncated for display purposes...
</HotelAvailabilityListResults>

xsl snippiet:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
	<xsl:param name="citysearch"/>
	<xsl:param name="arrivalDate"/>
	<xsl:param name="departureDate"/>
	<xsl:param name="statesearch"/>
	<xsl:param name="resType"/>
	<xsl:param name="numberOfAdults"/>
	<xsl:output method="html"/>
	<xsl:template match="/">
<!--other html stuff here-->
																<xsl:if test="HotelAvailabilityListResults[@size &gt; 1]">
																	<table border="0" cellpadding="0" cellspacing="0" width="479">
																		<tr>
																			<td colspan="5" align="center"><b>Your results for <xsl:value-of select="$citysearch"/>, <xsl:value-of select="$statesearch"/></b></td>
																		</tr>
																		<xsl:call-template name="table"/>
																	</table>
																</xsl:if>


<!--pblm code-->
				<xsl:for-each select="HotelProperty/NightlyRates">
					<xsl:value-of select="$arrivalDate"/>
						<xsl:variable name="size" select="@size"/>
						<xsl:variable name="inc">
							<xsl:value-of select="substring($arrivalDate,4,5)"/>
						</xsl:variable>
						<xsl:variable name="begin">
							<xsl:value-of select="substring($arrivalDate,1,3)"/>
						</xsl:variable>
		</xsl:for-each>




I know that I'm pbly thinking about this the wrong way, any suggestions, good or bad are welcome.
Ideally I would like the following format:

first date  second date   third date
   price          price             price

and so on...

Thanks!
Mac Rost




 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread
Keywords