Re: [Moderator Action] "fo:external-graphic" with "xsl:value-of select="image_url" on windows and Unix

At 2002-09-27 17:01 +0200, Max Froumentin wrote:
>"Guo, Gordon" <gguo@cdocs.com> writes:
>
> >                              <xsl:element name="fo:external-graphic">
> >                                <xsl:attribute name="src">
> >                                  <xsl:value-of select="imgurl"/>/zenith.gif
> >                                 </xsl:attribute>
>
>The src attribute is defined as containing a <uri-specification>
>which has the format 'url(' followed by a URI reference in single
>or double quotes, followed by ')'. So your code should be
>
><xsl:element name="fo:external-graphic">
>   <xsl:attribute name="src">url('<xsl:value-of 
> select="imgurl"/>/zenith.gif')</xsl:attribute>

A nuance that I share with my students is that the use of the single quote 
as the literal in the url() syntax (which works just fine in Max's example) 
may not be the "safest" when you are dealing with arbitrary URL values from 
your XML authors.

The single quote is a valid character in the URL syntax according to the 
second last paragraph of section 2.2 of RFC1738 ... so I figured that if 
you used url('{@url}') there was a risk that the single quote of the URL 
would get confused with the single quote of the opening literal.  Perhaps I 
am wrong about this risk, since it isn't mentioned in the Recommendation.

I tell my students the safest is to use url("{@url}") to ensure there would 
be no confusion with any valid URL value resolved from the author's data.

Note that for those who quote their attributes, it would be:

    src="url(&quot;{@url}&quot;)"

For those who have our PDF book, this is discussed on page 135.

I hope this helps.

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


--
Upcoming hands-on in-depth    Europe:         Sep 18-Sep 20,2002
XSLT/XPath and XSL-FO         North America:  Sep 30-Oct  4,2002

G. Ken Holman               mailto:gkholman@CraneSoftwrights.com
Crane Softwrights Ltd.        http://www.CraneSoftwrights.com/f/
Box 266, Kars, Ontario CANADA K0A-2E0  +1(613)489-0999 (F:-0995)
ISBN 0-13-065196-6                     Definitive XSLT and XPath
ISBN 0-13-140374-5                             Definitive XSL-FO
ISBN 1-894049-08-X Practical Transformation Using XSLT and XPath
ISBN 1-894049-10-1             Practical Formatting Using XSL-FO
Next public training: 2002-09-18,19,30,10-03,12-08,2003-03-04,07

Received on Friday, 27 September 2002 12:33:40 UTC