Project

Profile

Help

Should the transform method with destination : 'appendToBody' insert no namespace result elements as HTML elements with output method="html"?

Added by Martin Honnen about 8 years ago

http://www.saxonica.com/saxon-js/documentation/index.html#!api/transform says about @destination@ that

"appendToBody" means the principal result is inserted after the existing content of the body element of the HTML page

If I have a HTML document with script using that destination to process a stylesheet that transforms XML input with @xsl:output method="html"@ into no namespace HTML elements then it seems Saxon inserts them into the body of the HTML document as no namespace XML elements as they are not treated as HTML elements, instead in a test case like http://home.arcor.de/martin.honnen/xslt/test2016102401.html the result elements like @section@ or @ul@ or @li@ lack any HTML semantics and rendering.

Is that the intended result?

I would expect the output method @html@ to cause the creation of HTML elements working properly in the body of an HTML element.

I have seen the recommendation in the documentation to use @xsl:result-document href="#id-of-some-element"@ but the direct appendToBody should work too if I understand the documentation correctly.


Replies (2)

RE: Should the transform method with destination : 'appendToBody' insert no namespace result elements as HTML elements with output method="html"? - Added by Debbie Lockett about 8 years ago

You're right, the use of destination:'appendToBody' is not producing the intended results. I recall seeing similar results myself at some stage, but there is clearly still a bug here (I will add one to our list). I'm afraid this is currently not well tested.

RE: Should the transform method with destination : 'appendToBody' insert no namespace result elements as HTML elements with output method="html"? - Added by Debbie Lockett about 8 years ago

I have added bug https://saxonica.plan.io/issues/3012 to track the issue of producing HTML elements.

Note that the use of xsl:output method="html" is to do with serialisation, so it is irrelevant here. The point is that when we are creating elements which get added to an HTML document (in the browser), they should be created as HTML elements; but currently this does not always happen.

    (1-2/2)

    Please register to reply