I have an xslt template that i use for converting data, the one i have right now has a choose statement with a bunch of when clauses for each eventuality, the output given is that it seems to ignore all the when's and just goes straight to the otherwise.
ive removed a couple of when statements to shorten it
Ive been through it step by step, changed the select statement to look at the code=a directly.
Something is wrong with my when but i cant seem to see it
<xsl:for-each select="datafield[@tag='300']">
<xsl:choose>
<xsl:when test="./subfield[@code='a'] !='' and ./subfield[@code='e'] !='' and ./subfield[@code='c'] !=''">
<xsl:element name="PhysicalDescription">
<xsl:value-of select="./subfield[@code='a']" />
</xsl:element>
<xsl:element name="CoverColour">
<xsl:value-of select="./subfield[@code='c']" /> - <xsl:value-of select="./subfield[@code='e']" />
</xsl:element>
</xsl:when>
<xsl:when test="./subfield[@code='a'] !='' and ./subfield[@code='c'] !='' and ./subfield[@code='e'] =''">
<xsl:element name="PhysicalDescription">
<xsl:value-of select="./subfield[@code='a']" />
</xsl:element>
<xsl:element name="CoverColour">
<xsl:value-of select="./subfield[@code='c']" />
</xsl:element>
</xsl:when>
<xsl:otherwise>
<xsl:element name="PhysicalDescription">
<xsl:value-of select="./subfield[@code='a']" />
</xsl:element>
</xsl:otherwise>
</xsl:choose>
XML Data
<datafield tag="300" ind1="0" ind2="0">
<subfield code="a">1-914pp (vol.1)</subfield>
</datafield>
<datafield tag="300" ind1="0" ind2="0">
<subfield code="a">915-2385pp (vol.2)</subfield>
</datafield>
<datafield tag="300" ind1="0" ind2="0">
<subfield code="a">cli, 835p (supp)</subfield>
<subfield code="e">Pbk</subfield>
</datafield>
<datafield tag="300" ind1="0" ind2="0">
<subfield code="c">navy cover</subfield>
<subfield code="e">Hbk</subfield>
</datafield>
It should loop through the datafield[@tag='300'] node and for each one that it finds output a value based on the xsl:when.
it only ever outputs the otherwise statement