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

Re: [xsl] Problem with extracting text from svg file


Subject: Re: [xsl] Problem with extracting text from svg file
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Tue, 09 Oct 2012 19:54:33 -0400

At 2012-10-09 18:30 -0500, Russell Urquhart wrote:
Looking in the source svg file i DID find the following:

<DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">

As I expected (except for the need for "!" after "<").


Am i going to have to strip out these lines from the source svg files, or is there some way to get the xslt to disregard them?

You can leave the files untouched and get Saxon to disregard the W3C web site by supplying Saxon with an XML catalogue that redirects the W3 URI with a URI pointing to a copy of the DTD in your local system.


I've mocked up a working example below based on slides I use in my XSLT training.

I hope this helps.

. . . . . . . Ken

p.s. on my system the plain invocation *eventually* works without fail ... there is just a long delay on the W3C web site for this file, it isn't prohibited access; adding the catalogue makes it instantaneous

T:\ftemp>wget http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd
--2012-10-09 19:38:12-- http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd
Resolving www.w3.org... 128.30.52.37
Connecting to www.w3.org|128.30.52.37|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 55654 (54K) [text/plain]
Saving to: `svg10.dtd'


100%[======================================>] 55,654 --.-K/s in 0.002s

2012-10-09 19:38:41 (29.6 MB/s) - `svg10.dtd' saved [55654/55654]


T:\ftemp>type svgcat.xml <?xml version='1.0'?> <catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" prefer="public">

<system systemId="http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"
        uri="svg10.dtd"/>

</catalog>

T:\ftemp>type russ.xml
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg xmlns="http://www.w3.org/2000/svg">
<path d="M145 20 v 374M210.16666666666669 20 v 374M275.33333333333337 20 v 374M340.50000000000006 20 v 374M405.66666666666674 20 v 374M470.8333333333334 20 v 374M536.0000000000001 20 v 374" class="gridlines"/>
</svg>


T:\ftemp>java -Dxml.catalog.files=svgcat.xml -jar saxon9he.jar -x:com.sun.org.apache.xml.internal.resolver.tools.ResolvingXMLReader -s:russ.xml -xsl:russ.xsl
Warning: at xsl:stylesheet on line 3 column 45 of russ.xsl:
Running an XSLT 1 stylesheet with an XSLT 2 processor
M145 20 v 374M210.16666666666669 20 v 374M275.33333333333337 20 v 374M340.50000000000006 20 v 374M405.66666666666674 20 v 374M470.8333333333334 20 v 374M536.0000000000001 20 v 374
T:\ftemp>



-- Contact us for world-wide XML consulting and instructor-led training Free 5-hour lecture: http://www.CraneSoftwrights.com/links/udemy.htm Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Google+ profile: https://plus.google.com/116832879756988317389/about Legal business disclaimers: http://www.CraneSoftwrights.com/legal


Current Thread
Keywords