[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Error message saying doc is not well formed, has >

Subject: Re: Error message saying doc is not well formed, has >1 top level element
From: Michael Kay <mike@xxxxxxxxxxxx>
Date: Wed, 04 May 2011 10:10:51 +0100
Re:  Error message saying doc is not well formed
Two observations:

(a) it doesn't look like a Saxon error message. That could be because the DITA toolkit is doing its own message formatting, or it could be because it comes from somewhere other than Saxon. It would be useful to know your processing pipeline, e.g. if the result tree is being serialized and then fed into an XML parser, the error could conceivably relate to the result document, and the point at which it is reported could be random because of output buffering. However, unless you're doing this, I wouldn't expect to see this error reported on a result document.

(b) Apart from that, I fear there isn't enough information here for us to debug it for your. As my grandmother used to say, if you can't find something after trying hard, it's because you're looking in the wrong place.

Michael Kay

On 04/05/2011 00:26, Steve Fogel wrote:
Hi, all.

I'm getting an error message from Saxon (from the DITA Open Toolkit) that I don't understand. It's complaining about a template that has worked fine in another situation and now, when plugged into a new set of templates, is generating the following message:

(path)/infodev2htmtoc.xsl:86: Fatal Error! When 'standalone' or 'doctype-system' is specified, the document must be well-formed; but this document contains more than one top-level element"

Odd thing is, in addition to the fact that this stylesheet produced well-formed output when used elsewhere, line 86 seems to have nothing to do with anything.

Can anyone suggest what might be happening? It's a long stylesheet, and the first part of the code follows. Line 86 is indicated by preceding asterisks (***). The entry point is the template "generate-toc". There are a vast number of<xsl:output> declarations throughout the code that includes this stylesheet, but this template outputs the main result tree, and the only output declarations that mention doctype-system are named ones, AFAIK.



<?xml version="1.0" encoding="UTF-8"?>
<!-- ********** Oracle customizations to XHTML TOC page Copyright (c) Oracle Corporation
      by Steve Fogel and Colin McGregor *********** -->

<xsl:stylesheet version="1.0" xmlns="http://www.w3.org/1999/xhtml"
     exclude-result-prefixes="java xs">

         <!-- Following commented out lines required when this file used with HTML1 -->
<!--<xsl:output method="html" indent="yes" encoding="UTF-8" omit-xml-declaration="yes"/>
         <xsl:include href="id_headHeaderFooter.xsl"/>    -->

   <!-- params added for index link creation. can be passed in via xhtmlindex plugin cmcgrego 3/17/2011 -->
   <xsl:param name="INDEXFILEBASE" select="'index'"/>  <!-- base name for index file, without the ext. can be set in ant -->
   <xsl:param name="INDEXOUTDIR" select="'id_topic/'" />  <!-- index output directory relative to toc.htm -->

     <!-- Setup the HTML wrapper for the table of contents -->
     <xsl:template name="generate-toc">
         <xsl:message>****** Generating DARB-like XHTML TOC ********</xsl:message>
         <html xml:lang="en" lang="en"><xsl:value-of select="$newline"/>
             <head><xsl:value-of select="$newline"/>
                 <!-- initial meta information -->
                 <xsl:call-template name="generateCssLinks"/>   <!-- Generate links to CSS files -->
                 <xsl:call-template name="generateMapTitle"/>  <!-- Generate the<title>  element -->
                 <xsl:call-template name="gen-user-head" />     <!-- include user's XSL HEAD processing here -->
             </head><xsl:value-of select="$newline"/>

<!--<xsl:if test="string-length($OUTPUTCLASS)&gt; 0">
                     <xsl:attribute name="class">
                         <xsl:value-of select="$OUTPUTCLASS"/>
                 <xsl:value-of select="$newline"/>
             </body><xsl:value-of select="$newline"/>

     <xsl:template name="generateMapTitle">
         <!-- Title processing - special handling for short descriptions -->
         <xsl:if test="/*[contains(@class,' map/map ')]">
                 <xsl:call-template name="getString">
                     <xsl:with-param name="stringName" select="'TOC'"/>  <!-- "Table of Contents" -->
             <xsl:value-of select="$newline"/>

<!-- Generate link to CSS --> <!-- Can't link to commonltr.css or commonrtl.css because we don't know what language the map is in. --> <!-- **** Oracle: add link to blafdoc.css --> <xsl:template name="generateCssLinks"> <xsl:variable name="urltest"> <xsl:call-template name="url-string"> <xsl:with-param name="urltext"> <xsl:value-of select="concat($CSSPATH,$CSS)"/> </xsl:with-param> </xsl:call-template> </xsl:variable> <xsl:if test="string-length($CSS)>0"> <xsl:choose> <xsl:when test="$urltest='url'"> <link rel="stylesheet" type="text/css" href="{$CSSPATH}{$CSS}" /> </xsl:when> <xsl:otherwise> <link rel="stylesheet" type="text/css" href="{$PATH2PROJ}{$CSSPATH}{$CSS}" /> </xsl:otherwise> </xsl:choose><xsl:value-of select="$newline"/> </xsl:if> <link rel="stylesheet" href="../../dcommon/css/blafdoc.css" title="Oracle BLAFDoc" type="text/css" /><xsl:value-of select="$newline"/> </xsl:template>

<!-- Process the map --> <xsl:template match="/*[contains(@class, ' map/map ')]"> <xsl:param name="pathFromMaplist"/> <xsl:if test=".//*[contains(@class, ' map/topicref ')][not(@toc='no')][not(@processing-role='resource-only')]"> <xsl:call-template name="gen-user-header"/> <div class="ind"> ***line 86**<xsl:value-of select="$newline"/> <h1 class="toc"> <xsl:call-template name="getString"> <xsl:with-param name="stringName" select="'Contents'"/> </xsl:call-template> </h1> <xsl:value-of select="$newline"/>

                 <!-- Insert title/copyright page  -->
                 <xsl:call-template name="generateTitleLink" />

                 <!-- Topics -->
                 <xsl:apply-templates select="*[contains(@class, ' map/topicref ')]">
                     <xsl:with-param name="pathFromMaplist" select="$pathFromMaplist"/>

                 <!--Call-template Insertion here for generating index link. cmcgrego 3/17/2011 -->
                 <xsl:call-template name="generateIndexLink"/>
       <xsl:value-of select="$newline"/>
       <xsl:call-template name="gen-user-footer"/>

... more...

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.