我有下面的XML,需要转换它。
XML:<Assessment>
<Section ID="Listening">24</Section>
<Section ID="Writing">10</Section>
<Section ID="Reading">30</Section>
<Section ID="ABC">22</Section>
</Assessment>输出:
Listening-24
Writing-10
Reading-30
ABC-22我已经尝试了下面的代码,但我不能在输出中获得评估分数。如何在评估中获得价值?
XSL:
enter code here
<xsl:for-each select="Assessment/Section">
<xsl:value-of select="@ID"></xsl:value-of>
<xsl:value-of select="$delimiter"></xsl:value-of>
<xsl:value-of select="Section"></xsl:value-of>
<xsl:value-of select="$linefeed"></xsl:value-of>
</xsl:for-each>请提供帮助以修复此代码。
发布于 2015-11-24 15:31:45
尝试:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" encoding="UTF-8" />
<xsl:template match="/Assessment">
<xsl:for-each select="Section">
<xsl:value-of select="@ID"/>
<xsl:text>-</xsl:text>
<xsl:value-of select="."/>
<xsl:text> </xsl:text>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>https://stackoverflow.com/questions/33887660
复制相似问题