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 6711959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:12:12+00:00 2026-05-26T08:12:12+00:00

I am using DITA OT for transforming the XML into xhtml. My xsl looks

  • 0

I am using DITA OT for transforming the XML into xhtml. My xsl looks like

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE some_name [ 
<!ENTITY nbsp "&#160;"> 
]>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 xmlns:saxon="http://icl.com/saxon" extension-element-prefixes="saxon">


 <xsl:import href="../map2xhtmtoc.xsl"/>
 <!--<xsl:import href="result-doc.xsl"/>-->
 <!--<xsl:import href="custom-ecollege-dita2xhtml.xsl"/>-->
 <xsl:output name="html" method="html" indent="yes" encoding="UTF-8"/>

 <!-- Define a newline character -->
 <xsl:variable name="newline">
  <xsl:text>
  </xsl:text>
 </xsl:variable>

 <xsl:template match="/">
    <html>
    <head>
      <body>
          <xsl:apply-templates select="myProduct"/>
      </body>
    </head>
    </html>
 </xsl:template>
 <!--other templates goes here-->
 <div class="floatRight"/>
 <div class="headerSeparator">
  <xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
 </div>
 </xsl:template>

 </xsl:stylesheet>

Now If I tried to execute this xsl against my xml for xhtml transformation using DITA OT jar cmd.

java -jar .\lib\dost.jar /i:samples/mycompany/myContent/myContent.ditamap /transtype:xhtml /xsl:xsl/mycompany/custom-map2xhtml.xsl

After executing the above command, I am getting the following error.

[xslt] D:\DITA-OT1.5.2\xsl\mycompany\custom-map2xhtm.xsl:21: Fatal Error! When 'standalone' or 'doctype-system' is specified, the document must be well-formed; but this document contains a top-level text node
[xslt] Failed to process null

Am breaking my head to find out why this error is occuring.

Thanks.

  • 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-26T08:12:13+00:00Added an answer on May 26, 2026 at 8:12 am
    this document contains a top-level text node
    

    Can you show us the end of the XSLT stylesheet? Is there some text after the final </xsl:stylesheet>? That would cause this error.

    Update

    As Dimitre pointed out, the <xsl:template> start/end tags are unbalanced, so unless you’re only showing part of your XSLT, that has to be fixed.

    However, I agree with @Tim C that you probably don’t really want a DOCTYPE declaration at all in your XSLT. You’re not trying to use the &nbsp; entity in the stylesheet, you’re just trying to emit one. So if you removed the DOCTYPE statement from your stylesheet, you would lose nothing.

    Moreover, contra @Tim, there is no need for a DOCTYPE to declare the nbsp entity in the output HTML, because it’s already predefined in HTML.

    Finally, I would differ with @Tim on the method for outputting a non-breaking space in the HTML. Disable-output-escaping is almost always the wrong approach, and is due to a lack of understanding of how parsing and serialization work. The easiest way to output a non-breaking space character in XSLT is to use a numeric entity directly:

    <div class="headerSeparator">&#160;</div>
    

    This will output a non-breaking space.

    “But,” you say, “I want it to output &nbsp;!”

    That may happen; when output-method=”html”, serialization may use the character entities built in to HTML to express characters like this. Or the serialization could use &#160; or simply embed a non-breaking space character directly. All are legal HTML, and all are equivalent. The question for you, then, is why do you want it serialized as &nbsp; as opposed to some other equivalent?

    If I’ve misunderstood what you’re trying to do, please explain further, where you want &nbsp; to appear, and why that particular form matters.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

we have a DITA XML application that produces on the fly xhtml and when
Using online interfaces to a version control system is a nice way to have
Using preview 4 of ASP.NET MVC Code like: <%= Html.CheckBox( myCheckBox, Click Here, True,
Using Rails 3.2.0 with haml and sass: I Would like to link an external
My project requires me to convert DITA to nroff, but the toolkit I'm using
Using mercurial, I've run into an odd problem where a line from one committer
Using Entity Framework CodeFirst, how do I create a created datetime column that gets
first of, I don't know much about XSL. I am using a app called
Using CRM 4, I have an entity form that contains a tab with an
Using JAXB in Java it is easy to generate from a xml schema file

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.