List Info

Thread: Problems with XInclude and images




Problems with XInclude and images
user name
2007-10-15 11:43:12
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-unsubscribelists.oasis-open.org
For additional commands, e-mail: docbook-apps-helplists.oasis-open.org


Re: Problems with XInclude and images
user name
2007-10-16 13:41:34
In your ant build file, what process is being used to
resolve the 
XIncludes?  Is there a separate step that creates a
temporary XML file with 
XIncludes resolved before the stylesheet is applied?  If so,
then you can 
examine the xml:base attributes in it to see if those are
correct.  If they 
are not correct, then the XInclude processor has a problem. 
If they are 
correct, then the stylesheet has a problem.

Bob Stayton
Sagehill Enterprises
DocBook Consulting
bobssagehill.net


----- Original Message ----- 
From: "Tino Schöllhorn" <t.schoellhornplattform-gmbh.de>
To: <docbook-appslists.oasis-open.org>
Sent: Monday, October 15, 2007 9:43 AM
Subject: [docbook-apps] Problems with XInclude and images


> 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-unsubscribelists.oasis-open.org
> For additional commands, e-mail: docbook-apps-helplists.oasis-open.org
>
>
> 



------------------------------------------------------------
---------
To unsubscribe, e-mail: docbook-apps-unsubscribelists.oasis-open.org
For additional commands, e-mail: docbook-apps-helplists.oasis-open.org


Re: Problems with XInclude and images
user name
2007-10-16 14:17:52
Actually, I missed the part in your message where you
mentioned the 
keep.relative.image.uris parameter.  If
keep.relative.image.uris is set to 
1, then each relative path is *not* altered to account for
xml:base 
attributes.  For FO output, that parameter should be set to
zero, except 
under unusual circumstances.  But with it set to 1, your fo
error should 
indicate that first-steps is not in the graphics path at
all.  I'm a little 
confused by that error.

Bob Stayton
Sagehill Enterprises
DocBook Consulting
bobssagehill.net


----- Original Message ----- 
From: "Bob Stayton" <bobssagehill.net>
To: <docbook-appslists.oasis-open.org>; "Tino
Schöllhorn" 
<t.schoellhornplattform-gmbh.de>
Sent: Tuesday, October 16, 2007 11:41 AM
Subject: Re: [docbook-apps] Problems with XInclude and
images


In your ant build file, what process is being used to
resolve the
XIncludes?  Is there a separate step that creates a
temporary XML file with
XIncludes resolved before the stylesheet is applied?  If so,
then you can
examine the xml:base attributes in it to see if those are
correct.  If they
are not correct, then the XInclude processor has a problem. 
If they are
correct, then the stylesheet has a problem.

Bob Stayton
Sagehill Enterprises
DocBook Consulting
bobssagehill.net


----- Original Message ----- 
From: "Tino Schöllhorn" <t.schoellhornplattform-gmbh.de>
To: <docbook-appslists.oasis-open.org>
Sent: Monday, October 15, 2007 9:43 AM
Subject: [docbook-apps] Problems with XInclude and images


> 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-unsubscribelists.oasis-open.org
> For additional commands, e-mail: docbook-apps-helplists.oasis-open.org
>
>
>



------------------------------------------------------------
---------
To unsubscribe, e-mail: docbook-apps-unsubscribelists.oasis-open.org
For additional commands, e-mail: docbook-apps-helplists.oasis-open.org





------------------------------------------------------------
---------
To unsubscribe, e-mail: docbook-apps-unsubscribelists.oasis-open.org
For additional commands, e-mail: docbook-apps-helplists.oasis-open.org


Re: Problems with XInclude and images
user name
2007-10-16 17:47:24
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 xmlnssl=&q
uot;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:ml:ba
se)]"/>
             <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 <supportoxygenxml.com>
X-Accept-Language: en-us, en
To: Ron Catterall <roncatterall.net>
Subject: [Fwd: Re: Sorin:  Fwd: Re: problems with docbook
xsl and the 
docbook-apps
   mailing list]

Return-Path: <supportoxygenxml.com>
X-Original-To: support.internalsync.ro
Delivered-To: support.internalsync.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.3070204oxygenxml.com>
Date: Fri, 16 Sep 2005 15:36:11 +0300
From: Oxygen XML Editor support <supportoxygenxml.com>
User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)
X-Accept-Language: en-us, en
MIME-Version: 1.0
To: Ron Catterall <roncatterall.net>
Cc: Bob Stayton <bobssagehill.net>
Subject: Re: Sorin:  Fwd: Re: problems with docbook xsl and
the docbook-apps
   mailing list
References: <p0623090dbf4fbca08b19[10.0.0.1]> 
<432A8D46.2020302oxygenxml.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-unsubscribelists.oasis-open.org
>For additional commands, e-mail: docbook-apps-helplists.oasis-open.org


-- 
Ron Catterall, Phd, DSc			       	email: roncatterall.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

------------------------------------------------------------
---------
To unsubscribe, e-mail: docbook-apps-unsubscribelists.oasis-open.org
For additional commands, e-mail: docbook-apps-helplists.oasis-open.org


[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )