RE: [xsl] External-graphic

Subject: RE: [xsl] External-graphic
From: <Tom.Fritz@xxxxxxxx>
Date: Mon, 6 Mar 2006 09:00:37 +0100
Hi,

It still nothing happens and I got the following warning WARNING:
Unknown formatting object
http://www.w3.org/1999/XSL/Format^external-graphic
Here is the full stylesheet.

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:fo="http://www.w3.org/1999/XSL/Format"; version="1.0">
	<xsl:template match="/">
		<fo:root>
			<fo:layout-master-set><!--In diesem Template
werden die Seitenvorgaben (<fo:layout-master-set>)spezifiziert sowie die
Folge der Seiten (<fo:page-sequence>) festgelegt.-->
				<fo:simple-page-master
page-master-name="general">
					  <fo:region-body
margin-left="36pt" margin-right="36pt" margin-top="72pt"
margin-bottom="72pt" />
					  <fo:region-before
extent="72pt" vertical-align="bottom" precedence="true"
background-color="#ff8888" reference-orientation="0" />
					  <fo:region-after
margin-left="36pt" extent="72pt" vertical-align="bottom"
background-color="#88ff88" precedence="true" reference-orientation="180"
/>
				</fo:simple-page-master>
	  		</fo:layout-master-set>

	 		<fo:page-sequence master-reference="general">
	 			<fo:sequence-specification>

<fo:sequence-specifier-alternating page-master-first="general"
page-master-even="general" page-master-odd="general"
page-master-blank-even="general" page-master-last-even="general"
page-master-last-odd="general" />
	  			</fo:sequence-specification>


	         		<fo:flow flow-name="photo"
font-family="sans-serif" font-size="10pt" >
	          			<fo:block font-weight="bold">
							Graphics Example
						</fo:block>
						<fo:block>

<fo:external-graphic src='url("file:/c:/logo.jpg")' height="3cm"
width="3cm"/>
						</fo:block>
						</fo:flow>
	      		</fo:page-sequence>
	      	</fo:root>

	</xsl:template>

	<fo:flow flow-name="test">
		<fo:block><fo:external-graphic
src='url("file:/c:/logo.jpg")' height="3cm" width="3cm"/></fo:block>
	</fo:flow>


	<xsl:template name="photo">
	<fo:block>Graphics Example</fo:block>
		<fo:block text-align="inside">
			<fo:external-graphic
src='url("file:/c:/logo.jpg")' height="3cm" width="3cm"/>
		</fo:block>
	</xsl:template>


</xsl:stylesheet>

Thanks a lot
Tom

-----Original Message-----
From: G. Ken Holman [mailto:gkholman@xxxxxxxxxxxxxxxxxxxx]
Sent: 03 March 2006 12:40
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] External-graphic

At 2006-03-03 10:57 +0100, Tom.Fritz@xxxxxxxx wrote:
>I am new to xsl and want to display an image in a pdf file. I am using
>the following syntax in the stylesheet.
>
><fo:block text-align="center">
>         <fo:external-graphic src="file:c/logo.jpg"  height="3cm"
>width="3cm"/>
></fo:block>
>
>Nothing happens. What could be the problem?

A couple of things jump out at me, first you are not using the correct
syntax for the src= attribute (though some processors ignore the
requirement to use the correct syntax); second the URL syntax for the
local file system doesn't look correct either.

There are a number of variations of syntax for src= and I tell my
students that the most reliable to use is:

       src='url("  ..url..   ")'

Reviewing the syntax for URLs, single quotes are allowed while double
quotes are not, thus the syntax above means that a transformation
involving a valid URL entered by a user will not inadvertently create
improperly-quoted strings.

If the filename is c:\logo.jpg, then I belive the correct URL syntax for
this is:

       file:///c:/logo.jpg

So, try:

  <fo:external-graphic src='url("file:///c:/logo.jpg"  height="3cm"
width="3cm"/>

I hope this helps.

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

--
Upcoming XSLT/XSL-FO hands-on courses: Washington,DC 2006-03-13/17
World-wide on-site corporate, govt. & user group XML/XSL training.
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Cancer Awareness Aug'05  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal


###########################################
CONFIDENTIALITY: This e-mail and
any attachments are confidential and may also be privileged.
If you are not
the designated recipient, please notify the sender immediately by reply e-mail
and destroy all copies (digital and paper).
Any unauthorized disclosure,
distribution, copying, storage or use of the information contained in this
e-mail or any attachments is strictly prohibited and may be unlawful.

Current Thread