You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Olivier MOUGEL <mo...@wanadoo.fr> on 2002/01/03 12:37:59 UTC

external-graphics in xsl and PDF

Hi cocooner

I'm trying to import a jpeg file in a xsl file in order to generate a pdf with beautifull graphics :

I use <fo:external-graphics src="file:../images/file.jpg"/> but it don't works

Have someone a working synthaxis in a xsl sample 

Thank's and Happy new Year 2002 and a lot of brand new euro for european people ;-))

Olivier MOUGEL
Bordeaux - FRANCE


Re: external-graphics in xsl and PDF

Posted by Nicola Ken Barozzi <ba...@nicolaken.com>.
On Saturday, January 05, 2002 , Torsten Curdt wrote:
> So I'm +1 for the servlet context dir as basedir

+1

BTW, I asked some days ago on the fop-dev list if this is the only way of
setting this parameter, because
in this mail I read:

----- Original Message -----
From: "Keiron Liddle" <ke...@aftexsw.com>
To: <fo...@xml.apache.org>
Sent: Thursday, January 03, 2002 9:18 AM
Subject: Re: image protocal in Fop on unix


> The example in "docs/examples/fo/images.fo has relative urls for images
> (can't really have absolute urls for cvs and distributions!).
> The images are loaded properly.
>
> Of course if you are embedding fop then you will need to set the basedir
> via the config.

Haven't recieved a reply yet. So I supposed that the config it this static
stuff only.
In fact, looking in the Options class in FOP I found:

        // set base directory
        String baseDir = Configuration.getStringValue("baseDir");
        if (baseDir == null) {
            try {
                baseDir =
                    new
File(clOptions.getInputFile().getAbsolutePath()).getParentFile().toURL().toE
xternalForm();
                Configuration.put("baseDir", baseDir);
            } catch (Exception e) {}
        }
        if (errorDump) {
            //log.debug("base directory: " + baseDir);
        }

So yes, it's static. :-/

I'm doing a patch for the current proposal, but I got stuck at a seemingly
trivial point.
How do I get the context path from a Serializer?
Is it
      Constants.DEFAULT_CONTEXT_DIR
or
      context.get(Constants.DEFAULT_CONTEXT_DIR)
or
   ((org.apache.cocoon.environment.Context)
      context.get
       (Constants.CONTEXT_ENVIRONMENT_CONTEXT)
     )).getAttribute(Constants.DEFAULT_CONTEXT_DIR)
or
 something-more-deeply-nested ;-)

Heck, how many Contexts are there?

Ken
--
Nicola Ken Barozzi                 xml-cocoon@nicolaken.com

These are the days of miracle and wonder...
          ...so don't cry baby, don't cry...
                                                  Paul Simon


Re: external-graphics in xsl and PDF

Posted by Torsten Curdt <tc...@dff.st>.
On Thu, 3 Jan 2002, Nicola Ken Barozzi wrote:

> > Cool! Will invesitgate further. Maybe we can set the context
> > path for fop processing then!!
> >
> > If you already have more insight in this please give me a direct
> > mail or post to cocoon-dev.
>
> Ok so Configuration is static and here is the relevant code taken from the
> FOP ant task:
>
>    org.apache.fop.configuration.Configuration.put("baseDir",

Hm... that's ugly! So we cannot really change this inside the pipeline
in the serializer setup.

[snip]

> What do you think is better to put as a relative value?
> The problem is that Configuration is static for now, so I can to set the
> base dir to the Constants.DEFAULT_CONTEXT_DIR or to a configured param;
> anyway only one per VM. :-(

exactly ...does not make much sense this way

> I think that the best is a configuration param, so that in the future when
> Configuration is not static anymore we don't break contracts; the fixed conf
> basedir is used for all if present, if not each file is resolved with its
> relative url.
> Comments?

Well, I'm not quite sure if it makes sense to introduce a parameter for
this. It will be deprecated sooner or later anyway (when the fop
configuration is not static anymore).

So I'd propose to set the fop basedir on serializer setup to the servlet
context dir. Although still quite ugly this is half-way. But we should
make clear that this is a interim sollution that will changed sooner
or later. So this should definitly only make it into HEAD.

But it helps...

So I'm +1 for the servlet context dir as basedir
--
Torsten


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Re: external-graphics in xsl and PDF

Posted by Nicola Ken Barozzi <ba...@nicolaken.com>.
I'm crossposting on cocoon-dev and continuing discussion there.
Second list switch in so little time!  :-O

----- Original Message -----
From: "Torsten Curdt" <tc...@dff.st>
To: <co...@xml.apache.org>; "Nicola Ken Barozzi"
<ba...@nicolaken.com>
Sent: Thursday, January 03, 2002 1:53 PM
Subject: Re: external-graphics in xsl and PDF


> Cool! Will invesitgate further. Maybe we can set the context
> path for fop processing then!!
>
> If you already have more insight in this please give me a direct
> mail or post to cocoon-dev.

Ok so Configuration is static and here is the relevant code taken from the
FOP ant task:

   org.apache.fop.configuration.Configuration.put("baseDir",

task.getFofile().getParentFile().toURL().toExternalForm());

It should be set in the Serializer setup.
What do you think is better to put as a relative value?
The problem is that Configuration is static for now, so I can to set the
base dir to the Constants.DEFAULT_CONTEXT_DIR or to a configured param;
anyway only one per VM. :-(
I think that the best is a configuration param, so that in the future when
Configuration is not static anymore we don't break contracts; the fixed conf
basedir is used for all if present, if not each file is resolved with its
relative url.
Comments?

Ken
--
Nicola Ken Barozzi                 xml-cocoon@nicolaken.com

These are the days of miracle and wonder...
          ...so don't cry baby, don't cry...
                                                  Paul Simon


> > Below I'm cross-posting a mail taken from fop-dev list.
> >
> > ----- Original Message -----
> > From: "Keiron Liddle" <ke...@aftexsw.com>
> > To: <fo...@xml.apache.org>
> > Sent: Thursday, January 03, 2002 9:18 AM
> > Subject: Re: image protocal in Fop on unix
> >
> >
> > > On 2002.01.02 21:23 "Savino, Matt C" wrote:
> > > > This works for me:
> > > >
> > > > <fo:external-graphic
> > > >
> >
src="file:///usr/local/weblogic/config/isappdev/applications/RVWebApp1/WEB-I
> > > > NF/lib/ClinTrialLogoGreenBig.gif" />
> > > >
> > > > If you figure out how to use a relative path, PLEASE let me know.
> > >
> > > The example in "docs/examples/fo/images.fo has relative urls for
images
> > > (can't really have absolute urls for cvs and distributions!).
> > > The images are loaded properly.
> > >
> > > Of course if you are embedding fop then you will need to set the
basedir
> > > via the config.
>


Re: external-graphics in xsl and PDF

Posted by Nicola Ken Barozzi <ba...@nicolaken.com>.
I'm crossposting on cocoon-dev and continuing discussion there.
Second list switch in so little time!  :-O

----- Original Message -----
From: "Torsten Curdt" <tc...@dff.st>
To: <co...@xml.apache.org>; "Nicola Ken Barozzi"
<ba...@nicolaken.com>
Sent: Thursday, January 03, 2002 1:53 PM
Subject: Re: external-graphics in xsl and PDF


> Cool! Will invesitgate further. Maybe we can set the context
> path for fop processing then!!
>
> If you already have more insight in this please give me a direct
> mail or post to cocoon-dev.

Ok so Configuration is static and here is the relevant code taken from the
FOP ant task:

   org.apache.fop.configuration.Configuration.put("baseDir",

task.getFofile().getParentFile().toURL().toExternalForm());

It should be set in the Serializer setup.
What do you think is better to put as a relative value?
The problem is that Configuration is static for now, so I can to set the
base dir to the Constants.DEFAULT_CONTEXT_DIR or to a configured param;
anyway only one per VM. :-(
I think that the best is a configuration param, so that in the future when
Configuration is not static anymore we don't break contracts; the fixed conf
basedir is used for all if present, if not each file is resolved with its
relative url.
Comments?

Ken
--
Nicola Ken Barozzi                 xml-cocoon@nicolaken.com

These are the days of miracle and wonder...
          ...so don't cry baby, don't cry...
                                                  Paul Simon


> > Below I'm cross-posting a mail taken from fop-dev list.
> >
> > ----- Original Message -----
> > From: "Keiron Liddle" <ke...@aftexsw.com>
> > To: <fo...@xml.apache.org>
> > Sent: Thursday, January 03, 2002 9:18 AM
> > Subject: Re: image protocal in Fop on unix
> >
> >
> > > On 2002.01.02 21:23 "Savino, Matt C" wrote:
> > > > This works for me:
> > > >
> > > > <fo:external-graphic
> > > >
> >
src="file:///usr/local/weblogic/config/isappdev/applications/RVWebApp1/WEB-I
> > > > NF/lib/ClinTrialLogoGreenBig.gif" />
> > > >
> > > > If you figure out how to use a relative path, PLEASE let me know.
> > >
> > > The example in "docs/examples/fo/images.fo has relative urls for
images
> > > (can't really have absolute urls for cvs and distributions!).
> > > The images are loaded properly.
> > >
> > > Of course if you are embedding fop then you will need to set the
basedir
> > > via the config.
>


Re: external-graphics in xsl and PDF

Posted by Torsten Curdt <tc...@dff.st>.
Cool! Will invesitgate further. Maybe we can set the context
path for fop processing then!!

If you already have more insight in this please give me a direct
mail or post to cocoon-dev.

Thanks Nicola! Sounds promising..
--
Torsten

> Below I'm cross-posting a mail taken from fop-dev list.
> --
> Nicola Ken Barozzi                 xml-cocoon@nicolaken.com
>
> These are the days of miracle and wonder...
>           ...so don't cry baby, don't cry...
>                                                   Paul Simon
>
>
> ----- Original Message -----
> From: "Keiron Liddle" <ke...@aftexsw.com>
> To: <fo...@xml.apache.org>
> Sent: Thursday, January 03, 2002 9:18 AM
> Subject: Re: image protocal in Fop on unix
>
>
> > On 2002.01.02 21:23 "Savino, Matt C" wrote:
> > > This works for me:
> > >
> > > <fo:external-graphic
> > >
> src="file:///usr/local/weblogic/config/isappdev/applications/RVWebApp1/WEB-I
> > > NF/lib/ClinTrialLogoGreenBig.gif" />
> > >
> > > If you figure out how to use a relative path, PLEASE let me know.
> >
> > The example in "docs/examples/fo/images.fo has relative urls for images
> > (can't really have absolute urls for cvs and distributions!).
> > The images are loaded properly.
> >
> > Of course if you are embedding fop then you will need to set the basedir
> > via the config.


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


Re: external-graphics in xsl and PDF

Posted by Nicola Ken Barozzi <ba...@nicolaken.com>.
Below I'm cross-posting a mail taken from fop-dev list.
--
Nicola Ken Barozzi                 xml-cocoon@nicolaken.com

These are the days of miracle and wonder...
          ...so don't cry baby, don't cry...
                                                  Paul Simon


----- Original Message -----
From: "Keiron Liddle" <ke...@aftexsw.com>
To: <fo...@xml.apache.org>
Sent: Thursday, January 03, 2002 9:18 AM
Subject: Re: image protocal in Fop on unix


> On 2002.01.02 21:23 "Savino, Matt C" wrote:
> > This works for me:
> >
> > <fo:external-graphic
> >
src="file:///usr/local/weblogic/config/isappdev/applications/RVWebApp1/WEB-I
> > NF/lib/ClinTrialLogoGreenBig.gif" />
> >
> > If you figure out how to use a relative path, PLEASE let me know.
>
> The example in "docs/examples/fo/images.fo has relative urls for images
> (can't really have absolute urls for cvs and distributions!).
> The images are loaded properly.
>
> Of course if you are embedding fop then you will need to set the basedir
> via the config.



---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


RE: external-graphics in xsl and PDF

Posted by Torsten Curdt <tc...@dff.st>.
Anyway - relative paths will not work with fop.
Try an absolute URI.
--
Torsten

> Hi Olivier,
>
> I don't know if that was a typo but it is external-graphic (not graphics).
>
> i.e. <fo:external-graphic height="12px" src="{.}"/>
>
> Regards
>
> Tanzila
>
>   -----Original Message-----
>   From: Olivier MOUGEL [mailto:mougel.olivier@wanadoo.fr]
>   Sent: 03 January 2002 11:38
>   To: cocoon-users@xml.apache.org
>   Subject: external-graphics in xsl and PDF
>
>
>   Hi cocooner
>
>   I'm trying to import a jpeg file in a xsl file in order to generate a pdf
> with beautifull graphics :
>
>   I use <fo:external-graphics src="file:../images/file.jpg"/> but it don't
> works
>
>   Have someone a working synthaxis in a xsl sample
>
>   Thank's and Happy new Year 2002 and a lot of brand new euro for european
> people ;-))
>
>   Olivier MOUGEL
>   Bordeaux - FRANCE


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>


RE: external-graphics in xsl and PDF

Posted by Tanzila Mohammad <tm...@entier-solutions.com>.
Hi Olivier,

I don't know if that was a typo but it is external-graphic (not graphics).

i.e. <fo:external-graphic height="12px" src="{.}"/>

Regards

Tanzila

  -----Original Message-----
  From: Olivier MOUGEL [mailto:mougel.olivier@wanadoo.fr]
  Sent: 03 January 2002 11:38
  To: cocoon-users@xml.apache.org
  Subject: external-graphics in xsl and PDF


  Hi cocooner

  I'm trying to import a jpeg file in a xsl file in order to generate a pdf
with beautifull graphics :

  I use <fo:external-graphics src="file:../images/file.jpg"/> but it don't
works

  Have someone a working synthaxis in a xsl sample

  Thank's and Happy new Year 2002 and a lot of brand new euro for european
people ;-))

  Olivier MOUGEL
  Bordeaux - FRANCE