Odd error at end of transform
Posted: Fri Apr 22, 2011 2:37 am
I added a section to my style sheet to output multiple documents from a single input document, to create an epub or mobi style ebook output.
using a for-each loop calling result-document for every chapter
<xsl:result-document href="{$filename}" format="xhtml">
.....
</xsl:result-document>
I now get this at the end of the transform
SystemID: /home/scott/workspace/books_changes2/books/sh-tei.xml_xslt_cascade
Engine name: Saxon-EE 9.3.0.4
Severity: fatal
Description: Content is not allowed in prolog.
Start location: 1:39
URL: http://www.saxonica.com/documentation/j ... l#SXXP0003
It appears that the book is created successfully, but I hate having some unknown waiting around to bite me later.
here is the complete template that I added
The location of 1:39 doesn't make alot of sense to me?
using a for-each loop calling result-document for every chapter
<xsl:result-document href="{$filename}" format="xhtml">
.....
</xsl:result-document>
I now get this at the end of the transform
SystemID: /home/scott/workspace/books_changes2/books/sh-tei.xml_xslt_cascade
Engine name: Saxon-EE 9.3.0.4
Severity: fatal
Description: Content is not allowed in prolog.
Start location: 1:39
URL: http://www.saxonica.com/documentation/j ... l#SXXP0003
It appears that the book is created successfully, but I hate having some unknown waiting around to bite me later.
here is the complete template that I added
Code: Select all
<xsl:template name="genEBOOK">
<xsl:param name="context"/>
<xsl:for-each select=" $context/tei:text/tei:front | $context/tei:text/tei:body/descendant::tei:div[@type='part' or @type='chapter']">
<xsl:variable name="nodeName" select="if (name(.) = 'front') then 'front' else concat(@type,@n)"/>
<xsl:variable name="filename" select="concat($ebook, '_', $title[1], '_', $nodeName, '.html')"/>
<xsl:value-of select="$filename"/>
<xsl:result-document href="{$filename}" format="xhtml">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta>
<title> <xsl:value-of select="$title"></xsl:value-of></title>
<link rel="stylesheet" href="csps.css" type="text/css" charset="utf-8"></link>
</head>
<body>
<xsl:choose>
<xsl:when test="$production='no'">
<div id="proof-book-content">
<div class="build-number">build number: <xsl:value-of select="$buildNumber"/></div>
<div class="build-time"> build time: <xsl:value-of select="$buildTimestamp"/></div>
<xsl:apply-templates select="."/>
</div>
</xsl:when>
<xsl:otherwise>
<div id="proof-book-content">
<xsl:choose>
<xsl:when test="name(.) = 'front'">
<xsl:apply-templates select="."/>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="." mode="ebook"/>
</xsl:otherwise>
</xsl:choose>
</div>
</xsl:otherwise>
</xsl:choose>
</body>
</html>
</xsl:result-document>
</xsl:for-each>
</xsl:template>