[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Handling a missing namespace

Subject: Re: [xsl] Handling a missing namespace
From: Martin Honnen <Martin.Honnen@xxxxxx>
Date: Thu, 05 Jul 2012 18:38:37 +0200

Aaron Johnson wrote:

I'm looking for advice on how to handle 2 different xml files in 1
transform, one has a namespace, the other doesn't.

Example with namespace...

<ns1:BigCardThing xmlns:ns1="http://xyz.com/ns1/blah/blahspec">



<BigCardThing >

Is there a way for xslt to look for the missing namespace and then
'add it' in the transform?

<xsl:template match="*[not(namespace-uri())]">
<xsl:element name="ns1:{local-name()}" namespace=""http://xyz.com/ns1/blah/blahspec">
<xsl:apply-templates select="@* | node()"/>


	Martin Honnen --- MVP Data Platform Development

Current Thread