Gunnar Bittersmann: xpath zugriff aus template auf ein xml-element mit namespace!?

Beitrag lesen

Hello out there!

<dc xmlns="topology.model.telemetering.tyrux.test.com" id="90" serialNo="56309" estateId="13123"/>
<ed xmlns="topology.model.telemetering.tyrux.test.com" id="60" serialNo="43942" estateId="13123"/>

<xsl:template match="dc"> funktioniert aber nicht. wie komme ich an meine elemente mit xmlns-attributen ran?!
<xsl:template match=".............."> ?!?!

Du musst im Stylesheet alle Namensräume bekanntmachen:

<xsl:stylesheet version="1.0"  
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"  
  xmlns:myNamespace="topology.model.telemetering.tyrux.test.com"  

>

Und dann verwenden:
<xsl:template match="myNamespace:dc">

See ya up the road,
Gunnar

--
“Remember, in the end, nobody wins unless everybody wins.” (Bruce Springsteen)