Project

Profile

Help

Bug #1697

closed

Namespaces are stripped in output.

Added by Trent Nelson almost 12 years ago. Updated over 11 years ago.

Status:
Closed
Priority:
Normal
Sprint/Milestone:
Start date:
2013-02-16
Due date:
% Done:

100%

Estimated time:
Platforms:

Description

I can't seem to get Saxon-CE to preserve XML namespaces in my output.

<xsl:template match="/" xmlns:b="uri:foo">
    <b:foo>bar</b:foo>
</xsl:template>

Running the same XML data and stylesheet through the Java Saxon version keeps the namespaces, as expected.

I've tried everything; namespace-aliases, re-declaring xmls:b on all the child elements, but alas, it's always stripped.

I'm trying to use Saxon-CE to generate a combination of HTML and Backbase XML; the latter provides various widgets via separate namespaces (i.e. <b:accordion>). So, I need the output XML to include the Backbase-specific XML prefixes.

Is this a supported feature?

Actions #1

Updated by Michael Kay almost 12 years ago

I suspect the problem is with the HTML DOM. It's not clear from your description exactly what you are doing, but namespace handling in the HTML DOM is pretty much a no-go area. XML "islands" in HTML are very patchily supported in different browsers and I think GWT (which provides the abstraction layer that we use) doesn't support them at all.

So I think we need a clearer description of exactly what you are doing and what you are actually trying to achieve - where do you want this HTML with "Backbase XML" (something I am unfamiliar with) to end up? Are we talking about the HTML of the browser page, or something else?

Actions #2

Updated by O'Neil Delpratt over 11 years ago

  • Status changed from New to Resolved
  • Assignee set to O'Neil Delpratt
  • % Done changed from 0 to 100

Bug fixed and committed to github.

The problem was caused as a side effect of the HTMLwriter not carry through prefixes because assumed that we were dealing with a HTML DOM. We now special case the instance were we are dealing with a XML DOM.

Actions #3

Updated by Michael Kay over 11 years ago

A further note on this for future reference. GWT offers two DOM implementations, one for XML and one for HTML. Originally we used the XML implementation when writing XML, the HTML one for HTML. We now use the HTML DOM in both cases, but with a flag so we behave differently depending whether we are writing HTML or XML. This bug fix makes use of this flag to change the way namespaces are handled in XML mode. I think the primary reason for this was to make the returned Document object accessible to Javascript code. For use cases where there's a pipeline of transformations and the XML is going to be fed straight back into Saxon, we probably shouldn't be using either DOM implementation, but should use Saxon's internal LinkedTree instead, which will be much faster to process when it's read back in. So perhaps we should add a transformToXdm() method that returns an opaque JS object which can only be used by supplying it back to another Saxon interface.

Actions #4

Updated by O'Neil Delpratt over 11 years ago

  • Status changed from Resolved to Closed
  • Sprint/Milestone set to Release 1.1
  • Fixed in version set to 1.1

Bug fixed for Saxon-CE version 1.1 release

Please register to edit this issue

Also available in: Atom PDF