我的 xslt 仅适用于 XMl 中的第一条记录,但不适用于其他记录。我不确定如何通过 xslt 填充其他记录。我确信它与酒店订单有关 = 但我对 XMl 的东西不熟悉所以请帮忙。
请帮我
xml的代码如下:
<?xml version="1.0" encoding="ISO-8859-1"?>
<DestinationResults size="1">
<Destination name="Paris, FRA" order="1">
<HotelAvailabilityListResults size="10">
<Hotel order="1">
<hotelId>188139</hotelId>
<name>
<![CDATA[ Hotel Magenta Paris ]]>
</name>
<address1>38 Boulevard De Magenta</address1>
<address2/>
<address3/>
<city>Paris</city>
<stateProvince/>
<country>FR</country>
<postalCode>75010</postalCode>
<latitude>48.87203</latitude>
<longitude>2.35995</longitude>
<tripAdvisorRating>4.0</tripAdvisorRating>
<fromDate>10/11/2013</fromDate>
<toDate>10/12/2013</toDate>
<shortDescription>
<![CDATA[<p><b>Property Location</b> <br />With a stay at Hotel Magenta Paris in Paris (Gare du Nord - Gare de L'Est), you'll be minutes from Porte Saint-Martin and close to Louvre Museum. This]]>
</shortDescription>
<thumbNailUrl>
http://origin-images.ian.com/hotels/1000000/890000/889000/888903/888903_22_t.jpg
</thumbNailUrl>
<propertyRating>3.0</propertyRating>
<referenceProximityDistance>-1.0</referenceProximityDistance>
<referenceProximityUnit/>
<HotelProperty>
<promoDescription>Stay 1 nights and save 10% off your stay!</promoDescription>
<ValueAdds>
<valueAdd id="2048">Free Wireless Internet</valueAdd>
</ValueAdds>
<PromoRateInfo>
<displayCurrencyCode>USD</displayCurrencyCode>
<DisplayNightlyRates size="1">
<displayNightlyRate>152.02</displayNightlyRate>
</DisplayNightlyRates>
<displayRoomRate>168.68</displayRoomRate>
<chargeableRoomRateTotal>168.68</chargeableRoomRateTotal>
<chargeableRoomRateTaxesAndFees>16.66</chargeableRoomRateTaxesAndFees>
<taxesOnly>16.66</taxesOnly>
<salesTax>0</salesTax>
<hotelOccupancyTax>0</hotelOccupancyTax>
<nativeCurrencyCode>USD</nativeCurrencyCode>
<NativeNightlyRates size="1">
<nativeNightlyRate>152.02</nativeNightlyRate>
</NativeNightlyRates>
<nativeRoomRate>168.68</nativeRoomRate>
<rateFrequency>B</rateFrequency>
</PromoRateInfo>
<RateInfo>
<displayCurrencyCode>USD</displayCurrencyCode>
<DisplayNightlyRates size="1">
<displayNightlyRate>168.91</displayNightlyRate>
</DisplayNightlyRates>
<displayRoomRate>185.57</displayRoomRate>
<chargeableRoomRateTotal>185.57</chargeableRoomRateTotal>
<chargeableRoomRateTaxesAndFees>16.66</chargeableRoomRateTaxesAndFees>
<taxesOnly>16.66</taxesOnly>
<salesTax>0</salesTax>
<hotelOccupancyTax>0</hotelOccupancyTax>
<nativeCurrencyCode>USD</nativeCurrencyCode>
<NativeNightlyRates size="1">
<nativeNightlyRate>168.91</nativeNightlyRate>
</NativeNightlyRates>
<nativeRoomRate>185.57</nativeRoomRate>
<rateFrequency>B</rateFrequency>
</RateInfo>
</HotelProperty>
<hotelUrl>
http://booking.rated-hotels.co.uk/index.jsp?pageName=hotAvail&cid=409870&hotelID=188139&mode=2&numberOfRooms=1&room-0-adult-total=2&room-0-child-total=0&arrivalMonth=9&arrivalDay=11&departureMonth=9&departureDay=12&showInfo=true&locale=en_US¤cyCode=USD&mcicid=409870.HOTEL.XML.85419
</hotelUrl>
</Hotel>
</HotelAvailabilityListResults>
</Destination>
</DestinationResults>
我的 Xslt 如下:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- Edited by XMLSpy® -->
<html xsl:version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml">
<body style="font-family:Arial;font-size:12pt;background-color:#EEEEEE">
<xsl:for-each select="DestinationResults">
<xsl:for-each select="Destination">
<xsl:for-each select="HotelAvailabilityListResults">
<xsl:for-each select="Hotel">
<div style="background-color:teal;color:white;padding:4px">
<span style="font-weight:bold"><xsl:value-of select="name"/></span>
- <xsl:value-of select="city"/>
</div>
<div style="margin-left:20px;margin-bottom:1em;font-size:10pt">
<p><xsl:value-of select="shortDescription"/>.
<span style="font-style:italic">
<xsl:value-of select="address1"/>
</span>.</p>
</div>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
</body>
</html>