Closed Bug 152046 Opened 22 years ago Closed 22 years ago

Suspect injection of whitespace within <td> tags during XSLT transformation

Categories

(Core :: XSLT, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 130161

People

(Reporter: mozilla_dev, Assigned: peterv)

Details

Attachments

(4 files, 2 obsolete files)

The xslt.xml and test-xslt.xml code below should produce HTML similar to that in
test-xslt.html which is also appended below. The resulting page in both cases
should contain the 'OpeningPictTop.jpg' image twice without any space inbetween
them. If you view the HTML file in Mozilla the result is correct. If you view
the tset-xslt.xml file you will see that there is whitespace between the images.
Because I can't view the HTML output from Mozilla's XSLT engine, I can only
guess that the closing </td> tag has been wrapped to a new line. This should not
be the case since 'indent' is set to "no" in the <xsl:output> tag.

----------------------------------- xslt.xml ----------------------------------

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <!-- Output definition -->
    <xsl:output 
        method="html"
        indent="no"
        encoding="iso-8859-1"
        doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"/>


    <!-- Main template -->
    <xsl:template match="/">
    <html>
        <head>
            <title>test-xslt</title>
        </head>
        <body>        
            <table cellpadding="0" cellspacing="0" border="0">
                <tr><td><img
src="http://www.ibink.com/wedding/images/OpeningPictTop.jpg" alt=""
border="0"/></td></tr>
                <tr><td><img
src="http://www.ibink.com/wedding/images/OpeningPictTop.jpg" alt=""
border="0"/></td></tr>
            </table>
        </body>
    </html>
    </xsl:template>
</xsl:stylesheet>

----------------------------------- test-xslt.xml -------------------------------

<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet href="xslt.xml" type="text/xsl"?>
<rootNode/>

----------------------------------- test-xslt.html ------------------------------

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <title>test-xslt</title>
    </head>
    <body>
        <table cellpadding="0" cellspacing="0" border="0">
            <tr><td><img
src="http://www.ibink.com/wedding/images/OpeningPictTop.jpg" alt=""
border="0"></td></tr>
            <tr><td><img
src="http://www.ibink.com/wedding/images/OpeningPictTop.jpg" alt=""
border="0"></td></tr>
        </table>
    </body>
</html>
This file is also appended in body of bug report
This file is also appended in body of bug report
This file is also appended in body of bug report
Attached file test-xslt.xml (obsolete) —
Stylesheet reference points directly to the stylesheet attachement
Fixed entity encoding..
Attachment #87802 - Attachment is obsolete: true
Attachment #87803 - Attachment mime type: text/xml → text/html
Attachment #87799 - Attachment description: xslt stylesheet demonstrating bug → xslt.xml -- xslt stylesheet demonstrating bug
Attachment #87800 - Attachment description: This is a simple XML doc which includes xslt.xml → test-xslt.xml -- This is a simple XML doc which includes xslt.xml
Attachment #87801 - Attachment description: Correct HTML result of XSLT transform → test-xslt.html -- Correct HTML result of XSLT transform
Comment on attachment 87803 [details]
serverside-test-xslt.xml -- Similar to test-xslt.xml put includes stylesheet off of Bugzilla server

The Bugzilla server appears to do the XSLT transform on the server (rather than
on the client). This page displays correctly :-)
Attachment #87803 - Attachment description: test-xslt.xml → serverside-test-xslt.xml -- Similar to test-xslt.xml put includes stylesheet off of Bugzilla server
Upload the correct file this time..... Uploaded the HTML file by mistake last
time and though the transform was happening on the server. Ooops....
Attachment #87803 - Attachment is obsolete: true
Attachment #87804 - Attachment description: test-xslt.xml (Bugzilla stylesheet ref) → test-xslt.xml (stylesheet points to Bugzilla attachment for easy viewing)
Attachment #87804 - Attachment description: test-xslt.xml (stylesheet points to Bugzilla attachment for easy viewing) → test-xslt.xml (stylesheet points to Bugzilla attachment 'xslt.xml' for easy viewing)
Attachment #87800 - Attachment description: test-xslt.xml -- This is a simple XML doc which includes xslt.xml → test-xslt.xml -- This is a simple XML doc which includes xslt.xml which is assumed to be in the same directory as this file
Attachment #87800 - Attachment description: test-xslt.xml -- This is a simple XML doc which includes xslt.xml which is assumed to be in the same directory as this file → test-xslt.xml -- A simple XML doc which includes xslt.xml from the same directory as this file
Guessing you're just running into the "We always generate XHTML" bug. Also note
that <xsl:output indent="no"/> has no effect since we don't serialize the tree
and that you can look at the output of the transformation with the DOM Inspector.

*** This bug has been marked as a duplicate of 130161 ***
Status: UNCONFIRMED → RESOLVED
Closed: 22 years ago
Resolution: --- → DUPLICATE
this is really 'bug' 22274. The html triggers quirks mode, the xhtml result not.
Even if we output html, I'm not sure that we'll end up in the right quirks mode.
IMNSHO we should never trigger quirks mode for XSLT output. Quirks mode exists 
so that we render old pages correctly, and XSLT-pages are obviously newly 
created so there is no reason for people to not stick to standards.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: