0
我遇到了一些巨大的問題,這些問題是如何從導入兩個XML並組合數據的XSL輸出乾淨的XML。在XSL中輸出來自組合XML的XML
我試圖找到更多關於<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
的信息,我認爲這是我的解決方案,但我沒有得到如何將它全部放入一個實體XML文件。當我從服務器腳本調用它時,它看起來不錯,但它有一些HTML
標籤和其他我不想要的東西,我想這是因爲它仍然是XSL。
這是我的代碼:
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:param name="source-producenter" select="'Producers.xml'"/>
<xsl:param name="source-positioner" select="'positioner.xml'"/>
<xsl:variable name="producenter" select="document($source-producenter)"/>
<xsl:variable name="Workbook" select="document($source-positioner)"/>
<xsl:template match="/">
<Producers>
<xsl:for-each select="$producenter//producer">
<producer>
<id>
<xsl:value-of select="id"/>
</id>
<name>
<xsl:value-of select="name"/>
</name>
<address><xsl:value-of select="address"/></address>
<postalcode>
<xsl:value-of select="postalcode"/>
</postalcode>
<city>
<xsl:value-of select="city"/>
</city>
<site>
<xsl:value-of select="site"/>
</site>
<pic>
<xsl:value-of select="img"/>
</pic>
<!--Store id from producent into storeId xsl variable -->
<xsl:variable name="storedId" select="id"/>
<!--Using filter to get correct Cells for latitude and longitude and checks if text() in number is equal to our storedId variable-->
<xsl:variable name="selected"
select="$Workbook//ss:Cell[@ss:Index='2']/ss:Data[@ss:Type='Number' and text() = $storedId]"/>
<!--Gets the filtered values-->
<latitude>
<xsl:value-of select="$selected//../../ss:Cell[2]/ss:Data"/>
</latitude>
<longitude>
<xsl:value-of select="$selected//../../ss:Cell[3]/ss:Data"/>
</longitude>
</producer>
</xsl:for-each>
</Producers>
</xsl:template>
</xsl:stylesheet>
我所有並欣賞答案,預先感謝您!
請編輯問題並提供:1.準確的兩個XML文檔(請儘可能小)。 2.將這些轉換應用於這兩個XML分析時所得到的確切結果。 3.你得到的結果有什麼問題。 4.準確的結果(對於這兩個指定的XML文檔)你想得到。 –