XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Christos KarrasSubject: html DOCTYPE is ignored in XSLT preview
Author: Christos Karras
Date: 25 Nov 2003 12:48 PM
I have a stylesheet that outputs HTML 4.01 and has a DOCTYPE declaration at the begining:

<xsl:text disable-output-escaping="yes">&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;</xsl:text>

However, this declaration seems to be ignored in the XSLT Preview window. But if I open the generated html file in a web browser, the DOCTYPE is there and the page is rendered correctly.

(When this line is at the begining of an HTML file, it activates Internet Explorer's standards compliant rendering. This can make a huge difference for pages that use CSS positioning because IE6 emulates old IE5 bugs when there is no DOCTYPE declaration.)

By looking at the files generated by Stylus in my Temp directory, I have found that the DOCTYPE declaration becomes enclosed in a SPAN:
<SPAN S_='021E7648 15' X_='0235FB5C FFFFFFFF'><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"></SPAN>

Which makes IE ignore the line.
Would it be possible to fix Stylus so that it won't enclose anything before the <HTML> tag inside <SPAN> tags? Or is there something I could do to workaround this problem?

Postnext
Minollo I.Subject: Re: html DOCTYPE is ignored in XSLT preview
Author: Minollo I.
Date: 25 Nov 2003 01:07 PM
The SPAN elements are used by Stylus to enable backmapping in the preview
window; as the DOCTYPE declaration is being generated as part of a normal
xsl:text instruction, we don't have much flexibility there to understand
that we should skip the backmapping information.

A better way to generate the DOCTYPE declaration would be to add
doctype-public and doctype-system attributes to the xsl:output instruction;
something like:
{xsl:output doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
doctype-system="http://www.w3.org/TR/html4/loose.dtd"}

The generated DOCTYPE declaration won't be disrupted by SPAN elements.

Also, you may turn on the "Preview in external browser" checkbox in the
scenario properties; that will open the HTML result in an external IE
instance, avoiding inclusion of SPAN tags.

Hope this helps,
Minollo

Posttop
Christos KarrasSubject: Re: html DOCTYPE is ignored in XSLT preview
Author: Christos Karras
Date: 25 Nov 2003 01:27 PM
Thanks, I didn't know about
the "doctype-public" and "doctype-system" parameters for xsl:output, I added them to my stylesheet and now I get the correct result in the XSLT preview window

 
Topic Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.