Closed Bug 263475 Opened 20 years ago Closed 20 years ago

CSS added using xsl:processing-instruction fails to apply to XSLT XML results

Categories

(Core :: XSLT, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

VERIFIED INVALID

People

(Reporter: bugmail, Assigned: peterv)

Details

(Keywords: testcase)

Attachments

(4 files, 2 obsolete files)

In the attached example, Firefox 0.10.1/Win fails to apply the CSS stylesheet
added to the XHTML results generated by the XSL transform.

A static XHTML page demonstrates that the style should apply.
Attached file XSLT transform for testcase (obsolete) —
Attached file XML testcase (obsolete) —
Attachment #161471 - Attachment mime type: text/xsl → text/xml
http://lxr.mozilla.org/seamonkey/source/extensions/transformiix/source/xslt/txMozillaXMLOutput.cpp#330

just returns for PIs in HTML output. Seems wrong to me, is that from back in the 
days when html and xml documents were much more different than they are now?
Note, the spec says that PIs should be ended with > instead of ?> for html output,
seems fine to have them.
http://www.w3.org/TR/xslt#section-HTML-Output-Method

Greg, XHTML inside html is not really the best thing since sliced bread, but
that's not really INVALIDating this.
Summary: CSS added using xsl:processing-instruction fails to apply to XSLT XML results → CSS added using xsl:processing-instruction fails to apply to XSLT XML results
Attachment #161471 - Attachment is obsolete: true
Attached file Corrected XML testcase
Attachment #161472 - Attachment is obsolete: true
Well, I can't make the XML testcase work on Bugzilla. Anyone know why?
Attachment #161477 - Attachment mime type: text/xsl → text/xml
text/xsl is not a mime type, after I fixed that, they work.
Processing instructions don't load stylesheets for regular HTML documents, why
should they work when transforming to an HTML document?
Should they not work when transforming to XHTML?

Anyway, it doesn't work when transforming to pure XML, either. I used XHTML in
order to include inline CSS style for easier testing.
Greg, the last attachment transforms to HTML since you have method="html" on the
xsl:output element. If you were to transform to XHTML or XML you should get
better results (i.e. by dropping the method attribute).

I'm sort of inclined to say that we're doing the right thing by dropping PIs
when transforming into HTML. Mostly because mozilla in general doesn't seem to
support the idea of PIs in HTML documents. See for example

http://lxr.mozilla.org/mozilla/source/content/html/document/src/nsHTMLDocument.cpp#1324

To be honest though, I don't know how correct mozilla is in doing that.
Seems like HTML does in fact have processing instructions:

http://www.w3.org/TR/html4/appendix/notes.html#h-B.3.6

It's questionable if transformiix should support them though considering that
the rest of mozilla doesn't. And it's even more questionable if an
'xml-stylesheet' processing instruction does anything in a HTML document.

I would say that the latter question points to us doing the right thing now.
But, the thing is, it doesn't work even in a pure XML context. Transform
<foo>foo</foo> to <p>foo</p> (in, yes, XML mode using method="xml"); try to
apply a style to the p using a CSS file referenced by a PI also generated by the
XSLT, and the style application fails.
oh, i think the problem is that your stylesheet is broken. You never actually
output a PI. Look at its location in the xsl file, it's outside all templates.
Ah, you're right, of course. With that fix, it works. My bad. Thanks.
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: