You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Matt Walter <Ma...@usi.net> on 2004/05/26 18:09:18 UTC

XHTMLSerializer and empty 'xmlns' attributes

I'm using the following:

FileGenerator -> XSLTTransfomer -> XHTMLSerializer

 

Each time <xsl:call-template> is encountered, the Serializer places an
empty "xmlns" attribute in the first tag it outputs, for example:

<div xmlns="" id="bannerBlock"> 

 

All subsequent tags are fine until <xsl:call-template> is encountered
again, at which point I get the empty 'xmlns' attribute again.

 

Though this doesn't bother me, I've been asked to see if I can prevent
this from happening. Any ideas?

 

Thanks,

Matt

 

 


Re: XHTMLSerializer and empty 'xmlns' attributes

Posted by "Volkm@r" <pl...@arcor.de>.
Matt Walter wrote:
> I'm using the following:
> 
> FileGenerator -> XSLTTransfomer -> XHTMLSerializer
> 
>  
> 
> Each time <xsl:call-template> is encountered, the Serializer places an
> empty "xmlns" attribute in the first tag it outputs, for example:
> 
> <div xmlns="" id="bannerBlock"> 
> 
>  
> 
> All subsequent tags are fine until <xsl:call-template> is encountered
> again, at which point I get the empty 'xmlns' attribute again.
> 
>  
> 
> Though this doesn't bother me, I've been asked to see if I can prevent
> this from happening. Any ideas?

With this little of information it is hard to say.

Could you post a simplified stylesheeet and source-xml that demonstrates 
the problem? Or better, put them on a server and post the link.

-- 
Volkmar W. Pogatzki


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: XHTMLSerializer and empty 'xmlns' attributes

Posted by Joerg Heinicke <jo...@gmx.de>.
On 26.05.2004 23:41, Lars Huttar wrote:

>>You must fix your stylesheet. While the elements out of those named 
>>templates create elements in a default namespace (probably xhtml 
>>namespace), the named template don't do it, so the serializer 
>>must reset 
>>the default namespace.
>>
>>http://www.w3.org/TR/REC-xml-names/ with main point in chapter 5.
> 
> To spell it out in more detail,
> your xhtml output is supposed to be in the xhtml namespace,
> and perhaps the outer part of it (<xhtml:html>, <xhtml:head>, etc.) is.
> In general these are serialized with xhtml as the default namespace:
>  <html xmlns="...xhtmlNamespaceURI...">
>    <head>
>     ...
> 
> However the template that is being called with call-template is producing
> <div>'s that are in no namespace, so they can't be serialized as just plain
>     <div>
> in the above context.
> 
> The fix is to make sure the <div>'s are in the xhtml namespace.
> In other words, in your called template, instead of
>   <div>
> say
>   <xhtml:div>

Thanks for the clarification/completion.

The simplest way to fix it is probably to set the default namespace to 
xhtml namespace on the xsl:stylesheet:

<xsl:stylesheet xmlns:xhtml="...xhtmlNamespaceURI..."
                 xmlns="...xhtmlNamespaceURI..."
                 xmlns:xyz="some more">

Joerg

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


RE: XHTMLSerializer and empty 'xmlns' attributes

Posted by Lars Huttar <la...@sil.org>.
> From: Joerg Heinicke
> Sent: Wednesday, May 26, 2004 1:31 PM
> To: users@cocoon.apache.org
> Subject: Re: XHTMLSerializer and empty 'xmlns' attributes
> 
> On 26.05.2004 18:09, Matt Walter wrote:
> > I'm using the following:
> > 
> > FileGenerator -> XSLTTransfomer -> XHTMLSerializer
> > 
> > Each time <xsl:call-template> is encountered, the 
> Serializer places an
> > empty "xmlns" attribute in the first tag it outputs, for example:
> > 
> > <div xmlns="" id="bannerBlock"> 
> > 
> > All subsequent tags are fine until <xsl:call-template> is 
> encountered
> > again, at which point I get the empty 'xmlns' attribute again.
> > 
> > Though this doesn't bother me, I've been asked to see if I 
> can prevent
> > this from happening. Any ideas?
> 
> You must fix your stylesheet. While the elements out of those named 
> templates create elements in a default namespace (probably xhtml 
> namespace), the named template don't do it, so the serializer 
> must reset 
> the default namespace.
> 
> http://www.w3.org/TR/REC-xml-names/ with main point in chapter 5.
> 
> Joerg

To spell it out in more detail,
your xhtml output is supposed to be in the xhtml namespace,
and perhaps the outer part of it (<xhtml:html>, <xhtml:head>, etc.) is.
In general these are serialized with xhtml as the default namespace:
 <html xmlns="...xhtmlNamespaceURI...">
   <head>
    ...

However the template that is being called with call-template is producing
<div>'s that are in no namespace, so they can't be serialized as just plain
    <div>
in the above context.

The fix is to make sure the <div>'s are in the xhtml namespace.
In other words, in your called template, instead of
  <div>
say
  <xhtml:div>


Lars



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: XHTMLSerializer and empty 'xmlns' attributes

Posted by Joerg Heinicke <jo...@gmx.de>.
On 26.05.2004 18:09, Matt Walter wrote:
> I'm using the following:
> 
> FileGenerator -> XSLTTransfomer -> XHTMLSerializer
> 
> Each time <xsl:call-template> is encountered, the Serializer places an
> empty "xmlns" attribute in the first tag it outputs, for example:
> 
> <div xmlns="" id="bannerBlock"> 
> 
> All subsequent tags are fine until <xsl:call-template> is encountered
> again, at which point I get the empty 'xmlns' attribute again.
> 
> Though this doesn't bother me, I've been asked to see if I can prevent
> this from happening. Any ideas?

You must fix your stylesheet. While the elements out of those named 
templates create elements in a default namespace (probably xhtml 
namespace), the named template don't do it, so the serializer must reset 
the default namespace.

http://www.w3.org/TR/REC-xml-names/ with main point in chapter 5.

Joerg


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org