Inside of your xsl:when
the context node is still /
, so the expression <xsl:value-of select="e:name"/>
is the equivelent of /e:name
, which will never match anything.
You need to adjust the XPath relative from the context node <xsl:value-of select="dalehoward/e:ep[@id=1]/e:name" />
.
Also, you need to move the xsl:value-of
below the generation of the attribute. Otherwise, you will get an error that you cannot create attributes after a child of the containing element.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:artist="http://www.beatport.com/artist/dale-howard/78784"
xmlns:e="http://www.beatport.com/artist/dale-howard/78784/releases"
xmlns:t="http://www.beatport.com/artist/dale-howard/78784/tracks">
<xsl:template match="/">
<html>
<body>
<select id="epselect">
<xsl:element name="option">
<xsl:choose>
<xsl:when test="dalehoward/e:ep/@id = 1">
<xsl:attribute name="value">1</xsl:attribute>
<xsl:value-of select="dalehoward/e:ep[@id=1]/e:name"/>
</xsl:when>
<xsl:otherwise>
EP not found
</xsl:otherwise>
</xsl:choose>
</xsl:element>
</select>
</body>
</html>
</xsl:template>
</xsl:stylesheet>