Access对于XSLT中的每个路由属性

时间:2013-07-29 08:05:04

标签: xml xslt xpath xhtml

我正在尝试使用xslt访问每个节点属性。但它没有用。需要为每个酒店房间打印shrui值。任何人都可以帮我这个吗?我

以下是我的XML响应。

   <HotelRoom SHRUI="AqZE8Cw72fDfNL6X0hqQTQ==" availCount="10" 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>549.360</Amount>
              </Price>
            </HotelRoom>

以下是我的XSLT。

  <xsl:for-each select="hm:HotelRoom ">
                <shrui>
                  <xsl:value-of select="hm:HotelRoom/@SHRUI"/>
                </shrui>
                <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>

1 个答案:

答案 0 :(得分:1)

替换...

<xsl:value-of select="hm:HotelRoom/@SHRUI"/>

...与...

<xsl:value-of select="@SHRUI"/>

另外,从外观上看,您可以从更具推动力的设计中受益(参考:http://www.eddiewelker.com/2008/11/25/push-style-xslt-vs-pull-style/http://www.ibm.com/developerworks/library/x-xdpshpul.html