File docbook-xsl-stylesheets-epub3-base.dir.patch of Package docbook-xsl-stylesheets

Index: epub3/epub3-element-mods.xsl
===================================================================
--- epub3/epub3-element-mods.xsl	(revision 9732)
+++ epub3/epub3-element-mods.xsl	(revision 9831)
@@ -49,7 +49,33 @@
 </xsl:param>
 <xsl:param name="generate.manifest" select="0"/>
 <xsl:param name="manifest.in.base.dir" select="1"/>
-<xsl:param name="base.dir" select="'OEBPS/'"/>
+
+<!-- HTML chunk output goes to $base.dir/OEPBS -->
+<xsl:variable name="chunk.base.dir">
+  <xsl:if test="$base.dir != '' and contains($base.dir, $epub.oebps.dir)">
+    <xsl:message terminate="yes">
+      <xsl:text>ERROR: the $base.dir param must not include the </xsl:text>
+      <xsl:value-of select="$epub.oebps.dir"/>
+      <xsl:text> directory in its path. Exiting.</xsl:text>
+    </xsl:message>
+  </xsl:if>
+  <xsl:choose>
+    <xsl:when test="string-length($base.dir) = 0"></xsl:when>
+    <!-- make sure to add trailing slash if omitted by user -->
+    <xsl:when test="substring($base.dir, string-length($base.dir), 1) = '/'">
+      <xsl:value-of select="$base.dir"/>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:value-of select="concat($base.dir, '/')"/>
+    </xsl:otherwise>
+  </xsl:choose>
+  <xsl:value-of select="$epub.oebps.dir"/>
+  <xsl:if test="substring($epub.oebps.dir, string-length($epub.oebps.dir), 1) != '/'">
+    <xsl:text>/</xsl:text>
+  </xsl:if>
+</xsl:variable>
+
+
 <xsl:param name="index.links.to.section" select="0"/>
 
 <!-- Epub does not yet support external links -->
@@ -101,10 +127,10 @@
   name="epub.vocabulary.profile.package">http://www.idpf.org/epub/30/profile/package/</xsl:param>
 <xsl:param name="epub.output.epub.types" select="1"/>
 <xsl:param name="epub.oebps.dir" select="'OEBPS'"/> 
-<xsl:param name="epub.metainf.dir" select="'META-INF/'"/> 
+<xsl:variable name="epub.metainf.dir" select="'META-INF/'"/> 
 <xsl:param name="epub.ncx.filename" select="'toc.ncx'"/> 
-<xsl:param name="epub.mimetype.filename" select="'mimetype'"/> 
-<xsl:param name="epub.mimetype.value" select="'application/epub+zip'"/> 
+<xsl:variable name="epub.mimetype.filename" select="'mimetype'"/> 
+<xsl:variable name="epub.mimetype.value" select="'application/epub+zip'"/> 
 <xsl:param name="epub.container.filename" select="'container.xml'"/> 
 <xsl:param name="epub.package.filename" select="'package.opf'"/> 
 <xsl:param name="epub.cover.filename" select="concat('cover', $html.ext)"/>