Hi Paul,

Am 14.09.2010 um 13:14 schrieb Paul Hoadley:

> Hello,
> 
> I see some references to FOP in the archives over the years, so there are 
> obviously people using it.  I hope they're still subscribed.  :-)
> 
> I am trying to embed Apache FOP into an application.  It's going quite well, 
> but I have an outstanding issue: resolution of 'href' attributes in XSLT 
> files and 'url' attributes in XSLFO files.  For example, I have a 
> 'driver.xsl' file which sets some app-specific params, and then imports the 
> stylesheet proper:
> 
>   <xsl:import href="invoice.xsl"/>
> 
> 'driver.xsl' and 'invoice.xsl' are both in Resources.  Neither "/invoice.xsl" 
> nor "/Resources/invoice.xsl" helped.  The error is fairly non-specific:
> 
> SystemId Unknown; Line #5; Column #35; Had IO Exception with stylesheet file: 
> invoice.xsl
> 
> (Line 5, Column 35 is the location in driver.xsl where the import element 
> finishes.)  Similarly, that transform generates some XSLFO which refers to an 
> image:
> 
> background-image="url('invoice-logo.png')"
> 
> (The XSLFO is ephemeral, just living in an NSData object until the PDF is 
> generated, so maybe a relative URL like that doesn't even make sense.)  In 
> this case, I get this logged:
> 
> Sep 14 20:17:07 PBF[56565] DEBUG FOP  - File not found: file:invoice-logo.png
> Sep 14 20:17:07 PBF[56565] DEBUG AbstractImageSessionContext  - URI could not 
> be resolved: invoice-logo.png

I'm only using straight FOP (w/o any XSLT). Ages ago, I set up an FOImage 
component. This is the .wod:

Image: WOXMLNode {
        alt = ^alt;
        border = ^border;
        elementName = "fo:external-graphic";
        mimetype = ^mimeType;
        src = src;
        height = ^height;
        line-height = ^lineHeight;
        width = ^width;
        content-width = ^content-width;
        content-height = ^content-height;
}

The src is:

    public URL src() {
        WOResourceManager resourceManager = application().resourceManager();
                
            String filename = (String) valueForBinding("filename");
            String framework = (String) valueForBinding("framework");

            return resourceManager.pathURLForResourceNamed(filename, framework, 
null);
    }

I'd guess you'll also have to get the URL from the resource manager and pass 
that in somehow. I'd also guess the same applies to the URLs for any xsl files.

cheers, Fabian

> It's not clear to me where FOP is looking for these resources, nor how to 
> tell it to look in Resources.  Does anyone know?
> 
> 
> -- 
> Paul.
> 
> http://logicsquad.net/
> 
> 
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list      ([email protected])
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/webobjects-dev/lists.fabian%40e-lumo.com
> 
> This email sent to [email protected]

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to