Hi,
I am trying to clip some text within an SVG block using FOP. Below I attach
a version of the FOP-XML I am using. When run with fop.sh that comes with
the FOP distribution (version 0.20.4), it works fine and clips as expected -
varying the clipPath's width will show more or less text accordingly.
However, when I pass the FOP-XML to my processor (a servlet) I get the
NullPointerException shown after the XML. It seems to be caused by the url
not being found but I am at a loss as how to tell the processor that I want
to refer to the document itself. Is there a configuration parameter that
needs to be set? Is there another way to pass in the reference to the
clipPath?
Note that I have tried replacing the clip-path attribute with both of the
following which, although they avoid the error, fail to clip the text.
clip-path:#xpointer(#4203)
clip-path:#xpointer(id(4203))
Any help would be greatly appreciated,
Michael
FOP-XML:
?xml version=1.0 encoding=utf-8?
fo:root xmlns:fo=http://www.w3.org/1999/XSL/Format;
xmlns:svg=http://www.w3.org/2000/svg;
!-- defines the layout master --
fo:layout-master-set
fo:simple-page-master margin-bottom=1cm margin-left=1.5cm
margin-right=1.5cm
margin-top=1cm master-name=only page-height=29.7cm
page-width=21cm
fo:region-before extent=2cm/
fo:region-body margin-bottom=4.5cm margin-top=2cm/
fo:region-after extent=5.5cm/
/fo:simple-page-master
/fo:layout-master-set
!-- starts actual layout --
fo:page-sequence master-reference=only
fo:flow flow-name=xsl-region-body
fo:table border-style=none border-width=0.5pt
fo:table-column column-width=18cm/
fo:table-body
fo:table-row border-style=none border-width=0.5pt
fo:table-cell text-align=center width=18cm
fo:block text-align=center
fo:instream-foreign-object height=20cm width=17.6cm
!-- SVG Starts Here --
svg:svg style='clip-rule:nonzero; font-size:12pt;
stroke-width:1pt;' width='600pt' height='752pt'
svg:g transform='scale(1.0)' align='center'
svg:clipPath id='4203'svg:rect x='118' y='0'
width='50' height='22'//svg:clipPath
svg:text x='121' y='18' style='font-weight:normal;
fill:rgb(0, 0, 0); font-size:9.35pt;
clip-path:url(#4203)'04-Jan-99#160;to#160;11-Feb-03/svg:text
/svg:g
/svg:svg
/fo:instream-foreign-object
/fo:block
/fo:table-cell
/fo:table-row
/fo:table-body
/fo:table
/fo:flow
/fo:page-sequence
/fo:root
Error message:
2003-02-13 09:32:30,411 INFO [STDOUT] [ERROR]
2003-02-13 09:32:30,412 INFO [STDOUT] svg graphic could not be built: null
2003-02-13 09:32:30,413 INFO [STDOUT] java.lang.NullPointerException
2003-02-13 09:32:30,417 INFO [STDOUT] at java.net.URL.init(URL.java:366)
2003-02-13 09:32:30,418 INFO [STDOUT] at java.net.URL.init(URL.java:329)
2003-02-13 09:32:30,419 INFO [STDOUT] at java.net.URL.init(URL.java:321)
2003-02-13 09:32:30,420 INFO [STDOUT] at java.net.URL.init(URL.java:252)
2003-02-13 09:32:30,421 INFO [STDOUT] at java.net.URL.init(URL.java:275)
2003-02-13 09:32:30,421 INFO [STDOUT] at
org.apache.batik.util.ParsedURLData.buildURL(Unknown Source)
2003-02-13 09:32:30,422 INFO [STDOUT] at
org.apache.batik.util.ParsedURLData.openStreamInternal(Unknown Source)
2003-02-13 09:32:30,423 INFO [STDOUT] at
org.apache.batik.util.ParsedURLData.openStream(Unknown Source)
2003-02-13 09:32:30,424 INFO [STDOUT] at
org.apache.batik.util.ParsedURL.openStream(Unknown Source)
2003-02-13 09:32:30,425 INFO [STDOUT] at
org.apache.batik.dom.svg.SAXSVGDocumentFactory.createDocument(Unknown
Source)
2003-02-13 09:32:30,425 INFO [STDOUT] at
org.apache.batik.bridge.DocumentLoader.loadDocument(Unknown Source)
2003-02-13 09:32:30,426 INFO [STDOUT] at
org.apache.batik.bridge.URIResolver.getNode(Unknown Source)
2003-02-13 09:32:30,427 INFO [STDOUT] at
org.apache.batik.bridge.URIResolver.getElement(Unknown Source)
2003-02-13 09:32:30,428 INFO [STDOUT] at
org.apache.batik.bridge.BridgeContext.getReferencedElement(Unknown Source)
2003-02-13 09:32:30,429 INFO [STDOUT] at
org.apache.batik.bridge.CSSUtilities.convertClipPath(Unknown Source)
2003-02-13 09:32:30,430 INFO [STDOUT] at
org.apache.batik.bridge.SVGTextElementBridge.buildGraphicsNode(Unknown
Source)
2003-02-13 09:32:30,430 INFO [STDOUT] at
org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(Unknown Source)
2003-02-13 09:32:30,431 INFO [STDOUT] at
org.apache.batik.bridge.GVTBuilder.buildComposite(Unknown Source)
2003-02-13 09:32:30,432 INFO [STDOUT] at
org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(Unknown Source)
2003-02-13 09:32:30,433 INFO [STDOUT] at
org.apache.batik.bridge.GVTBuilder.buildComposite(Unknown Source)
2003-02-13 09:32:30,434 INFO [STDOUT] at