以文本方式查看主题

-  中文XML论坛 - 专业的XML技术讨论区  (http://bbs.xml.org.cn/index.asp)
--  『 SVG/GML/VRML/X3D/XAML 』  (http://bbs.xml.org.cn/list.asp?boardid=21)
----  GML转SVG遇到 无法读取节点内容的问题,是命名空间的问题吗  (http://bbs.xml.org.cn/dispbbs.asp?boardid=21&rootid=&id=32568)


--  作者:spears
--  发布时间:5/17/2006 5:30:00 PM

--  GML转SVG遇到 无法读取节点内容的问题,是命名空间的问题吗
源gml文件如下
<?xml version="1.0"?>
<wfs:FeatureCollection xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.mycgiserver.com/~amri/percobaan" xmlns:gml="http://www.opengis.net/gml" xs:schemaLocation="http://www.mycgiserver.com/~amri/percobaan s.xsd   http://www.opengis.net/wfs WFS-basic.xsd" xmlns:wfs="http://www.opengis.net/wfs">
  <gml:description>description for FeatureCollection.</gml:description>
  <gml:boundedBy>
    <gml:Box>
      <gml:coordinates>-0.046875,0.053125 0.04375,-0.05 </gml:coordinates>
    </gml:Box>
  </gml:boundedBy>
  <gml:featureMember>
    <s fid="s_0">
      <id>3001</id>
           <TheGeometry>
        <gml:Polygon>
          <gml:outerBoundaryIs>
            <gml:LinearRing>
              <gml:coordinates>-0.022644,-0.05 -0.005197,-0.042105 0.00498,-0.037664 0.011765,-0.030263 0.012249,-0.020395 0.010311,-0.011513 0.015157,-0.01102 0.02388,-0.012993 0.026303,-0.002138 0.027757,0.000329 0.030665,-0.000164 0.035511,-0.005592 0.041811,-0.010033 0.041811,-0.010033 0.042781,-0.003618 0.04375,0.005263 0.041327,0.019572 0.034542,0.032401 0.030665,0.040296 0.029211,0.048684 0.020488,0.053125 0.020488,0.053125 0.009342,0.049671 0.001103,0.04227 -0.004713,0.035855 -0.009559,0.031414 -0.016828,0.029934 -0.026036,0.029441 -0.034759,0.023026 -0.042029,0.015132 -0.046875,0.003289 -0.046875,0.003289 -0.042513,-0.001151 -0.041544,-0.006086 -0.039121,-0.012007 -0.036213,-0.018914 -0.03379,-0.026809 -0.032336,-0.034704 -0.031367,-0.042599 -0.022644,-0.05 </gml:coordinates>
            </gml:LinearRing>
          </gml:outerBoundaryIs>
        </gml:Polygon>
      </TheGeometry>
    </s>
  </gml:featureMember>
</wfs:FeatureCollection>


xslt文件如下:
<?xml version="1.0" encoding="gb2312"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:xdt="http://www.w3.org/2005/xpath-datatypes" xmlns:wfs="http://www.opengis.net/wfs" xmlns:gml="http://www.opengis.net/gml">
     <xsl:template match="/">
     <svg xmlns:xlink="http://www.w3.org/1999/xlink" x="0" y="0" width="100%" height="100%" viewBox="-0.046875 -0.05 0.090625 0.103125" xmlns="http://www.w3.org/2000/svg">
         <style type="text/css">
.style-s-0 {fill:RGB(4,85,65);fill-opacity:1;stroke:RGB(0,0,0);stroke-width:0.0003432169;}
         </style>
         <g transform="matrix(1500 0 0 -1500 0 3043 )">
             <g id="地块">
             <xsl:for-each select="/wfs:FeatureCollection/gml:featureMember/s ">
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  [color=#FF6600]          到了上面这句实际上根本没有找到节点,所以下面的语句都没有执行,只是空输出了一个svg[/color]
                 <xsl:variable name="Plyid">
                     <xsl:value-of select="id"> </xsl:value-of>
                 </xsl:variable>
                 <xsl:variable name="Pid">
                     <xsl:value-of select="@fid"></xsl:value-of>
                 </xsl:variable>
                 <xsl:variable name="moveto">
                     <xsl:value-of select="substring-before( TheGeometry/gml:Polygon/gml:outerBoundaryIs/gml:LinearRing/gml:coordinates,' ')"/>
                 </xsl:variable>
                 <xsl:variable name="line">
                     <xsl:value-of select="substring-after( TheGeometry/gml:Polygon/gml:outerBoundaryIs/gml:LinearRing/gml:coordinates,' ')"/>
                 </xsl:variable>
                 <xsl:variable name="pathval">
                     <xsl:value-of select="concat('M ','$moveto',' L ','$line',' z')"></xsl:value-of>
                 </xsl:variable>
                 <path id="$Pid" Plyid="$Plyid" d="$pathval"></path>
             </xsl:for-each>
         </g>
         </g>
       </svg>
     </xsl:template>
</xsl:stylesheet>


--  作者:liwqwolf
--  发布时间:6/12/2006 8:54:00 PM

--  
今天把GML数据转SVG时,也遇到这个问题!
请注意的高手给于解答!!

--  作者:liwqwolf
--  发布时间:6/12/2006 8:55:00 PM

--  
不知楼主现在有没有把这个问题搞定!??
--  作者:liwqwolf
--  发布时间:6/12/2006 8:56:00 PM

--  
再顶一下!!希望知道的能回一下!
--  作者:BrBr520
--  发布时间:6/17/2006 11:27:00 AM

--  
高手快来指点 啊,俺也等着想知道
--  作者:幸运女神嘟嘟
--  发布时间:9/19/2006 9:00:00 AM

--  
我也遇到了同样的问题,费了好长一段时间还是没有解决,上面的高手解决了吗?我有邮箱是xy_zhao163@163.com,若可以请发到我的邮箱,非常感谢!
W 3 C h i n a ( since 2003 ) 旗 下 站 点
苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
79.102ms