Problemer med match og select
Jeg har problemer med udvælgelse af elementet PLANET idet jeg får for meget med:<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>
<TEMPLATE>
<PLANETS>
<PLANET>
<NAME>Earth</NAME>
<MASS>1</MASS>
</PLANET>
<PLANET>
<NAME>Venus</NAME>
<MASS>0.815</MASS>
</PLANET>
<PLANET>
<NAME>Mercury</NAME>
<MASS>0.0553</MASS>
</PLANET>
</PLANETS>
<STARS>
<STAR>
<NAME>Sun</NAME>
<MASS>1.87</MASS>
</STAR>
</STARS>
</TEMPLATE>
<?xml version=\"1.0\"?>
<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" version=\"1.0\">
<xsl:template match=\"/PLANETS\">
<html>
<head></head>
<body>
<xsl:apply-templates select=\"PLANET\"/>
</body>
</html>
</xsl:template>
<xsl:template match=\"PLANET\">
<xsl:apply-templates select=\"NAME\"/>
<xsl:apply-templates select=\"MASS\"/>
</xsl:template>
<xsl:template match=\"NAME\">
<xsl:value-of select=\".\"/>
</xsl:template>
<xsl:template match=\"text()\"/>
<xsl:template match=\"MASS\">
<xsl:value-of select=\".\"/>
</xsl:template>
</xsl:stylesheet>
Hvad gør jeg forkert siden jeg får følgende output:
Earth1Venus0.815Mercury0.0553Sun1.87
Jeg har jo kun bedt om PLANETS!
HTML Output er genereret via Saxon Instant v6.44
Med venlig hilsen
Henrik Malmvig
