What would cause Orbeon to produce a duplicate xmlns:xbl prefix in XHTML mode?

I'm working on an application that embeds Orbeon XForms renderer. I'm using this to generate XHTML rather than HTML. We have a form that uses 2 custom XBL components.

The XHTML that we pass to orbeon is appears to be correct. But the resulting XHTML from Orbeon contains the definition of the xbl name-space on the <body> element twice. This prevents it being parsed as valid XML.

This is actually a very complex form which I can't post here but the important bits for this question are:

<xhtml:html xmlns:exf="http://www.exforms.org/exf/1-0" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xxforms="http://orbeon.org/oxf/xml/xforms" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xf="http://www.w3.org/2002/xforms" xmlns:f="http://orbeon.org/oxf/xml/formatting" xmlns:fw="http://orionhealth.com/forms/widgets" xmlns:xhtml="http://www.w3.org/1999/xhtml"> <xhtml:head> <!-- Lots of stuff --> <xbl:xbl xmlns:xbl="http://www.w3.org/ns/xbl"> <xbl:script src="...."/> <xbl:binding id="fw-autocomplete" element="fw|autocomplete"> <xbl:template> <!-- Lots of stuff --> </xbl:template> </xbl:binding> </xbl:xbl> <xbl:xbl xmlns:xbl="http://www.w3.org/ns/xbl"> <xbl:script src="...."/> <xbl:binding id="fw-datetime" element="fw|datetime"> <xbl:template> <!-- Lots of stuff --> </xbl:template> </xbl:binding> <xbl:binding id="fw-date" element="fw|date"> <xbl:template> <!-- Lots of stuff --> </xbl:template> </xbl:binding> <xbl:binding id="fw-partial-date" element="fw|partial-date"> <xbl:template> <!-- Lots of stuff --> </xbl:template> </xbl:binding> </xbl:xbl> </xhtml:head> <xhtml:body id="body"> <!-- Lots of stuff --> </xhtml:body> </xhtml:html>

Of note, while both of the XBL components are defined, neither of them is actually used in the body of the document. The resulting XHTML from Orbon (again simplified) is:

<?xml version="1.0" encoding="utf-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns:exf="http://www.exforms.org/exf/1-0" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xxforms="http://orbeon.org/oxf/xml/xforms" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xf="http://www.w3.org/2002/xforms" xmlns:f="http://orbeon.org/oxf/xml/formatting" xmlns:fw="http://orionhealth.com/forms/widgets" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/xhtml" xxforms:noscript="true"> <head> <!-- Lots of Stuff --> </head> <body xmlns:xbl="http://www.w3.org/ns/xbl" xmlns:xbl="http://www.w3.org/ns/xbl" id="body" class="yui-skin-sam"> <!-- Lots of Stuff --> </body> </html>

Note the duplicated xmlns:xbl="http://www.w3.org/ns/xbl" on the body tag.

Googling I haven't found anything about this issue, does anyone know what would cause this and what I can to to fix it?

I have noticed that if I define the xbl prefix on the <xhtml:html> element instead of each <xbl:xbl> element this doesn't seem to be a problem and the resulting XHTML out of Orbeon only has this prefix defined once on the <xhtml:html> element.

-------------Problems Reply------------

Orbeon uses XSLT to translate the XForms document to XHTML. The XSLT spec says:

The created element node will also have a copy of the namespace nodes that were present on the element node in the stylesheet tree with the exception of any namespace node whose string-value is the XSLT namespace URI (http://www.w3.org/1999/XSL/Transform), a namespace URI declared as an extension namespace (see [14.1 Extension Elements]), or a namespace URI designated as an excluded namespace.

This means that the two namespace declarations in the source document had to be copied as per the specification, regardless of their relevance in the resulting document.

The solution you chanced upon of defining the namespace on the root node was also discussed in an unrelated question.

In XSLT 2.0, you can add the attribute copy-namespaces="no" to the xsl:copy or xsl:copy-of element.

Category:xhtml Views:1 Time:2011-08-04
Tags: xhtml orbeon xbl

Related post

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.198 (s). 11 q(s)