如果我有这样的XSLXSL命名空间问题
<?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>
而这个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>
如何真正从该行得到一些数据:
<xsl:value-of select="//Description" />
我花了几个小时在这一点上,我已经得出结论,xmlns =命名空间是什么导致我的悲伤。
任何帮助非常感谢。
者均基于XML是从Web服务来,所以我不能只是“改变” - 我可以是进行预处理,但不是理想......
我也已经证实,去除的命名空间XML的模拟确实解决了这个问题。
好问题,+1。请参阅我的回答以获得解释和简短而简单的解决方案。 –
你说得对,命名空间是有差别的。请参阅Dimitre的解释......如果您阅读了XML名称空间(特别是在XPath中使用的),您将真的节省自己的时间。 – LarsH