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

RE: GML to svg

Subject: RE: GML to svg
From: cknell@xxxxxxxxxx
Date: Wed, 09 Jun 2004 10:27:24 -0400
transform gml to svg
I copied your stylesheet and data file and ran the transformation. Here are the problems the Saxon processor reported:

>From your stylesheet:

As others have commented, the backslash in this URL is invalid,
<xsl:transform xmlns:xsl="http:\\www.w3.org\1999\XSL\Transform" 
and should be replaced by the forward slash,
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 

Your <xsl:transform> element needs a version attribute. I altered it so,
<xsl:transform version="1.0" ...

Your declaration of this variable contained a space in the name, rendering it invalid,
<xsl:variable name="viewBox Value">,
I changed it so,
<xsl:variable name="viewBoxValue">

That cleared up another error that stated you hadn't declared the variable $viewBoxValue.

Finally I go the error that stated that the namespace prefix "fn" had not been declared and you have used it twice.

That's as far as I can go with it. Try fixing those problems and report back.



-- 
Charles Knell
cknell@xxxxxxxxxx - email



-----Original Message-----
From:     sarra hamdi <hacker249@xxxxxxxxx>
Sent:     Wed, 09 Jun 2004 06:43:47 -0400
To:       xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:   GML  to svg

Hello,
I always have a same problem: how trasform a gml file to svg.I have a gml file validated with xmlspy, and i want tranform it in svg format to visualise the map (using xmlspy), this map should contain two lines when one represent the road and the other represent the river. I tried to use your suggestion for the xslt file but the result is a html file not a svg file,  from this can you look my following files, to help me found the error: 
----------------------------------------------
the file Cambridge.xml
------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<!-- File: cambridge.xml -->
<CityModel xmlns="http://www.opengis.net/examples" xmlns:gml="http://www.opengis.net/gml" 
xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance
" xsi:schemaLocation="http://www.opengis.net/examples  c:\City.xsd">
	<gml:name>Cambridge</gml:name>
	<gml:boundedBy>
		<gml:Box srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">
			<gml:coord>
				<gml:X>0.0</gml:X>
				<gml:Y>0.0</gml:Y>
			</gml:coord>
			<gml:coord>
				<gml:X>100.0</gml:X>
				<gml:Y>100.0</gml:Y>
			</gml:coord>
		</gml:Box>
	</gml:boundedBy>
	<cityMember>
		<River>
			<gml:description>The river that runs through Cambridge.</gml:description>
			<gml:name>Cam</gml:name>
			<gml:centerLineOf>
				<gml:LineString srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">
					<gml:coord>
						<gml:X>0</gml:X>
						<gml:Y>50</gml:Y>
					</gml:coord>
					<gml:coord>
						<gml:X>70</gml:X>
						<gml:Y>60</gml:Y>
					</gml:coord>
					<gml:coord>
						<gml:X>100</gml:X>
						<gml:Y>50</gml:Y>
					</gml:coord>
				</gml:LineString>
			</gml:centerLineOf>
		</River>
	</cityMember>
	<cityMember>
		<Road>
			<gml:name>M11</gml:name>
			<linearGeometry>
				<gml:LineString srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">
					<gml:coord>
						<gml:X>0</gml:X>
						<gml:Y>5.0</gml:Y>
					</gml:coord>
					<gml:coord>
						<gml:X>20.6</gml:X>
						<gml:Y>10.7</gml:Y>
					</gml:coord>
					<gml:coord>
						<gml:X>80.5</gml:X>
						<gml:Y>60.9</gml:Y>
					</gml:coord>
				</gml:LineString>
			</linearGeometry>
			<classification>motorway</classification>
			<number>11</number>
		</Road>
	</cityMember>
	<cityMember xlink:type="simple" xlink:title="Trinity Lane" xlink:href="http://www.foo.net/cgi-bin/wfs?FeatureID=C10239
" gml:remoteSchema="city.xsd#xpointer(//complexType[@name='RoadType'])"/>
	<dateCreated>2000-11</dateCreated>
</CityModel>

------------------------------------------------
the file cambridge.xsl
----------------------------------------------
<?xml version="1.0"?>
<xsl:transform xmlns:xsl="http:\\www.w3.org\1999\XSL\Transform" 
xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:pre1="http://www.opengis.net/examples" 
xmlns:gml="http://www.opengis.net/gml">
	<xsl:output method="svg" doctype-system="http://www.w3.org/TR/2000/03/WD-SVG-20000303/DTD/svg-20000303-stylable.dtd
" doctype-public="-//W3C//DTD SVG 20000303 Stylable//EN"/>
	<xsl:variable name="viewBox Value">
		<xsl:value-of select="fn:tokenize(*/gml:boundedBy/gml:Box/gml:coordinates)"/>
	</xsl:variable>
	<xsl:template match="/">
		<xsl:element name="svg">
			<xsl:attribute name="viewBox"><xsl:value-of select="$viewBoxValue"/></xsl:attribute>
			<!--apply template to each GML geometry property-->
			<xsl:apply-templates select="//pre1:cityMember/gml:centerLineOf"/>
		</xsl:element>
	</xsl:template>
	<xsl:template match="pre1:cityMember/gml:centerLineOf">
		<xsl:element name="path">
			<xsl:attribute name="style">stroke-width:fill:none;stroke:rgb(69,34,118);</xsl:attribute>
			<xsl:attribute name="d"><xsl:value-of select="fn:tokenize(./gml:coordinates)"/>
			</xsl:attribute>
		</xsl:element>
	</xsl:template>
</xsl:transform>

----------------------------------------------
the result given with xmlspy
----------------------------------------------
<?xml version="1.0" encoding="UTF-8"?><xsl:transform xmlns:gml="http://www.opengis.net/gml" 
xmlns:pre1="http://www.opengis.net/examples" xmlns:xlink="http://www.w3.org/1999/xlink" 
xmlns:xsl="http:\\www.w3.org\1999\XSL\Transform"><xsl:output method="svg" 
doctype-system="http://www.w3.org/TR/2000/03/WD-SVG-20000303/DTD/svg-20000303-stylable.dtd" 
doctype-public="-//W3C//DTD SVG 20000303 Stylable//EN"/><xsl:variable 
name="viewBox Value"><xsl:value-of select="fn:tokenize(*/gml:boundedBy/gml:Box/gml:coordinates)"
/></xsl:variable><xsl:template match="/"><xsl:element name="svg"><xsl:attribute 
name="viewBox"><xsl:value-of select="$viewBoxValue"/></xsl:attribute><xsl:apply-templates 
select="//pre1:cityMember/gml:centerLineOf"/></xsl:element></xsl:template><xsl:template 
match="pre1:cityMember/gml:centerLineOf"><xsl:element name="path"><xsl:attribute 
name="style">stroke-width:fill:none;stroke:rgb(69,34,118);</xsl:attribute><xsl:attribute 
name="d"><xsl:value-of select="fn:tokenize(./gml:coo
rdinates)"/></xsl:attribute></xsl:element></xsl:template></xsl:transform>
---------------------------------------------
the attented output svg file
-----------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
  <svg width="50cm" height="20cm" viewBox="0 
0 800 40"
xmlns:gml="http://www.opengis.net/gml" 
xmlns:xlink="http://www.w3.org/TR/xlink"
xml:space="preserve" 
xmlns="http://www.w3.org/2000/svg">
 	
 	<g transform="rotate(-100)">
 		<g stroke="green">
			<line x1="50" y1="0" 
x2="60" y2="70" stroke-width="2" 			<line x1="60" 
y1="70" x2="50" y2="100" stroke-width="2"/>
		</g>
 		<text x="0" y="0" font-
size="10" font-family="Verdana" 
fill="blue">River
 </text>
 		<g stroke="red">
			<g transform="rotate
(20)">
					
	</g>
			<line x1="5.0" 
y1="0.0" x2="10.7" y2="20.6" stroke-
width="5"/>
			<line x1="10.7" 
y1="20.6" x2="60.9" y2="80.5" stroke-
width="5"/> 			<line x1="60.9" 
y1="80.5" x2="100" y2="90" stroke-width="5"/>
		</g>
	</g>
 	<text x="0" y="2" font-size="10" 
font-family="Verdana" fill="blue">
 Road
 </text>
><text x="0" y="-70" font-size="10" 
font-family="Verdana" fill="blue">
 River
 </text>
 	<path 
style="stroke:$colorc;fill:$remplir" d=""/>
	<path 
style="stroke:$colorc;fill:$remplir" d=""/>




____________________________________________________________
Find what you are looking for with the Lycos Yellow Pages
http://r.lycos.com/r/yp_emailfooter/http://yellowpages.lycos.com/default.asp?SRC=lycos10

--+------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe@xxxxxxxxxxxxxxxxxxxxxx>
--+--




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.