This is the mail archive of the docbook-apps@lists.oasis-open.org mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: filesystem layout and location of imagedata wit hthe docbook2html script


My customization layer (my-htmlhelp-common.xsl) includes the modified
template below. It strips off everything but the file name from the graphic
entity URI. This is what gets coded in the IMG SRC of the HTML output. 

By itself, this result means that the HTML Help compiler looks for the
graphic in the same directory as the HTML files. However, if you also
generate a path for each graphic in the .hhp [FILES] section, the HTML Help
compiler can find the graphic anywhere. 

Denis


<xsl:template name="mediaobject.filename">

<!-- This template called by html.graphics.xsl. 
Do not generate full URI of graphic entity! This hardcodes link in HTML,
makes help system completely unportable. Instead, generate just the file 
name here.
-->

  <xsl:param name="object"></xsl:param>

  <xsl:variable name="data" select="$object/videodata
                                    |$object/imagedata
                                    |$object/audiodata
                                    |$object"/>

  <xsl:variable name="filename">
    <xsl:choose>
      <xsl:when test="$data[@fileref]">
        <xsl:value-of select="$data/@fileref"/>
      </xsl:when>
      <xsl:when test="$data[@entityref]">
<!-- cut
     <xsl:value-of select="unparsed-entity-uri($data/@entityref)"/>
 -->
<!-- add -->
        <xsl:call-template name="filename-basename">
          <xsl:with-param name="filename">
			     <xsl:value-of
select="unparsed-entity-uri($data/@entityref)"/>
          </xsl:with-param>
        </xsl:call-template>
<!-- end add -->

      </xsl:when>
      <xsl:otherwise></xsl:otherwise>
    </xsl:choose>
  </xsl:variable>

  <xsl:variable name="has.ext" select="contains($filename, '.') != ''"/>

  <xsl:variable name="ext">
    <xsl:choose>
      <xsl:when test="contains($filename, '.')">
        <xsl:call-template name="filename-extension">
          <xsl:with-param name="filename" select="$filename"/>
        </xsl:call-template>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="$graphic.default.extension"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:variable>

  <xsl:variable name="graphic.ext">
    <xsl:call-template name="is.graphic.extension">
      <xsl:with-param name="ext" select="$ext"/>
    </xsl:call-template>
  </xsl:variable>

  <xsl:choose>
    <xsl:when test="not($has.ext)">
      <xsl:choose>
        <xsl:when test="$ext != ''">
          <xsl:value-of select="$filename"/>
          <xsl:text>.</xsl:text>
          <xsl:value-of select="$ext"/>
        </xsl:when>
        <xsl:otherwise>
					<xsl:value-of select="$filename"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:when>
    <xsl:when test="not($graphic.ext)">
      <xsl:choose>
        <xsl:when test="$graphic.default.extension != ''">
          <xsl:value-of select="$filename"/>
          <xsl:text>.</xsl:text>
          <xsl:value-of select="$graphic.default.extension"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="$filename"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:when>
    <xsl:otherwise>
      <xsl:value-of select="$filename"/>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>

-----Original Message-----
From: Norman Walsh [mailto:ndw@nwalsh.com]
Sent: Tuesday, October 02, 2001 8:08 AM
To: docbook-apps@lists.oasis-open.org
Subject: Re: DOCBOOK-APPS: filesystem layout and location of imagedata
with the docbook2html script


/ Matthew Kennedy <mkennedy@opushealthcare.com> was heard to say:
| Is this the right solution or is it actually possible to have an
| imagedata fileref relative to an entity ref, relative to a base entity
| ref?

You'll have to do a little bit of tinkering, but you can get the
result you want wit entityref. By default, entityref will give you
absolute URLs to the images, but if you modify the
template/construction rule that produces them, you can "trim off" the
prefix.

I probably ought to make that a standard feature.

                                        Be seeing you,
                                          norm

-- 
Norman Walsh <ndw@nwalsh.com>      | ...it is significant that we are
http://www.oasis-open.org/docbook/ | called the 'information society'
Chair, DocBook Technical Committee | -- not the thinking society, not
                                   | the deliberative society, not the
                                   | society of reason and
                                   | rationality.--Lloyd Morrisett

----------------------------------------------------------------
To subscribe or unsubscribe from this elist use the subscription
manager: <http://lists.oasis-open.org/ob/adm.pl>

----------------------------------------------------------------
To subscribe or unsubscribe from this elist use the subscription
manager: <http://lists.oasis-open.org/ob/adm.pl>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]