My xml looks like:
<record>
<name>ABC</name>
<address>
<street>sss</street>
<city>ccc</city>
<state>ttt</state>
</address>
</record>
I am trying to read the element 'street' using the xsl:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output omit-xml-declaration="yes" indent="yes" />
<xsl:template match="/">
<xsl:value-of select="record/address/street" />
</xsl:template>
</xsl:stylesheet>
but it doesn't give any output.
Why does this happen even though the input xml is in a valid xml format? So how to transform xml files containing character entities for element names?
To add to Michael Kay's answer:
If you start by processing your XML using:
XSLT 1.0
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:strip-space elements="*"/>
<!-- identity transform -->
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="address">
<xsl:copy>
<xsl:value-of select="." disable-output-escaping="yes"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
and save the result to file, you will then be able to use your stylesheet to process the resulting file and get the expected result.