If I have this XSL
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html"/>
<xsl:output omit-xml-declaration="yes" encoding="UTF-8"/>
<xsl:template match='/'>
<xsl:value-of select="//Description" />
</xsl:template>
</xsl:stylesheet>
And this XML
<ArrayOfLookupValue xmlns="http://switchwise.com.au/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<LookupValue>
<Description>AGL</Description>
<Value>8</Value>
</LookupValue>
<LookupValue>
<Description>Australian Power & Gas</Description>
<Value>6</Value>
</LookupValue>
<LookupValue>
<Description>EnergyAustralia</Description>
<Value>13</Value>
</LookupValue>
<LookupValue>
<Description>Origin Energy</Description>
<Value>9</Value>
</LookupValue>
<LookupValue>
<Description>TRU Energy</Description>
<Value>7</Value>
</LookupValue>
</ArrayOfLookupValue>
How can I get some data from this line:
<xsl:value-of select="//Description" />
I spent several hours on this, and I came to the conclusion that the xmlns = namespace makes me sad.
Any help is greatly appreciated.
By the way, XML comes from a web service, so I can’t just “change” it - I can pre-process it, but this is not ideal ...
I also confirmed that removing namespaces from the XML layout fixes the problem.
source
share