[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

SVG Manipulation Problems connected to Doctype declara

Subject: SVG Manipulation Problems connected to Doctype declaration
From: "Jeremy E. Denton" <jdenton@xxxxxxxxxxxxx>
Date: Wed, 10 Apr 2002 14:17:55 -0700
svg manipulation
Greetings,

I was hoping that someone might clarify if there was ever a resolution to an
earlier problem that was mentioned about SVG (posted by David Pawson on
Friday March 3, 2000 under the title "doctype decl problem"). My goal is to
strip out the "path" elements out of an SVG document. THe SVG was generated
using Adobe Illustrator so I have to assume that it's correct.

The "DOCTYPE" declaration at the beginning of the SVG seems to be the
culprit of my problem. There is a parsing problem of some sort as it results
in a more or less blank SVG document. If I remove the line so it becomes a
generic xml docment, then the XSLT produces the correct results.
Unfortunately, I have too many svg documents to make hand editing each one
practical.

I am using "Instant Saxon" to do my xslt processing.

The following is an example of my svg and of the XSLT that I've written to
do just that:

airport.svg:
--------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 10, SVG Export Plug-In . SVG Version:
3.0.0 Build 76)  -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd" [-->
	<!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
	<!ENTITY ns_svg "http://www.w3.org/2000/svg">
	<!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
]>
<svg xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;"
xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/" width="68.08203"
height="67.95703" viewBox="0 0 68.08203 67.95703"
style="overflow:visible;enable-background:new 0 0 68.08203 67.95703"
xml:space="preserve">
	<g id="Layer_1">
		<g id="Layer_1_1_">
			<g>
				<path id="_x0035_46492912"
style="fill:none;stroke:#A67D3B;stroke-linejoin:round;" d="M34.04102,0.5

c18.52246,0,33.54102,14.98877,33.54102,33.47852c0,18.49121-15.01855,33.47852
-33.54102,33.47852S0.5,52.46973,0.5,33.97852
					C0.5,15.48877,15.51855,0.5,34.04102,0.5"/>
				<path id="_x0035_46493176"
style="fill:none;stroke:#A67D3B;stroke-linecap:round;stroke-linejoin:round;"
d="

M29.82324,12.92285v12.6333L8.72705,42.39844h21.09619v8.4248l-8.43799,6.31738
h25.31104l-8.4375-6.31738v-8.4248h21.09668
					L38.25879,25.55615v-12.6333"/>
				<g>
					<path id="_x0033_74936400"
style="fill:none;stroke:#FFFFFF;stroke-linecap:round;stroke-linejoin:round;"
d="

M38.25879,12.92285c0-2.31592-1.89746-4.21143-4.21777-4.21143c-2.31982,0-4.21
777,1.89551-4.21777,4.21143"/>
					<path id="_x0033_75131424"
style="fill:none;stroke:#A67D3B;stroke-linecap:round;stroke-linejoin:round;"
d="

M38.25879,12.92285c0-2.31592-1.89746-4.21143-4.21777-4.21143c-2.31982,0-4.21
777,1.89551-4.21777,4.21143"/>
				</g>
			</g>
		</g>
	</g>
</svg>
--------------------------------------------------------
strip.xsl
--------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
	<xsl:template match="/">
		<xsl:apply-templates/>
	</xsl:template>
		<xsl:template match="svg">
		<svg><xsl:apply-templates/></svg>
	</xsl:template>
	<xsl:template match="g">
	<xsl:apply-templates/>
	</xsl:template>
	<xsl:template match="path">
		<path><xsl:copy-of select="node()|@style|@d"/></path>
	</xsl:template>
	<xsl:template match="defs"/>
</xsl:stylesheet>
--------------------------------------------------------

Any suggestions?

Thanks,
Jeremy E. Denton
----------------------------------------------------------------------------
Software Developer | Privileged or confidential information may be contained
Galdos Systems Inc | in this message. If this message was not intended for
                   | you, destroy it and notify us immediately. Opinions,
                   | conclusions, recommendations, and other information
                   | presented in this message are not given or necessarily
                   | endorsed by my employer or firm.
----------------------------------------------------------------------------


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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.