RE: [xsl] GML transformation

Subject: RE: [xsl] GML transformation
From: cknell@xxxxxxxxxx
Date: Fri, 21 May 2004 11:08:20 -0400
You have nested template definitions. You can't do that.

You have defined a template to match "//gml:centerLineOf/gml:LineString/gml:coordinates".
Inside that you have defined a template to match "/" and inside that template you define a second tempate to match "/".

Inside the outer template you have defined two variables: $clist and $tclist. The second ($tclist) is defined as the output of normalize-space($clist). You don't need to define two variables. This one statement would do: 

<xsl:variable name="tclist" select="normalize-space(.)"/>

That being said, you don't refer to $tclist again, so why define it?

The double slash that begins the XPath of your outer template match is frequently seen in beginners' XSLT. It is rarely necessary and is a sign that the programmer has become frustrated in designing the template and not getting the output he or she expects. The double slash at least puts out *something*, but it doesn't really solve your problem.

You may also be having trouble resolving the URLs :
doctype-system="D:\mesrecherchesmastere\svg\DTD\svg10.dtd" 
   and 
<!DOCTYPE xsl:stylesheet SYSTEM "C:\Documents and Settings\ines\Bureau\exemple3\Untitled2.dtd">

Neither of these Windows file paths are URLs. It may be that your XSL processor is accomodating you by ignoring this fact and has provided a custom method to resolve them, but maybe not. In any case it isn't a portable solution and it locks you into the non-conforming processor.

If you had given an example of the output you wanted, perhaps someone on the list could help. But given the problems with the stylesheet you are using and having no clue as to what you want to achieve, I doubt that anyone can solve your problem.

Please re-post with an example of the output you hope to achieve.
-- 
Charles Knell
cknell@xxxxxxxxxx - email



-----Original Message-----
From:     sarra hamdi <hacker249@xxxxxxxxx>
Sent:     Fri, 21 May 2004 08:44:55 -0400
To:       xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:  [xsl] GML transformation

Hello,
I have a valid GML file descriped follow, it was validated by xmlspy. I want to transform it to SVG format using xslt but I m newbie in xsl language.
follow the xsl file that I writed but it cant give me a good result .
from this can any one see this two file to help me to represent the gml file.
thanks advanced.
------------------------------------------------
the gml file
------------------------------------------------

<?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 /u/pkg/gml4j/test/schemas/City.xsd">

  <gml:name>Cambridge</gml:name>
  <gml:boundedBy>
    <gml:Box srsName="http://www.opengis.net/gml/srs/epsg.xml#4326";>
      <gml:coordinates>0.0 0.0,100.0 100.0</gml:coordinates>
    </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:coordinates>0 50,70 60,100 50</gml:coordinates>
        </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:coordinates>0 5.0,20.6 10.7,80.5 60.9</gml:coordinates>
          </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'])"/>
  <cityMember>
    <Mountain>
      <gml:description>World's highest mountain is in Nepal!</gml:description>
      <gml:name>Everest</gml:name>
      <elevation>8850</elevation>
    </Mountain>
  </cityMember>
  <dateCreated>2000-11</dateCreated>
</CityModel>


------------------------------------------------
the xsl file
------------------------------------------------<?xml version="1.0"?>
<!DOCTYPE xsl:stylesheet SYSTEM "C:\Documents and Settings\ines\Bureau\exemple3\Untitled2.dtd">
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; xmlns:xlink="http://www.w3.org/TR/xlink"; xmlns:gml="http://www.opengis.net/gml"; xmlns:redirect="org.apache.xalan.xslt.extensions.Redirect" xmlns:mur="murmur" extension-element-prefixes="mur">
	<xsl:output method="xml" doctype-system="D:\mesrecherchesmastere\svg\DTD\svg10.dtd" doctype-public="-//W3C//DTD SVG 20000303 Stylable//EN"/>
	<xsl:variable name="boxCoord" select="//gml:Box/gml:coordinates/."/>
	     <xsl:template match="//gml:centerLineOf/gml:LineString/gml:coordinates">
		<xsl:variable name="clist" select="."/>
		<xsl:variable name="tclist" select="normalize-space($clist)"/>
		<xsl:template match="/">
			<xsl:variable name="boxCoord"></xsl:variable>
			<xsl:template match="/">
		<svg xml:space="preserve" viewBox="{$boxCoord}">
			<xsl:apply-templates/>
		</svg>
	</xsl:template>	
	</xsl:template>	
	</xsl:template>	
</xsl:stylesheet>




____________________________________________________________
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

Current Thread