I'm stucked with a xslt for-each-loop.
The xml source file is:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="party.xsl"?>
<party date="31.12.01">
<guest name="Albert">
<drink>wine</drink>
<drink>beer</drink>
<status single="true" sober="false" />
</guest>
<guest name="Martina">
<drink>apple juice</drink>
<status single="true" sober="true" />
</guest>
<guest name="Zacharias">
<drink>wine</drink>
<status single="false" sober="false" />
</guest>
</party>
I'd like to get the following output:
- Albert drinks: wine , beer ,
- Martina drinks: apple juice
- Zacharias drinks: wine ,
Therefore i wrote following XSLT file:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<head></head>
<body bgcolor="white">
<xsl:for-each select="party/guest">
<ul><li><b><xsl:value-of select="@name"/></b>
<xsl:text> drinks: </xsl:text>
<xsl:value-of select="drink"/>
<xsl:text>, </xsl:text>
</li></ul>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Using the XSLT file above i get following output:
- Albert drinks: wine,
- Martina drinks: apple juice,
- Zacharias drinks: wine,
How do i have to change my XSLT file, that i get all drinks form the guests displayed? Thanks a lot for your support!