Setting XSL doctype
Asked Answered
I

2

1

I have an issue viewing an application in IE8+... Specifically, in IE9, when opening developer tools, its seems IE7 Standards is set as Document Mode.. Upon viewing source, i think the issue is with my doctype displaying as:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

Looking at my code, here is how my doctype is set:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [
  <!ENTITY nbsp "&#160;">
]>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html" version="4.01" doctype-public="-//W3C//DTD HTML 4.01//EN" doctype-system="http://www.w3.org/TR/html4/strict.dtd" indent="yes"/>

How can i modify this to <doctype html>

Thanks

UPDATE:

Looking through the code further, within the:

<xsl:template match="/">

section, there is no meta settings.

Indecisive answered 10/3, 2014 at 13:35 Comment(2)
I may be misreading or forgetting a lot of stuff but it looks like you are using HTML when you should be using XHTML but XHTML does not work in IE<9.Baxter
@Baxter - Thanks, i guess what my issue is then, why when opening the application in IE9.. Is the Document Mode set to IE7?Indecisive
S
1

In short, you can't. <!DOCTYPE html> is (deliberately by the HTML5 spec) no valid XML doctype (and no valid SGML, too, which HTML 4 was).

The HTML5 spec dictates this doctype, instead:

<!DOCTYPE html SYSTEM "about:legacy-compat">

You can generate it with this output:

<xsl:output method="xml" doctype-system="about:legacy-compat"/>

However, when the XSLT processor wants to process/validate the system identifier, it will fail. AFAIK, it should work in MSXML.

Signboard answered 10/3, 2014 at 14:19 Comment(2)
thanks for the advice, i guess what my issue is then, why when opening the application in IE9.. Is the Document Mode set to IE7?Indecisive
Do you have any X-UA-Compatible headers (either in the HTML or the HTTP response)?Signboard
W
1

I use this code:

<xsl:text disable-output-escaping='yes' >&#x3c;!DOCTYPE html&#x3e;&#xA;</xsl:text>
<html>

This generates:

<!DOCTYPE html>
<html>

I know no other way... :-(

Weatherbeaten answered 29/6, 2023 at 18:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.