Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6007671
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:42:50+00:00 2026-05-23T01:42:50+00:00

Possible Duplicate: Set HTML5 doctype with XSLT I’m new to xslt and I’m trying

  • 0

Possible Duplicate:
Set HTML5 doctype with XSLT

I’m new to xslt and I’m trying to produce an HTML 5 document.

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

<xsl:template match="/">
  <!DOCTYPE html>

and Firefox gives me the error

"XML Parsing Error: not well-formed
Location: file:///E:/XSLT-XML-Shema/shipping-transform.xsl
Line Number 6, Column 4: <!DOCTYPE html>

If it’s just <html> it works fine. How do I fix this and why does it happen?

–EDIT–

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" doctype-system="about:legacy-compact" />
<xsl:template match="/">
        <!DOCTYPE html>

        <head>
                <meta charset="utf-8" />
            <title>Sample Corporation #1</title>
            </head>
            <body>
            Hello this is a test<br />
            Goodbye!
            </body>
            </html>
</xsl:template>

</xsl:stylesheet>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T01:42:51+00:00Added an answer on May 23, 2026 at 1:42 am

    If you want absolutely the contracted form, your only choice is the disable-output-escaping of xsl:text as linked in the comments above. I think this is a bit dirty, and more, you have to indicate it within a template:

    <xsl:template match="/">
        <xsl:text disable-output-escaping="yes">&lt;!DOCTYPE html&gt;</xsl:text>
    </xsl:template>
    

    Alternative cleaner solution, W3C defines for HTML5 a specific DOCTYPE legacy string that can be used by HTML generators which can’t display the doctype in the shorter format. So, to stay with pure XSLT you can use:

    <xsl:stylesheet version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    
        <xsl:output method="html" doctype-system="about:legacy-compat" />
    
        <xsl:template match="/">
            <html>
                <head>
                    <meta charset="utf-8" />
                    <title>Sample Corporation #1</title>
                </head>
                <body>
                    Hello this is a test<br />
                    Goodbye!
                </body>
            </html>
        </xsl:template>
    
    </xsl:stylesheet>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: HTML5 form required attribute. Set custom validation message? in HTML 5 form
Possible Duplicate: Android Button: set onClick background image change with XML? I need that
Possible Duplicate: Using jQuery to control HTML5 <audio> volume I have a html audio
Possible Duplicate: How do I set an HTML class attribute in Markdown? In my
Possible Duplicate: HTML5 form required attribute. Set custom validation message? Simple_form has an automatic
Possible Duplicate: table cell width issue I have a table set up as <html>
Possible Duplicate: Should global css styles be set on the html element or the
Possible Duplicate: Is it OK to style the <html> tag? Is correct to set
Possible Duplicate: Change an element's CSS class with JavaScript I'm trying to set div's
Possible Duplicate: Set Locale programatically I would like to create an english/spanish option choice

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.