get xml attribute named xlink:href using xsl

Posted by awe on Stack Overflow See other posts from Stack Overflow or by awe
Published on 2010-05-06T08:21:24Z Indexed on 2010/05/06 8:58 UTC
Read the original article Hit count: 293

Filed under:
|
|
|

How can I get the value of an attribute called xlink:href of an xml node in xsl template?

I have this xml node:

<DCPType>
 <HTTP>
  <Get>
   <OnlineResource test="hello" xlink:href="http://localhost/wms/default.aspx" 
      xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" />
  </Get>
 </HTTP>
</DCPType>

When I try the following xsl, I get an error saying "Prefix 'xlink' is not defined." :

<xsl:value-of select="DCPType/HTTP/Get/OnlineResource/@xlink:href" />

When I try this simple attribute, it works:

<xsl:value-of select="DCPType/HTTP/Get/OnlineResource/@test" />

© Stack Overflow or respective owner

Related posts about xml-attribute

Related posts about xls