我只是将我的脚趾浸入 XML 和 XSL,并且(从我所读到的,毫不奇怪)我遇到了命名空间的问题。
我得到了一些 XML,我正在尝试编写一些 XSL,但是我在访问一些命名空间和属性等时遇到了问题......
这是我收到的 XML 的摘录...
<?xml version="1.0" encoding="utf-8"?>
<LandXML xmlns="http://www.landxml.org/schema/LandXML-1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.landxml.org/schema/LandXML-1.2
http://www.landxml.org/schema/LandXML-1.2/LandXML-1.2.xsd"
version="1.2"
date="2013-06-24"
time="01:35:45"
readOnly="false"
language="English">
<Units>
<Metric linearUnit="meter" areaUnit="squareMeter"
volumeUnit="cubicMeter"
angularUnit="decimal dd.mm.ss"
latLongAngularUnit="decimal degrees"
temperatureUnit="celsius"
pressureUnit="milliBars"/>
</Units>
<CoordinateSystem name="HATCH-121204"
horizontalDatum="Local"
verticalDatum="Local"
ellipsoidName="Australian National"
projectedCoordinateSystemName="UTM55"
fileLocation="">
</CoordinateSystem>
<Application name="LandXML Export"
manufacturer="Leica Geosystems AG"
version="4.3"
manufacturerURL="www.leica-geosystems.com">
<Author company="Leica Geosystems AG"
companyURL="www.leica-geosystems.com"
timeStamp="2013-06-24T01:35:45"/>
</Application>
<CgPoints>
<CgPoint name="GPS0093"
oID="GPS0093"
code="728"
desc="Tel
lines u/g"
role="measured"
latitude="-21.968945617359" longitude="148.007359609463"
ellipsoidHeight="288.420425"
timeStamp="2013-06-22T01:55:26"
>7570087.642555 603892.199974 234.579968</CgPoint>
...
...
...
我正在尝试访问:LandXML/CgPoint/CgPoints,这是我编写的 XSL:
<?xml version="1.0" encoding="UTF-8"?>
<!-- DWXMLSource="130622RLA.xml" -->
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://xml.hexagon.com/schema/HeXML-1.5">
<xsl:template match="/">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Field Report</title>
<link rel="stylesheet" type="text/css" href="books2_xslt.css"/>
<p class="header">Field Report</p>
</head>
<body>
<xsl:apply-templates select="CgPoints/CgPoint"/>
</body>
</html>
</xsl:template>
<xsl:template match="CgPoint">
In CgPoints
<xsl:for-each select="@name">
<xsl:value-of select="."/>
HELLO CgPoint
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
出于某种原因,我从未进入“CgPoint”模板(我从未获得“In CgPoints”html 输出)。我在调用和模板定义中尝试了各种“LandXML/CgPoints/CgPoint”、“CgPoints/CgPoint”等组合。
有没有人知道我的误解来自哪里?
提前致谢,
李