Re: [docbook-apps] Docbook images/graphics. Where do you keep them?

From
<>
Date
2009-05-14T18:31:05+00:00
ID
Thread
Re: [docbook-apps] Docbook images/graphics. Where do you keep them?
Dave,

 

I have a pretty simple system that assumes a directory structure like
this:

 

xml files

xml files\images

 

1. When I publish FO the PDF lands in "xml files". 

2. When I publish HTML:

-  I set the "output" directory to "xml files\html"

- I copy the images from "xml files\images" to "xml files\html\images" by a
batch file generated by XSLT <see below>

- I copy the Docbook images from where they are to "xml
files\html\images\docbook_images" and point the admon.graphics.path to
"images\docbook_images". As a result the "html" dir tree is portable and can go
anywhere since the paths for the images are relative.

3. I have found out that MSHELP only embeds images that it needs and
not the whole directory.

 

 

Dean

 

 

 

In a message dated 5/14/2009 8:42:33 A.M. Pacific Daylight Time,
 writes:

DeanNelson wrote:
> Dave,
>  
> I do something
  similar also. For HTML generation, I make sure all images 
> (including
  Docbook images) are in one place. This makes Saxon complain 
> about not
  seeing the images, but I resolve that afterwards by copying 
> the
  images to the publishing image directory.

So you 'plan ahead' and only
  have the ready for the website? I.e. not
available for the 'on disk'
  build?

>  
> However, I have a lot of images in my
  directories that may not only be 
> for HTML, because I also produce the
  FO/PDF and MSHELP docs.

I'm on a KISS principle here, using seperate
  xslt for fo and html (
and I guess mshelp, if I ever used it). For fo 
  I just need
the graphics accessible for the fo-pdf build.

 
  Since I
> don't want to copy the "whole mess" I run an XSL template on
  my XML 
> books to output a batch file with the copying instructions as
  to which 
> images are actually needed and leaving the rest of the
  "mess" behind.

Could you tell me a bit more about this please
  Dean?
Filter through the source XML looking for graphics (docbook
  graphics
as well as 'your own'?), then list them out.... then what?
Do
  you copy them (from where unless all relative to the source file?)
to some
  collecting point (or ftp them up to a given target on the
  website?)

 

I use a template file for collecting the images that are used in the book.
It generates a batch file with the files named for copying. Then I run the batch
as the final part of the processing. Since I maintain both Windows and Linux, a
similar one is used for Linux.

 

I also copy the navigation images and the Docbook images in the batch file
that calls this one.

 

 

---------------------

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">

 

    <xsl:output method="text" indent="yes"
doctype-public="-//OASIS//DTD DocBook XML
V4.5//EN"
        doctype-system="http://www.docbook.org/xml/4.5/docbookx.dtd"/>
   
<xsl:strip-space elements="*"/>

 

    <!-- Clear all other text templates
-->
    <xsl:template match="text()"/>

 

    <xsl:template
match="*">
       
<xsl:apply-templates/>
    </xsl:template>

 

    <!-- find all parent sections and dig out images
-->
    <xsl:template
match="imagedata|graphic">
       
<xsl:text>copy
"images\</xsl:text>
       
<xsl:value-of
select="@fileref"/>
       
<xsl:text>"
html\images\"</xsl:text>
       
<xsl:value-of
select="@fileref"/><xsl:text>"
       
</xsl:text>
    </xsl:template>

 

</xsl:stylesheet>
-------------------------

 

>  
> I also keep the filespaths in my
  XML relative which make portability a 
> bit easier.

In the XML
  source? That makes the xslt easier.

This is getting
  interesting!

(I'm starting a write up about it btw, bare bones so
  far)

regards

-- 
Dave Pawson
XSLT XSL-FO
  FAQ.
http://www.dpawson.co.uk

 Recession-proof vacation ideas.  Find free things to do in the U.S.