This is the mail archive of the
docbook-apps@lists.oasis-open.org
mailing list .
Re: No images in HTML Help!?
- From: Jirka Kosek <jirka at kosek dot cz>
- To: Kraa de Simon <Simon dot de dot Kraa at services dot fujitsu dot com>
- Cc: "'docbook-apps at lists dot oasis-open dot org'" <docbook-apps at lists dot oasis-open dot org>
- Date: Mon, 06 May 2002 11:03:19 +0200
- Subject: Re: DOCBOOK-APPS: No images in HTML Help!?
- References: <C1EBEEBBB842D411B4120000949A1F580201A0E4@wwmessd135>
Kraa de Simon wrote:
> Solution 1: use base name in html file and tell HTML Help compiler where the
> file actually is:
>
> <span class="inlinemediaobject">
> <img src="71000.b.0.png">
> </span>
>
> [FILES]
> ../../images/screen/71000.b.0.png
>
> Problem: have to adjust the XSL stylesheets and don't know how...
Try to add following to your customization file. I didn't tested it, but
it should (could;-) work:
<xsl:template name="process.image">
<!-- When this template is called, the current node should be -->
<!-- a graphic, inlinegraphic, imagedata, or videodata. All -->
<!-- those elements have the same set of attributes, so we can -->
<!-- handle them all in one place. -->
<xsl:param name="tag" select="'img'"/>
<xsl:param name="alt"/>
<xsl:param name="longdesc"/>
<xsl:variable name="filename2">
<xsl:choose>
<xsl:when test="local-name(.) = 'graphic'
or local-name(.) = 'inlinegraphic'">
<!-- handle legacy graphic and inlinegraphic by new template -->
<xsl:call-template name="mediaobject.filename">
<xsl:with-param name="object" select="."/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<!-- imagedata, videodata, audiodata -->
<xsl:call-template name="mediaobject.filename">
<xsl:with-param name="object" select=".."/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="filename">
<xsl:call-template name="filename-basename">
<xsl:with-param name="filename" select="$filename2"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="width">
<xsl:choose>
<xsl:when test="@scale"><xsl:value-of
select="@scale"/>%</xsl:when>
<xsl:when test="@width">
<xsl:variable name="w-magnitude">
<xsl:call-template name="length-magnitude">
<xsl:with-param name="length" select="@width"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="w-units">
<xsl:call-template name="length-units">
<xsl:with-param name="length" select="@width"/>
<xsl:with-param name="default.units" select="'px'"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="$w-units = '%'">
<xsl:value-of select="@width"/>
</xsl:when>
<xsl:when test="$w-units = 'cm'">
<xsl:value-of select="round(($w-magnitude div 2.54) *
$pixels.per.inch)"/>
</xsl:when>
<xsl:when test="$w-units = 'mm'">
<xsl:value-of select="round(($w-magnitude div 25.4) *
$pixels.per.inch)"/>
</xsl:when>
<xsl:when test="$w-units = 'in'">
<xsl:value-of select="round($w-magnitude *
$pixels.per.inch)"/>
</xsl:when>
<xsl:when test="$w-units = 'pt'">
<xsl:value-of select="round(($w-magnitude div 72) *
$pixels.per.inch)"/>
</xsl:when>
<xsl:when test="$w-units = 'pc'">
<xsl:value-of select="round(($w-magnitude div 6) *
$pixels.per.inch)"/>
</xsl:when>
<xsl:when test="$w-units = 'px'">
<xsl:value-of select="$w-magnitude"/>
</xsl:when>
<xsl:when test="$w-units = 'em'">
<xsl:message>
<xsl:text>Relative units (ems) are not supported on
widths. </xsl:text>
<xsl:text>Using 12pt/em.</xsl:text>
</xsl:message>
<xsl:value-of select="round((($w-magnitude * 12) div 72) *
$pixels.per.inch)"/>
</xsl:when>
<xsl:otherwise>
<xsl:message>
<xsl:text>Unrecognized unit given for width: </xsl:text>
<xsl:value-of select="$w-units"/>
<xsl:text>. Treating as px.</xsl:text>
<xsl:value-of select="$w-magnitude"/>
</xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="height">
<xsl:choose>
<xsl:when test="@scale"></xsl:when>
<xsl:when test="@depth">
<xsl:variable name="d-magnitude">
<xsl:call-template name="length-magnitude">
<xsl:with-param name="length" select="@depth"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="d-units">
<xsl:call-template name="length-units">
<xsl:with-param name="length" select="@depth"/>
<xsl:with-param name="default.units" select="'px'"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="$d-units = '%'">
<xsl:value-of select="@depth"/>
</xsl:when>
<xsl:when test="$d-units = 'cm'">
<xsl:value-of select="round(($d-magnitude div 2.54) *
$pixels.per.inch)"/>
</xsl:when>
<xsl:when test="$d-units = 'mm'">
<xsl:value-of select="round(($d-magnitude div 25.4) *
$pixels.per.inch)"/>
</xsl:when>
<xsl:when test="$d-units = 'in'">
<xsl:value-of select="round($d-magnitude *
$pixels.per.inch)"/>
</xsl:when>
<xsl:when test="$d-units = 'pt'">
<xsl:value-of select="round(($d-magnitude div 72) *
$pixels.per.inch)"/>
</xsl:when>
<xsl:when test="$d-units = 'pc'">
<xsl:value-of select="round(($d-magnitude div 6) *
$pixels.per.inch)"/>
</xsl:when>
<xsl:when test="$d-units = 'px'">
<xsl:value-of select="$d-magnitude"/>
</xsl:when>
<xsl:when test="$d-units = 'em'">
<xsl:message>
<xsl:text>Relative units (ems) are not supported on
depths. </xsl:text>
<xsl:text>Using 12pt/em.</xsl:text>
</xsl:message>
<xsl:value-of select="round((($d-magnitude * 12) div 72) *
$pixels.per.inch)"/>
</xsl:when>
<xsl:otherwise>
<xsl:message>
<xsl:text>Unrecognized unit given for depth: </xsl:text>
<xsl:value-of select="$d-units"/>
<xsl:text>. Treating as px.</xsl:text>
<xsl:value-of select="$d-magnitude"/>
</xsl:message>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="align">
<xsl:value-of select="@align"/>
</xsl:variable>
<xsl:element name="{$tag}">
<xsl:attribute name="src">
<xsl:value-of select="$filename"/>
</xsl:attribute>
<xsl:if test="$align != ''">
<xsl:attribute name="align">
<xsl:value-of select="$align"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="$height != ''">
<xsl:attribute name="height">
<xsl:value-of select="$height"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="$width != ''">
<xsl:attribute name="width">
<xsl:value-of select="$width"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="$alt != ''">
<xsl:attribute name="alt">
<xsl:value-of select="$alt"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="$longdesc != ''">
<xsl:attribute name="longdesc">
<xsl:value-of select="$longdesc"/>
</xsl:attribute>
</xsl:if>
</xsl:element>
</xsl:template>
> Solution 2: use the following directorystructure:
>
> ./en/htmlhelp/images
> ./en/htmlhelp
>
> and reference the images by ./images intead of ../../images.
>
> <span class="inlinemediaobject">
> <img src="images/screen/71000.b.0.png">
> </span>
>
> Problem: there are certain images that are shared between languages and I
> would like to have to maintain only one copy of them in ../../images instead
> of copying them to all language dirs.
Maybe setting up symlinks to shared directory will also help. But I'm
afraid that this is not possible on Windows box.
Jirka
--
-----------------------------------------------------------------
Jirka Kosek
e-mail: jirka@kosek.cz
http://www.kosek.cz