[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] gradient SVG inside XSL-FO using FOP outputting black

Subject: Re: [xsl] gradient SVG inside XSL-FO using FOP outputting black
From: Kobayashi <koba@xxxxxxxxxxxxx>
Date: Thu, 22 Jan 2004 10:43:29 +0900

Hello !

XSL Formatter V3.0 supports SVG linear gradient.

I tried your sample, it works. 

Source fo file:

Result PDF file:

Actually you need 'viewBox="0 0 240 140"' to display correct.

I hope it will be helpful for you.


> Reply to the original mail from:
>  xsl-list@xxxxxxxxxxxxxxxxxxxxxx

Hi all,

I'm trying to make a linear gradient using SVG inside XSL-FO.  I am using 
FOP version 0.20.5.
I've only used SVG to make simple shapes like rectangles, occasional 
vertical text and I can
output solid colors fine but when I try to use gradient color then it just 
outputs all black.
If I put the SVG code as a separate SVG file and view it (with adobe SVG 
viewer for example)
then it comes out just fine.  I've tried embedding the SVG code and also 
tried bringing it in as
an external file (like .jpg) but both do the same thing (output black).  So 
I'm wondering what I might be doing wrong, if FOP will even do this, or if 
there is another FO processor that can do the job (hopefully freeware :) ).  
I'm including the snippet that I'm trying to get to work.


            <svg xmlns="http://www.w3.org/2000/svg" width="50mm" 
            <linearGradient id="three_stops">
                <stop offset="0%" style="stop-color: #ffcc00;" />
                <stop offset="33.3%" style="stop-color: #cc6699;" />
                <stop offset="100%" style="stop-color: #66cc99;" />
            <rect x="20" y="20" width="200" height="100"
                style="fill:url(#three_stops); stroke: black;" />


Thanks for any feedback/help.

Rethink your business approach for the new year with the helpful tips here. 

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Tokushige Kobayashi
Antenna House, Inc.
E-mail koba@xxxxxxxxxxxxx
WWW    http://www.antenna.co.jp/XML/xml-top.htm
WWW    http://www.antennahouse.com/ (English)
TEL    +81-3-3234-1361(direct call)
FAX    +81-3-3221-9975

Antenna House XSL School

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread