From: <abd...@us...> - 2010-07-15 05:28:35
|
Revision: 8723 http://docbook.svn.sourceforge.net/docbook/?rev=8723&view=rev Author: abdelazer Date: 2010-07-15 05:28:28 +0000 (Thu, 15 Jul 2010) Log Message: ----------- Updated mediaobject selection code that better uses roles (when available); based on contributons by Glenn McDonald Modified Paths: -------------- trunk/xsl/epub/docbook.xsl Modified: trunk/xsl/epub/docbook.xsl =================================================================== --- trunk/xsl/epub/docbook.xsl 2010-07-14 16:53:51 UTC (rev 8722) +++ trunk/xsl/epub/docbook.xsl 2010-07-15 05:28:28 UTC (rev 8723) @@ -966,25 +966,37 @@ 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> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |