TypeError if xsl:output method="xml" is used for the boot stylesheet
If I use
xsl:output method="xml" (either explicit or implicit) in the boot stylesheet (@test_br_1.xsl@) then a
TypeError is thrown by the browser  as soon as the initializing
Saxonce.nocache.js is executed. This is demonstrated by the attached test (@test_br.xml@).
If I change the
output method to
html (as shown in
sample.boot.xsl ), then at least Saxon-CE works correct. But most browsers handle the line break elements (@
@) coming from the input or from the XSLT 1.0 stylesheet wrong: many line breaks get doubled, only Firefox seems to get this right. This too can be demonstrated with the attached test. Other self-closing elements may also cause problems.
Maybe I overlook something trivial. I'm not after any serialization and I can easily change my stylesheet to test anything you propose. What I can't change easily (at least in the short run) is the input XML (about 20.000 documents). For a workaround I used Saxon-CE with
<xsl:template match="html:br[preceding-sibling::node()[self::html:br]]" mode="init"/>
Platform Win32 System Windows XP
Opera Version 12.02 Build 1578
Event thread: DOMContentLoaded
Uncaught exception: TypeError: Cannot convert 'm.body' to object
Error thrown at line 14, column 114 in I() in
called from line 16, column 101 in () in
Other browsers give simmiliar messages:
TypeError: a.style is undefined
Saxonce.nocache.js Line: 14
Google Chrome Version 23.0.1271.52 beta-m
Uncaught TypeError: Cannot set property 'cssText' of null
Safari 5.0 (7533.16)
TypeError: Result of expression 'a.style' [null] is not an object.
#1 Updated by Michael Kay over 8 years ago
- Status changed from New to In Progress
- Assignee set to Michael Kay
- Priority changed from Low to Normal
- Found in version set to 1.0
Thanks for reporting it, we'll look into it.
A lot of this is outside our control, as far as I can see. The execution of the boot stylesheet is under the control of the native XSLT 1.0 processor in the browser. I would have thought this should always use method="html", as HTML is what it is generating (though if the processor isn't serializing the output - which is the case with Firefox - then it shouldn't matter what xsl:output says - in theory at any rate).
#2 Updated by Michael Kay over 8 years ago
What isn't clear to me is why your boot stylesheet is trying to copy the XML source into the HTML page. This isn't what our sample boot stylesheet at http://www.saxonica.com/ce/doc/starting/running/pi-sample.xml does: it merely creates a skeletal HTML page that then invokes Saxon-CE to process the XML source.
#3 Updated by Manfred Staudinger over 8 years ago
I was starting with source XML files each of which contain cross-references in the form of sequences of link elements (@@) or sequences of comma separated character strings. Those are all valid XHTML markup plus some control information in my private namespace and are processed with the browsers own XSLT 1.0 engine which is started from a
This leaves a lot of still complex processing for XSLT 1 and I had hoped for a coexistence of the browsers XSLT 1 engine and Saxon-CE, at least for a while. The migration, which for sure will also involve changes in the source XML, could be done in smaller stages and the reaction of the users used for the next stage.
If with HTML5 the DOM for HTML and XHTML is the same, how would it possible for
Saxonce.nocache.js to get a
TypeError for one case and not the other? Do you see any other possibility to run Saxon-CE after an initial XSLT 1 (with output XML)?
#4 Updated by Manfred Staudinger over 8 years ago
Hopefully I have found a solution for
xsl:output method="html"@: If I change creating an @<br/> element from
<xsl:element name="br" namespace=""/>
and also add a template
<xsl:template match="html:br"> <xsl:element name="br" namespace=""/> </xsl:template>
Please register to edit this issue