I am developing an application were I need to transform XML documents that look like this:
<?xml version='1.0' encoding='ISO-8859-1'?>
<!DOCTYPE words SYSTEM "words.dtd">
<words>
<word id="word_1">Alfa</word>
<word id="word_2">Beta</word>
<word id="word_3">Gamma</word>
<word id="word_4">Pi</word>
</words>
Using a XSLT stylesheet. I would like the result of the transformation to be (in this case) Alfa Beta Gamma Pi and this is the XSL I am using:
<?xml version='1.0' encoding='ISO-8859-1'?>
<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<xsl:for-each select="words/word">
<tr>
<td><xsl:value-of select="@id"/></td>
<td>
<xsl:attribute name="word">
<xsl:value-of select="@id" />
</xsl:attribute>
</td>
</tr>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
The result is not the one I am looking for. What do I have to change in the XSLT?
Let me guess… it’s outputing the ID instead of the value.
You probably want:
or