Too much display from transformation
Posted: Thu May 12, 2005 4:50 pm
Hi there,
I have a problem in transforming XML- data. Some elements are shown which I can't explain to myself why they are shown.
The source is in GML and i want to generate SVG.
<BPlanAuszug>
<wfs:FeatureCollection>
<gml:boundedBy>
<gml:Envelope>
<gml:pos>3566523.5 5950548</gml:pos>
<gml:pos>3566684 5950630.5</gml:pos>
</gml:Envelope>
</gml:boundedBy>
<gml:featureMember>
<xplan:BPlan gml:id="BPlan_0">
<xplan:name>Bebauungsplan B139</xplan:name>
<xplan:stadt>Hamburg</xplan:stadt>
<xplan:ebene xlink:href="#BPlanEbene_0"/>
</xplan:BPlan>
</gml:featureMember>
<gml:featureMember>
<xplan:BPlanEbene gml:id="BPlanEbene_0">
<xplan:ebene>0</xplan:ebene>
<xplan:fachobjekt xlink:href="#obj_0"/>
</xplan:BPlanEbene>
</gml:featureMember>
<gml:featureMember>
<xplan:RaeumlicherGeltungsbereich gml:id="obj_0">
<xplan:position>
<gml:MultiSurface>
<gml:surfaceMember>
<gml:Polygon>
<gml:exterior>
<gml:LinearRing>
<gml:pos>3479367.656 5889625.167</gml:pos>
<gml:pos>3479372.858 5889638.326</gml:pos>
<gml:pos>3479383.141 5889664.334</gml:pos>
....
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
</gml:MultiSurface>
</xplan:position>
</xplan:RaeumlicherGeltungsbereich>
</gml:featureMember>
This is how the data looks like. At least a few more points.
What I need are just the gml:pos- coordinates. After the transformation all gml:featureMember's which are placed before the one which contains the coordinates are shown in front of my string formattings.
Here comes the XSLT- source code:
<svg.....>
...
<xsl:apply-templates mode="Ebene"/>
...
</svg>
<xsl:template name="x_coord">
<!--<xsl:variable name="pointlist_x">
<xsl:value-of select="."/>
</xsl:variable>-->
<xsl:variable name="pointlist2" select="substring-before(.,' ')"/>
<xsl:variable name="pointlist2a" select="substring($pointlist2, 3, 8)"/>
<xsl:variable name="numberlist2c" select="number(($pointlist2a) div 1000)"/>
<xsl:value-of select="$numberlist2c"/>
</xsl:template>
<xsl:template name="y_coord">
<!--<xsl:variable name="pointlist_y">
<xsl:value-of select="."/>
</xsl:variable>-->
<xsl:variable name="pointlist3" select="substring-after(.,' ')"/>
<xsl:variable name="pointlist3a" select="substring($pointlist3, 3, 8)"/>
<xsl:variable name="numberlist3c" select="number(($pointlist3a) div 1000)"/>
<xsl:value-of select="$numberlist3c"/>
</xsl:template>
<xsl:template name="create_path">
<xsl:param name="style"/>
<path>
<xsl:attribute name="class">
<xsl:value-of select="$style"/>
</xsl:attribute>
<xsl:attribute name="d">
<xsl:for-each select="xplan:position/gml:MultiSurface/gml:surfaceMember/gml:Polygon/gml:exterior/gml:LinearRing/gml:pos">
<xsl:if test="position() = 1">
<xsl:text>M </xsl:text>
</xsl:if>
<xsl:choose>
<xsl:when test="position() != last()">
<xsl:call-template name="x_coord"/>
<xsl:text> </xsl:text>
<xsl:call-template name="y_coord"/>
<xsl:text> L </xsl:text>
</xsl:when>
<xsl:when test="position() = last()">
<xsl:call-template name="x_coord"/>
<xsl:text> </xsl:text>
<xsl:call-template name="y_coord"/>
<xsl:text> Z </xsl:text>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</xsl:attribute>
</path>
<xsl:template match="BPlanAuszug/wfs:FeatureCollection/gml:featureMember/xplan:RaeumlicherGeltungsbereich" mode="Ebene" >
<xsl:call-template name="create_path">
<!--<xsl:with-param name="feature" select="xplan:position/gml:MultiSurface/gml:surfaceMember/gml:Polygon/gml:exterior/gml:LinearRing/gml:pos"/>-->
<xsl:with-param name="style" select="'Gemeinde'"/>
<xsl:with-param name="style1" select="'clip'"/>
</xsl:call-template>
</xsl:template>
In my opinion the display should only contain the path- element with the coordinates. But maybe someone can show me what I have done wrong.
cheers
andy
I have a problem in transforming XML- data. Some elements are shown which I can't explain to myself why they are shown.
The source is in GML and i want to generate SVG.
<BPlanAuszug>
<wfs:FeatureCollection>
<gml:boundedBy>
<gml:Envelope>
<gml:pos>3566523.5 5950548</gml:pos>
<gml:pos>3566684 5950630.5</gml:pos>
</gml:Envelope>
</gml:boundedBy>
<gml:featureMember>
<xplan:BPlan gml:id="BPlan_0">
<xplan:name>Bebauungsplan B139</xplan:name>
<xplan:stadt>Hamburg</xplan:stadt>
<xplan:ebene xlink:href="#BPlanEbene_0"/>
</xplan:BPlan>
</gml:featureMember>
<gml:featureMember>
<xplan:BPlanEbene gml:id="BPlanEbene_0">
<xplan:ebene>0</xplan:ebene>
<xplan:fachobjekt xlink:href="#obj_0"/>
</xplan:BPlanEbene>
</gml:featureMember>
<gml:featureMember>
<xplan:RaeumlicherGeltungsbereich gml:id="obj_0">
<xplan:position>
<gml:MultiSurface>
<gml:surfaceMember>
<gml:Polygon>
<gml:exterior>
<gml:LinearRing>
<gml:pos>3479367.656 5889625.167</gml:pos>
<gml:pos>3479372.858 5889638.326</gml:pos>
<gml:pos>3479383.141 5889664.334</gml:pos>
....
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</gml:surfaceMember>
</gml:MultiSurface>
</xplan:position>
</xplan:RaeumlicherGeltungsbereich>
</gml:featureMember>
This is how the data looks like. At least a few more points.
What I need are just the gml:pos- coordinates. After the transformation all gml:featureMember's which are placed before the one which contains the coordinates are shown in front of my string formattings.
Here comes the XSLT- source code:
<svg.....>
...
<xsl:apply-templates mode="Ebene"/>
...
</svg>
<xsl:template name="x_coord">
<!--<xsl:variable name="pointlist_x">
<xsl:value-of select="."/>
</xsl:variable>-->
<xsl:variable name="pointlist2" select="substring-before(.,' ')"/>
<xsl:variable name="pointlist2a" select="substring($pointlist2, 3, 8)"/>
<xsl:variable name="numberlist2c" select="number(($pointlist2a) div 1000)"/>
<xsl:value-of select="$numberlist2c"/>
</xsl:template>
<xsl:template name="y_coord">
<!--<xsl:variable name="pointlist_y">
<xsl:value-of select="."/>
</xsl:variable>-->
<xsl:variable name="pointlist3" select="substring-after(.,' ')"/>
<xsl:variable name="pointlist3a" select="substring($pointlist3, 3, 8)"/>
<xsl:variable name="numberlist3c" select="number(($pointlist3a) div 1000)"/>
<xsl:value-of select="$numberlist3c"/>
</xsl:template>
<xsl:template name="create_path">
<xsl:param name="style"/>
<path>
<xsl:attribute name="class">
<xsl:value-of select="$style"/>
</xsl:attribute>
<xsl:attribute name="d">
<xsl:for-each select="xplan:position/gml:MultiSurface/gml:surfaceMember/gml:Polygon/gml:exterior/gml:LinearRing/gml:pos">
<xsl:if test="position() = 1">
<xsl:text>M </xsl:text>
</xsl:if>
<xsl:choose>
<xsl:when test="position() != last()">
<xsl:call-template name="x_coord"/>
<xsl:text> </xsl:text>
<xsl:call-template name="y_coord"/>
<xsl:text> L </xsl:text>
</xsl:when>
<xsl:when test="position() = last()">
<xsl:call-template name="x_coord"/>
<xsl:text> </xsl:text>
<xsl:call-template name="y_coord"/>
<xsl:text> Z </xsl:text>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</xsl:attribute>
</path>
<xsl:template match="BPlanAuszug/wfs:FeatureCollection/gml:featureMember/xplan:RaeumlicherGeltungsbereich" mode="Ebene" >
<xsl:call-template name="create_path">
<!--<xsl:with-param name="feature" select="xplan:position/gml:MultiSurface/gml:surfaceMember/gml:Polygon/gml:exterior/gml:LinearRing/gml:pos"/>-->
<xsl:with-param name="style" select="'Gemeinde'"/>
<xsl:with-param name="style1" select="'clip'"/>
</xsl:call-template>
</xsl:template>
In my opinion the display should only contain the path- element with the coordinates. But maybe someone can show me what I have done wrong.
cheers
andy