0

XSLT を使用して、利用可能な各部屋を特定のホテルコードに割り当てたいと考えています。

?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soapenv:Body>
    <ns1:getHotelValuedAvail xsi:type="xsd:string" xmlns:ns1="http://axis.frontend.hydra.hotelbeds.com">
      <HotelValuedAvailRS xmlns="http://www.hotelbeds.com/schemas/2005/06/messages" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.hotelbeds.com/schemas/2005/06/messages HotelValuedAvailRS.xsd" timeToExpiration="1632006" totalItems="37" echoToken="DummyEchoToken">
        <AuditData>
          <ProcessTime>42</ProcessTime>
          <Timestamp>2013-07-10 09:34:58.957</Timestamp>
          <RequestHost>222.165.187.74:74</RequestHost>
          <ServerName>FORM</ServerName>
          <ServerId>FO</ServerId>
          <SchemaRelease>2005/06</SchemaRelease>
          <HydraCoreRelease>2.0.201305161604</HydraCoreRelease>
          <HydraEnumerationsRelease>1.0.201305161604</HydraEnumerationsRelease>
          <MerlinRelease>N/A</MerlinRelease>
        </AuditData>
        <PaginationData currentPage="1" totalPages="1" />
        <ServiceHotel xsi:type="ServiceHotel" availToken="/7ZjOKP9nrOZHY9ie9O+AA9e">
          <ContractList>
            <Contract>
              <Name>GR-ALL</Name>
              <IncomingOffice code="246">
              </IncomingOffice>
              <Classification code="NOR">Online Price</Classification>
            </Contract>
          </ContractList>
          <DateFrom date="20130731" />
          <DateTo date="20130806" />
          <Currency code="EUR">Euro</Currency>
          <HotelInfo xsi:type="ProductHotel">
            <Code>161434</Code>
            <Name>Sansinda</Name>
            <ImageList>
              <Image>
                <Type>jpg</Type>
                <Order>1</Order>
                <VisualizationOrder>1</VisualizationOrder>
                <Url>http://www.hotelbeds.com/giata/small/16/161434/161434a_hb_a_001.jpg</Url>
              </Image>
              <Image>
                <Type>jpg</Type>
                <Order>2</Order>
                <VisualizationOrder>2</VisualizationOrder>
                <Url>http://www.hotelbeds.com/giata/small/16/161434/161434a_hb_a_002.jpg</Url>
              </Image>
            </ImageList>
            <Category type="SIMPLE" code="2EST" shortname="2*">2 STARS</Category>
            <Destination type="SIMPLE" code="CMB">
              <Name>Colombo</Name>
              <ZoneList>
                <Zone type="SIMPLE" code="1">Colombo City</Zone>
              </ZoneList>
            </Destination>
            <ChildAge ageFrom="2" ageTo="11" />
            <Position latitude="6.28534699999999979525" longitude="81.28061399999999991905" />
          </HotelInfo>
          <AvailableRoom>
            <HotelOccupancy>
              <RoomCount>1</RoomCount>
              <Occupancy>
                <AdultCount>1</AdultCount>
                <ChildCount>0</ChildCount>
              </Occupancy>
            </HotelOccupancy>
            <HotelRoom SHRUI="pIVOtJH62/F454x5vO+56g==" availCount="2" onRequest="N">
              <Board type="SIMPLE" code="RO-E10" shortname="RO">ROOM ONLY</Board>
              <RoomType type="SIMPLE" code="SGL-E10" characteristic="ST">SINGLE STANDARD</RoomType>
              <Price>
                <Amount>178.020</Amount>
              </Price>
            </HotelRoom>
          </AvailableRoom>
          <AvailableRoom>
            <HotelOccupancy>
              <RoomCount>1</RoomCount>
              <Occupancy>
                <AdultCount>1</AdultCount>
                <ChildCount>0</ChildCount>
              </Occupancy>
            </HotelOccupancy>
            <HotelRoom SHRUI="qQn7qhVCZ/NeearM2A3fTw==" availCount="2" onRequest="N">
              <Board type="SIMPLE" code="BB-E10" shortname="BB">BED AND BREAKFAST</Board>
              <RoomType type="SIMPLE" code="SGL-E10" characteristic="ST">SINGLE STANDARD</RoomType>
              <Price>
                <Amount>198.360</Amount>
              </Price>
            </HotelRoom>
          </AvailableRoom>
          <AvailableRoom>
            <HotelOccupancy>
              <RoomCount>1</RoomCount>
              <Occupancy>
                <AdultCount>1</AdultCount>
                <ChildCount>0</ChildCount>
              </Occupancy>
            </HotelOccupancy>
            <HotelRoom SHRUI="RSeyrh1+FY8eqnLdIHPk4g==" availCount="2" onRequest="N">
              <Board type="SIMPLE" code="HB-E10" shortname="HB">HALF BOARD</Board>
              <RoomType type="SIMPLE" code="SGL-E10" characteristic="ST">SINGLE STANDARD</RoomType>
              <Price>
                <Amount>223.800</Amount>
              </Price>
            </HotelRoom>
          </AvailableRoom>
          <AvailableRoom>
            <HotelOccupancy>
              <RoomCount>1</RoomCount>
              <Occupancy>
                <AdultCount>1</AdultCount>
                <ChildCount>0</ChildCount>
              </Occupancy>
            </HotelOccupancy>
            <HotelRoom SHRUI="zJJNVc7Bvu+27FD/BjEnOQ==" availCount="2" onRequest="N">
              <Board type="SIMPLE" code="FB-E10" shortname="FB">FULL BOARD</Board>
              <RoomType type="SIMPLE" code="SGL-E10" characteristic="ST">SINGLE STANDARD</RoomType>
              <Price>
                <Amount>244.140</Amount>
              </Price>
            </HotelRoom>
          </AvailableRoom>
        </ServiceHotel>
        <ServiceHotel xsi:type="ServiceHotel" availToken="/7ZjOKP9nrOZHY9ie9O+AA9e">
          <ContractList>
            <Contract>
              <Name>3FIT</Name>
              <IncomingOffice code="246">
              </IncomingOffice>
              <Classification code="NOR">Online Price</Classification>
            </Contract>
          </ContractList>
          <DateFrom date="20130731" />
          <DateTo date="20130806" />
          <Currency code="EUR">Euro</Currency>
          <HotelInfo xsi:type="ProductHotel">
            <Code>174847</Code>
            <Name>The Saffron</Name>
            <ImageList>
              <Image>
                <Type>jpg</Type>
                <Order>1</Order>
                <VisualizationOrder>1</VisualizationOrder>
                <Url>http://www.hotelbeds.com/giata/small/17/174847/174847a_hb_a_001.jpg</Url>
              </Image>
              <Image>
                <Type>jpg</Type>
                <Order>2</Order>
                <VisualizationOrder>2</VisualizationOrder>
                <Url>http://www.hotelbeds.com/giata/small/17/174847/174847a_hb_a_002.jpg</Url>
              </Image>
            </ImageList>
            <Category type="SIMPLE" code="3EST" shortname="3*">3 STARS</Category>
            <Destination type="SIMPLE" code="CMB">
              <Name>Colombo</Name>
              <ZoneList>
                <Zone type="SIMPLE" code="1">Colombo City</Zone>
              </ZoneList>
            </Destination>
            <ChildAge ageFrom="0" ageTo="11" />
            <Position latitude="6.89867930000000040280" longitude="79.88908530000003338500" />
          </HotelInfo>
          <AvailableRoom>
            <HotelOccupancy>
              <RoomCount>1</RoomCount>
              <Occupancy>
                <AdultCount>1</AdultCount>
                <ChildCount>0</ChildCount>
              </Occupancy>
            </HotelOccupancy>
            <HotelRoom SHRUI="PhvHuBdusPSPrj46U3ji7g==" availCount="2" onRequest="N">
              <Board type="SIMPLE" code="BB-E10" shortname="BB">BED AND BREAKFAST</Board>
              <RoomType type="SIMPLE" code="SGL-E10" characteristic="ST">SINGLE STANDARD</RoomType>
              <Price>
                <Amount>203.460</Amount>
              </Price>
            </HotelRoom>
          </AvailableRoom>
          <AvailableRoom>
            <HotelOccupancy>
              <RoomCount>1</RoomCount>
              <Occupancy>
                <AdultCount>1</AdultCount>
                <ChildCount>0</ChildCount>
              </Occupancy>
            </HotelOccupancy>
            <HotelRoom SHRUI="anTQUy/rE+89jiB+sxHngg==" availCount="2" onRequest="N">
              <Board type="SIMPLE" code="HB-E10" shortname="HB">HALF BOARD</Board>
              <RoomType type="SIMPLE" code="SGL-E10" characteristic="ST">SINGLE STANDARD</RoomType>
              <Price>
                <Amount>244.140</Amount>
              </Price>
            </HotelRoom>
          </AvailableRoom>
          <AvailableRoom>
            <HotelOccupancy>
              <RoomCount>1</RoomCount>
              <Occupancy>
                <AdultCount>1</AdultCount>
                <ChildCount>0</ChildCount>
              </Occupancy>
            </HotelOccupancy>
            <HotelRoom SHRUI="2qVeWOc9++zf+7Ix5BMOIQ==" availCount="2" onRequest="N">
              <Board type="SIMPLE" code="FB-E10" shortname="FB">FULL BOARD</Board>
              <RoomType type="SIMPLE" code="SGL-E10" characteristic="ST">SINGLE STANDARD</RoomType>
              <Price>
                <Amount>284.880</Amount>
              </Price>
            </HotelRoom>
          </AvailableRoom>
        </ServiceHotel>
 </HotelValuedAvailRS>
    </ns1:getHotelValuedAvail>
  </soapenv:Body>
</soapenv:Envelope>

利用可能な各部屋にはホテルコードが必要です。以下は私のXSLTです。誰でもこれについて助けてもらえますか??/

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Edited by XMLSpy® -->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:hm="http://www.hotelbeds.com/schemas/2005/06/messages"
exclude-result-prefixes="hm">
  <xsl:output method="xml" indent="yes"/>
  <xsl:template match="/">
    <details>
    <xsl:for-each select="//hm:ServiceHotel">
      <xsl:variable name="i" select="position()" />
      <hotel>
        <hotelid>
          <xsl:value-of select="concat('', $i)"/>
        </hotelid>
      <currency>
        <xsl:value-of select="hm:Currency"/>
      </currency>
      <xsl:for-each select="hm:ContractList">
        <xsl:for-each select="hm:Contract">
          <classification>
            <xsl:value-of select="hm:Classification"/>
          </classification>
        </xsl:for-each>
      </xsl:for-each>
      <xsl:for-each select="hm:HotelInfo ">        
        <hotelcode>
          <xsl:value-of select="hm:Code"/>
        </hotelcode>      
        <hotelname>
          <xsl:value-of select="hm:Name"/>
        </hotelname>
        <xsl:for-each select="hm:ImageList ">
          <xsl:for-each select="hm:Image">
            <image>
              <xsl:value-of select="hm:Url"/>
            </image>
          </xsl:for-each>
        </xsl:for-each>
        <xsl:if test="not(hm:ImageList)">
          <image>Not Available</image>
          <image>Not Available</image>
        </xsl:if>
        <category>
          <xsl:value-of select="hm:Category"/>
        </category>
        <xsl:for-each select="hm:Destination">
          <destination>
            <xsl:value-of select="hm:Name"/>
          </destination>
          <xsl:for-each select="hm:ZoneList">
            <zone>
              <xsl:value-of select="hm:Zone"/>
            </zone>
          </xsl:for-each>
        </xsl:for-each>
        <AgeFrom>
          <xsl:value-of select="hm:ChildAge/@ageFrom"/>
        </AgeFrom><AgeTo>
          <xsl:value-of select="hm:ChildAge/@ageTo"/>
        </AgeTo>
        <Latitude>
          <xsl:value-of select="hm:Position/@latitude"/>
        </Latitude><Longitude>
          <xsl:value-of select="hm:Position/@longitude"/>
        </Longitude>
      </xsl:for-each>
      <xsl:for-each select="hm:AvailableRoom ">
        <availableroom>
          <hotelcode>

          </hotelcode>
          <xsl:for-each select="hm:HotelOccupancy ">
            <roomcount>
              <xsl:value-of select="hm:RoomCount"/>
            </roomcount>
            <xsl:for-each select="hm:Occupancy ">
              <guests>
                <xsl:value-of select="sum((hm:AdultCount | hm:ChildCount)[number(.) = .])"/>
              </guests>
            </xsl:for-each>
          </xsl:for-each>

          <xsl:for-each select="hm:HotelRoom ">
            <board>
              <xsl:value-of select="hm:Board"/>
            </board>
            <roomtype>
              <xsl:value-of select="hm:RoomType"/>
            </roomtype>
            <roomcode>
              <xsl:value-of select="hm:RoomType/@code"/>
            </roomcode>
            <boardcode>
              <xsl:value-of select="hm:Board/@code"/>
            </boardcode>
            <xsl:for-each select="hm:Price ">
              <amount>
                <xsl:value-of select="hm:Amount"/>
              </amount>
            </xsl:for-each>
          </xsl:for-each>
        </availableroom>
      </xsl:for-each>
      </hotel>
    </xsl:for-each>
    </details>
  </xsl:template>
</xsl:stylesheet>
4

2 に答える 2