]> granicus.if.org Git - docbook-dsssl/commitdiff
Updated mediaobject selection code that better uses roles (when available); based...
authorKeith Fahlgren <abdelazer@users.sourceforge.net>
Thu, 15 Jul 2010 05:28:28 +0000 (05:28 +0000)
committerKeith Fahlgren <abdelazer@users.sourceforge.net>
Thu, 15 Jul 2010 05:28:28 +0000 (05:28 +0000)
xsl/epub/docbook.xsl

index 9cfbfa13f518e1ba45749dfe9829231ad4808906..39d87c27f4066e5fa7d5180d3b43b6326292895f 100644 (file)
                        mediaobjectco|
                        inlinemediaobject" 
                 mode="opf.manifest">
+
+    <xsl:variable name="olist" select="imageobject|imageobjectco                      |videoobject|audioobject                      |textobject"/>
+
+    <xsl:variable name="object.index">
+      <xsl:call-template name="select.mediaobject.index">
+        <xsl:with-param name="olist" select="$olist"/>
+        <xsl:with-param name="count" select="1"/>
+      </xsl:call-template>
+    </xsl:variable>
+
+    <xsl:variable name="object" select="$olist[position() = $object.index]"/>
+
     <xsl:choose>
-      <xsl:when test="imageobject/imagedata[@format = 'GIF' or 
-                                            @format = 'GIF87a' or 
-                                            @format = 'GIF89a' or 
-                                            @format = 'JPEG' or 
-                                            @format = 'JPG' or 
-                                            @format = 'PNG' or 
-                                            @format = 'SVG']">
-        <xsl:apply-templates select="imageobject[imagedata[@format = 'GIF' or 
-                                                           @format = 'GIF87a' or 
-                                                           @format = 'GIF89a' or 
-                                                           @format = 'JPEG' or 
-                                                           @format = 'JPG' or 
-                                                           @format = 'PNG' or 
-                                                           @format = 'SVG']][1]/imagedata"
+      <xsl:when test="$object/descendant::imagedata[@format = 'GIF' or 
+                                                    @format = 'GIF87a' or 
+                                                    @format = 'GIF89a' or 
+                                                    @format = 'JPEG' or 
+                                                    @format = 'JPG' or 
+                                                    @format = 'PNG' or 
+                                                    @format = 'SVG']">
+        <xsl:apply-templates select="$object[descendant::imagedata[@format = 'GIF' or 
+                                                                   @format = 'GIF87a' or 
+                                                                   @format = 'GIF89a' or 
+                                                                   @format = 'JPEG' or 
+                                                                   @format = 'JPG' or 
+                                                                   @format = 'PNG' or 
+                                                                   @format = 'SVG']][1]/imagedata"
                              mode="opf.manifest"/>              
       </xsl:when>
       <xsl:otherwise>
-        <xsl:apply-templates select="imageobject/imagedata[1]"
+        <xsl:apply-templates select="$object/imagedata[1]"
                              mode="opf.manifest"/>              
       </xsl:otherwise>
     </xsl:choose>