I'm sure I'm missing something simple here...
I can't select a nested xml element using an XLST transform.
Here is the xml
<collection>
<record>
<leader>01814nam a2200205Ia 4500</leader>
<controlfield tag="003">PSCA</controlfield>
<controlfield tag="005">20141201150951.0</controlfield>
<controlfield tag="008">131110s9999 xx 000 0 und d</controlfield>
<datafield tag="040" ind1=" " ind2=" ">
<subfield code="a">PSCA</subfield>
<subfield code="c">Calyx</subfield>
</datafield>
<datafield tag="110" ind1=" " ind2=" ">
<subfield code="9">76</subfield>
<subfield code="a">Children's Services Central</subfield>
</datafield>
<datafield tag="245" ind1="0" ind2="0">
<subfield code="a">What's Pedagogy Anyway?</subfield>
<subfield code="b">Using pedagogical documentation to engage with the Early Years Learning Framework </subfield>
</datafield>
</record>
</collection
I need to select the following data:
/collection
/record
/datafield
-->/@tag='245'
---->/subfield/@code='a'
I would expect the output to be: "What's Pedagogy Anyway?"
My XLST to select this node/data is as such:
<xsl:for-each select="collection/record/datafield">
<xsl:choose>
<xsl:when test="@tag=245">
<xsl:choose>
<xsl:when test="/subfeild/@code=a">
<xsl:value-of select="/subfeild"/>
</xsl:when>
</xsl:choose>
</xsl:when>
</xsl:choose>
</xsl:for-each>
I'm running this using the lxml library in Python if that's important. The code compiles and runs without error. My output is null.
Any ideas? Thanks in advance.