]> granicus.if.org Git - docbook-dsssl/commitdiff
Fix bug #3558068 where svg property was set on a chunk when
authorBob Stayton <bobs@sagehill.net>
Mon, 22 Oct 2012 22:43:30 +0000 (22:43 +0000)
committerBob Stayton <bobs@sagehill.net>
Mon, 22 Oct 2012 22:43:30 +0000 (22:43 +0000)
it should not be because a mediaobject contained multiple
imageobjects and the svg was not selected for epub output.

xsl/epub3/epub3-element-mods.xsl

index 445146c8f5ffd42b529a64bdf657a1085f3442e1..c24ecc5be59b052a723ce79de9ef4eae3e8f5a34 100644 (file)
@@ -1399,34 +1399,60 @@ article  toc,title,figure,table,example,equation
   <xsl:choose>
     <xsl:when test="$next.chunk">
       <xsl:variable name="this.imagedata"
-                    select="$this.chunk//imagedata"/>
+                    select="$this.chunk//mediaobject"/>
       <xsl:variable name="before.next"
-                    select="$next.chunk/preceding::imagedata"/>
+                    select="$next.chunk/preceding::mediaobject"/>
       
       <!-- select for an SVG imagedata in the intersection of them -->
-      <xsl:variable name="intersection"
+      <xsl:variable name="mediaobject.set"
           select="$this.imagedata[count(.|$before.next) = count($before.next)]"/>
+      <xsl:variable name="svg.imagedata">
+        <xsl:for-each select="$mediaobject.set">
+          <xsl:variable name="olist" select="imageobject[not(@role = 'poster')] |
+                                             imageobjectco"/>
+          <xsl:variable name="mediaobject.index">
+            <xsl:call-template name="select.mediaobject.index">
+              <xsl:with-param name="olist" select="$olist"/>
+            </xsl:call-template>
+          </xsl:variable>
+          <xsl:variable name="object" select="$olist[position() = $mediaobject.index]"/>
+          <xsl:if test="$object/imagedata[contains(
+                      substring(@fileref, string-length(@fileref)-3,4), '.svg')]">
+            <xsl:text>svg</xsl:text>
+          </xsl:if>
+        </xsl:for-each>
+      </xsl:variable>
     
-      <xsl:variable name="svg.imagedata"
-          select="$intersection[contains(
-                      substring(@fileref, string-length(@fileref)-3,4), '.svg')]"/>
-    
-      <xsl:if test="count($svg.imagedata) != 0">
+      <xsl:if test="contains($svg.imagedata, 'svg')">
         <xsl:text>svg</xsl:text>
      </xsl:if>
     </xsl:when>
     <xsl:otherwise>
-      <xsl:variable name="this.imagedata"
-                    select="$this.chunk//imagedata"/>
-      <xsl:variable name="svg.imagedata"
-          select="$this.imagedata[contains(
-                      substring(@fileref, string-length(@fileref)-3,4), '.svg')]"/>
-      <xsl:if test="count($svg.imagedata) != 0">
+      <xsl:variable name="mediaobject.set"
+                    select="$this.chunk//mediaobject"/>
+      <xsl:variable name="svg.imagedata">
+        <xsl:for-each select="$mediaobject.set">
+          <xsl:variable name="olist" select="imageobject[not(@role = 'poster')] |
+                                             imageobjectco"/>
+          <xsl:variable name="mediaobject.index">
+            <xsl:call-template name="select.mediaobject.index">
+              <xsl:with-param name="olist" select="$olist"/>
+            </xsl:call-template>
+          </xsl:variable>
+          <xsl:variable name="object" select="$olist[position() = $mediaobject.index]"/>
+          <xsl:if test="$object/imagedata[contains(
+                      substring(@fileref, string-length(@fileref)-3,4), '.svg')]">
+            <xsl:text>svg</xsl:text>
+          </xsl:if>
+        </xsl:for-each>
+      </xsl:variable>
+    
+      <xsl:if test="contains($svg.imagedata, 'svg')">
         <xsl:text>svg</xsl:text>
      </xsl:if>
-    
     </xsl:otherwise>
   </xsl:choose>
+
 </xsl:template>
 
 <xsl:template name="mathml.property">