2012-03-28 43 views
1

我對支付網關等XML請求並不陌生。SOAP,XSL和HTML

但是我是SOAP和XSL的新手。

我有這樣的XML從租來的車Web服務返回: bluealliance-pt.w4.makeitsimple.pt/teste.xml

我想用XSL來顯示它在我的網站轉換。 我試圖做到這一點與普通XML沒有任何問題: bluealliance-pt.w4.makeitsimple.pt/listar.asp 這些文件: bluealliance-pt.w4.makeitsimple.pt/banco.xml bluealliance-PT .w4.makeitsimple.pt/visualizar.xsl

但我不知道如何處理SOAP XML,我如何找到它的元素和值。 是否可以清除XML的一些信息,所以我可以有一個更短的XML? 從中獲取信息的方式是什麼?

嗨,只需要從MultiplePrices1,2,3 ..等得到值。 我需要XSL運行所有MultiPrices,然後顯示每個值的所有值。

我會感謝所有幫助

+0

我不確定任何人都可以提供幫助,除非您向我們展示一些示例源和目標XML – Kevan 2012-03-28 01:49:11

+0

您正在使用哪個平臺? Java的? 。淨? – 2012-03-28 03:49:02

回答

0

沒有什麼特別的提供SOAP響應,因爲感興趣的元素沒有命名空間。

這個簡單的變換

<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 
<xsl:output omit-xml-declaration="yes" indent="yes"/> 

<xsl:template match="/"> 
    <html> 
    <table border="1"> 
    <xsl:apply-templates/> 
    </table> 
    </html> 
</xsl:template> 
<xsl:template match="MultiplePrices"> 
    <tr> 
    <xsl:apply-templates/> 
    </tr> 
</xsl:template> 

<xsl:template match="MultiplePrices/*[not(*)]"> 
    <td><xsl:value-of select="name()"/></td> 
    <td><xsl:value-of select="."/></td> 
</xsl:template> 

<xsl:template match="text()"/> 
</xsl:stylesheet> 

當對載在所提供的URLhttp://bluealliance-pt.w4.makeitsimple.pt/teste.xml)XML文檔被應用時產生包含用於每個子元素的名稱 - 值對的表(簡單的內容)MultiplePrices

您可以將此XSLT轉換作爲基礎,並將其放入您自己的代碼中。