Re: [xsl] image from a jar file

Subject: Re: [xsl] image from a jar file
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Thu, 21 Aug 2008 20:08:17 -0400
At 2008-08-22 01:55 +0200, Rolf Schumacher wrote:
Mauritz Jeanson wrote:
> Something like this:
>
> <fo:external-graphic src="jar:file:///foo/bar.jar!/baz/logo.jpg"/>
>
> See http://java.sun.com/javase/6/docs/api/java/net/JarURLConnection.html
>
Yes, it works that way. Thank you, Mauritz.

Note there are rules for src= attributes in XSL-FO that, while not being enforced by all XSL-FO engines, should be followed for portability with engines that do enforce the syntax specified in the standard:


src='url("jar:file:///foo/bar.jar!/baz/logo.jpg")'

Note that while url(...) and url('...') are also allowed, RFC 2396 allows the single quote and parentheses in URI strings, and XML documents are authored with arbitrary values unexpected by stylesheet writers. I tell my students the stylesheet writer should use double quotes as above to "protect" their value specification from a user value that might disturb the delimiters chosen.

If you *really* want to use double quotes for your attribute literal then you can do:

src="url(&quot;jar:file:///foo/bar.jar!/baz/logo.jpg&quot)"

I hope this helps.

. . . . . . . . . . . Ken

--
Upcoming XSLT/XSL-FO hands-on courses:      Wellington, NZ 2009-01
Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Male Cancer Awareness Nov'07  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal

Current Thread