0
我怎樣才能給我的輸出正確的格式? XSLT中缺少什麼? 看看我下面的例子。預先感謝您的幫助。爲什麼我沒有使用我的xsl格式化結果(csv)?
XML:
<?xml version="1.0" encoding="UTF-8"?>
<FED xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<POI>
<Id>56241</Id>
<POI_Contact>
<CategoryID>museum</CategoryID>
<Name>Centre Pompidou</Name>
</POI_Contact>
</POI>
<POI>
<Id>141670</Id>
<POI_Contact>
<CategoryID>museum</CategoryID>
<Name>Espace Culturel Saint-Exupéry</Name>
</POI_Contact>
</POI>
<POI>
<Id>56242</Id>
<POI_Contact>
<CategoryID>museum</CategoryID>
<Name>Musée du Louvre</Name>
</POI_Contact>
</POI>
</FED>
XSL:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="text" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/">
ID;Category;Name
<xsl:for-each select="FED/POI">
<xsl:value-of select="Id"/>;
<xsl:value-of select="POI_Contact/CategoryID"/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
輸出:
ID;Category;Name
56241;
museum
141670;
museum
56242;
museum
輸出應該是這樣的:
ID;類別;名稱
56241;博物館
141670;博物館
56242;博物館
謝謝邁克爾,現在我得到了正確的結果。 – happymapper