2

I have the following XML snippet

<aaa>
  <bbb xmlns="http://net.some.address.com">
    <ccc>123321</ccc>
  </bbb>
</aaa>

And i want to select the value of <ccc> with XSL template, but not able to get it by using

<xsl:value-of select="/aaa/bbb/ccc"/>

Any ideas how to get the value without changing the input ?

evilsoldier
  • 161
  • 12

1 Answers1

5

Declare the namespace and use it.

<xsl:value-of xmlns:a="http://net.some.address.com" select="/aaa/a:bbb/a:ccc"/>
  • You can pick any prefix you want, it does not have to be a.
  • You can declare the namespace at any point higher up in the XSLT document. Usually all namespaces are declared at the <xsl:stylesheet> level, but as you can see, that's just a convention.
Tomalak
  • 332,285
  • 67
  • 532
  • 628