I'm trying to output content before the root HTML node in a DITA -> XHTML transformation. I located the XSLT section from dita2htmlImpl.xsl, where the <html> element is generated, but entering any text content before it produces the following error:
Code: Select all
System ID: /Applications/oxygen/frameworks/dita/DITA-OT2.x/plugins/org.mycashflow.xhtml.docs/faq-question.dita
Scenario: DITA XHTML MCF
Input file: /Applications/oxygen/frameworks/dita/DITA-OT2.x/plugins/org.mycashflow.xhtml.docs/faq-question.dita
Engine name: DITA-OT
Severity: fatal
Description: When 'standalone' or 'doctype-system' is specified, the document must be well-formed; but this document contains a top-level text node
Start location: 40:0
Code: Select all
<!-- Matches /dita or a root topic -->
<xsl:template match="*" mode="root_element" name="root_element">
<xsl:call-template name="chapter-setup"/>
</xsl:template>
<xsl:template name="chapter-setup">
<!-- This causes problems. -->
<xsl:variable name="metafield">
<xsl:value-of select="topic/element/@attribute"/>
</xsl:variable>
TEXT and {$metafield}
<html>
<xsl:call-template name="setTopicLanguage"/>
<xsl:value-of select="$newline"/>
<xsl:call-template name="chapterHead"/>
<xsl:call-template name="chapterBody"/>
</html>
</xsl:template>