OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [docbook-apps] Problems with XInclude and images


Hi Tino
This sounds a bit like the xml:base problem I had a couple of years 
ago.  See the mail below and the pre-processing xsl step to remove 
duplicate directory names.
Ron

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">
     <!-- default copy template, plus passing over a base parameter -->
     <xsl:template match="node() | @*">
         <xsl:param name="base" select="''"/>
         <xsl:copy>
             <xsl:apply-templates select="node() | @*">
                 <xsl:with-param name="base" select="$base"/>
             </xsl:apply-templates>
         </xsl:copy>
     </xsl:template>
     <!-- handle elements containing xml:base -->
     <xsl:template match="*[@xml:base]">
         <xsl:param name="base" select="''"/>
         <xsl:copy>
             <xsl:apply-templates select="@*[not(self::xml:base)]"/>
             <xsl:attribute name="xml:base">
                 <xsl:choose>
                     <xsl:when test="$base='' or 
not(contains(@xml:base, $base))">
                         <xsl:value-of select="@xml:base"/>
                     </xsl:when>
                     <xsl:otherwise>
                         <xsl:value-of 
select="substring-after(@xml:base, $base)"/>
                     </xsl:otherwise>
                 </xsl:choose>
             </xsl:attribute>
             <xsl:apply-templates select="node()">
                 <xsl:with-param name="base">
                     <xsl:call-template name="getBase">
                         <xsl:with-param name="base" select="@xml:base"/>
                     </xsl:call-template>
                 </xsl:with-param>
             </xsl:apply-templates>
         </xsl:copy>
     </xsl:template>
     <!-- extracts the folder from an xml:base value -->
     <xsl:template name="getBase">
         <xsl:param name="base" select="''"/>
         <xsl:if test="contains($base, '/')">
             <xsl:value-of select="substring-before($base, '/')"/>
             <xsl:text>/</xsl:text>
             <xsl:call-template name="getBase">
                 <xsl:with-param name="base" 
select="substring-after($base, '/')"/>
             </xsl:call-template>
         </xsl:if>
     </xsl:template>
</xsl:stylesheet>

Date: Tue, 20 Sep 2005 10:53:53 +0300
From: Oxygen XML Editor support <support@oxygenxml.com>
X-Accept-Language: en-us, en
To: Ron Catterall <ron@catterall.net>
Subject: [Fwd: Re: Sorin:  Fwd: Re: problems with docbook xsl and the 
docbook-apps
   mailing list]

Return-Path: <support@oxygenxml.com>
X-Original-To: support.internal@sync.ro
Delivered-To: support.internal@sync.ro
Received: from [10.0.0.23] (unknown [10.0.0.23])
	by decebal.sync.ro (Postfix) with ESMTP id ED261604E4;
	Fri, 16 Sep 2005 15:29:19 +0300 (EEST)
Message-ID: <432ABC3B.3070204@oxygenxml.com>
Date: Fri, 16 Sep 2005 15:36:11 +0300
From: Oxygen XML Editor support <support@oxygenxml.com>
User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)
X-Accept-Language: en-us, en
MIME-Version: 1.0
To: Ron Catterall <ron@catterall.net>
Cc: Bob Stayton <bobs@sagehill.net>
Subject: Re: Sorin:  Fwd: Re: problems with docbook xsl and the docbook-apps
   mailing list
References: <p0623090dbf4fbca08b19@[10.0.0.1]> 
<432A8D46.2020302@oxygenxml.com> <p06230910bf505c05e698@[10.0.0.1]>
In-Reply-To: <p06230910bf505c05e698@[10.0.0.1]>
Content-Type: multipart/mixed;
  boundary="------------090701090606070705070002"

Hi Ron,

Please find attached the stylesheet that does the xml:base fixup. 
Basically it copies the document and does a special handling of the 
xml:base, that is if the current xml:base starts with the directory 
specified by the previous xml:base then it removes that directory 
from the current xml:base.
What you need to do is:

1. Use the Configure Transformation Scenario action to open the 
transformation scenarios dialog
2. Choose your DocBook to HTML scenario
3. Use the duplicate button to create a copy of that
4. Copy to clipboard the current value for XSL URL
5. Use the Additional XSLT stylesheets button to show the additional 
XSLT stylesheets dialog
6. Choose Add and paste the URL you copied earlier
7. Choose Ok to close the additional XSLT stylesheets dialog
8. Edit the XSL URL field to point to the fixXMLBase.xsl stylesheet
9. Choose Ok to close the dialog
10. Use this scenario to transform DocBook to HTML

We tried this with your samples and it works ok.

I copied also Bob in case he finds this stylesheet useful for other 
people using XInclude and Xerces.

Best Regards,
George
---------------------------------------------------------------------
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
>Hi,
>
>we are setting up docbook for documenting our project. So far 
>everythings goes well. There is just on issue with which I am 
>struggling: When using images in document parts which are included 
>by "XInclude" the XSLT-Stylesheet seems to apply the xml:base twice!
>
>The project is layouted like this:
>
>main.xml
>|--------first-steps
>|		|-------pictures
>|		|-------first-steps.xml
>
>(and so on)
>
>The picture should be stored in first-steps/pictures. When writing 
>the document "first-steps.xml" we use the following docbook part to 
>include an image:
>
><graphic fileref="pictures/login.jpg"/>
>
>Which works nicely - as long we don't XInclude the first-steps.xml 
>in the main.xml
>
>As I understand one should set the XSLT-Option 
>"keep.relative.image.uris" to "1" so that the xml:base values are 
>applied. When doing so, we get HTML output which is like:
>
><img src=first-steps/first-steps/pictures/login.jpg>
>
>When transforming to PDF output an error occurs that the picture 
>"first-steps/first-steps/pictures/login.jpg" cannot be found.
>
>Obviously the xml:base attribute has been applied twice.
>
>So, what am I missing here? Is there a general error?
>
>I am using docbook-xsl-1.73.2 and Ant 1.7 to generate the documents.
>
>Does someone has an idea what is missing?
>
>In hope for an hint
>Tino
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org
>For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org


-- 
Ron Catterall, Phd, DSc			       	email: ron@catterall.net
Prolongacion de Hidalgo 140				http://catterall.net/
San Felipe del Agua					tel: +52 951 520 1821
Oaxaca      68020	Mexico				fax: +1 530 348 8309


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]