Page 1 of 1

xsl xmlns question

Posted: Thu Nov 25, 2010 6:32 pm
by thomasa
Hi!

I'm using oxygen to convert xml to xhtml. In the process I get an xmlns attribute in some of the resulting xhtml tags -- like this:

<xmltag>Heading</xmltag>

becomes

<h1 xmlns:"">Heading<h1>

xsl says: <xsl:template match="xmltag"><h1><xsl:value-of select="."/></h1></xsl:template>

How to get rid of the xmlns:""?

Thomas

Re: xsl xmlns question

Posted: Thu Nov 25, 2010 6:42 pm
by thomasa
Sorry, that would be <h1 xmlns:"">Heading</h1> of course... /Thomas

Re: xsl xmlns question

Posted: Thu Nov 25, 2010 6:56 pm
by adrian
Hello,

Are you sure it's not really xmlns="" ? xmlns:"" seems unlikely, it's not even XML well formed.

The problem is namespace related. You probably have an element in the stylehseet that specifies the XHTML namespace.
e.g.
<html xmlns="http://www.w3.org/1999/xhtml">

But then subsequent elements don't have the namespace specified.
If all the elements from the output are from the same namespace as is the case for XHTML you can either specify the namespace for each of them(which is a burden) or add add the default namespace declaration:
xmlns="http://www.w3.org/1999/xhtml" to the stylesheet root: <xsl: stylesheet.

Regards,
Adrian

Re: xsl xmlns question

Posted: Fri Nov 26, 2010 10:45 am
by thomasa
Hmm... did some typing errors in my post. You're right, it is xmlns="".

Removed xmlns="http://www.w3.org/1999/xhtml" in the <html> tag and put it in the <xsl:stylesheet instead.

Now everything is fine! Thanks a lot for helping!

Thomas