比较来自两个不同列表的数字
Compare numbers from two different lists
我是 XSL 编程的超级新手,我有以下 xml;
<InRoads productName="OpenRoads Designer CONNECT Edition - 2020 Release 3" productVersion="10.09.00.91" linearUnits="Metric" angularUnits="Degrees" isInternationalFoot="false" commandName="Geometry Report" >
<GeometryProject name="Default" file="C:\Users\Dennis.Chung\Desktop\GAP RD0421 new kerb setout\RIA-AEC-MOD-130-310-00-3D-CTRL-ROAD_KERBS.dgn" lastRevisedDate="4/30/2021 21:31:11" >
<HorizontalAlignment name="Unnamed" lastRevisedDate="4/30/2021 06:58:57" area="0.000000000" perimeter="90.347392542" closingDistance="90.347392542" closingDirection="-3.059276459318" closingPrecision="1.000000000" northingClosingError="7.428657504" eastingClosingError="90.041470373" fromFeature="false" >
<HorizontalElements >
<HorizontalLine length="90.347392542" direction="0.082316194272" elementNumber="1" >
<Start northing="5838252.765890940" easting="299195.240389283" elevation="-0.160761453" pointType="POB" type="START" name="" >
<station internalStation="0.000000000" externalStation="0.000000000" externalStationName="" />
</Start>
<End northing="5838260.194548440" easting="299285.281859655" elevation="-0.502611998" pointType="POE" type="END" name="" >
<station internalStation="90.347392542" externalStation="90.347393000" externalStationName="" />
</End>
</HorizontalLine>
</HorizontalElements>
<HorizontalCurveSets >
<CurvesetPoint curveSetID="0" tangentDirectionStart="0.082316194272" pointType="POB" type="START" curveSetStartElement="1" >
<GeometryPoint northing="5838252.765890940" easting="299195.240389283" elevation="-0.160761453" pointType="POB" type="START" name="" >
<station internalStation="0.000000000" externalStation="0.000000000" externalStationName="" />
</GeometryPoint>
</CurvesetPoint>
<CurvesetPoint curveSetID="1" tangentDirectionEnd="0.082316194272" pointType="POE" type="END" curveSetStopElement="1" >
<GeometryPoint northing="5838260.194548440" easting="299285.281859655" elevation="-0.502611998" pointType="POE" type="END" name="" >
<station internalStation="90.347392542" externalStation="90.347393000" externalStationName="" />
</GeometryPoint>
</CurvesetPoint>
</HorizontalCurveSets>
<HorizontalEventPoints >
<HorizontalComputedEventPoints >
<HorizontalEventPoint eventType="stationEvent" radius="0.000000000" grade="0.04251083947571" tangentialDirection="0.082316194272" radialDirection="4.794705174656" >
<GeometryPoint northing="5838252.765890940" easting="299195.240389283" elevation="-0.160761453" pointType="POB" type="START" name="" >
<station internalStation="0.000000000" externalStation="0.000000000" externalStationName="" />
</GeometryPoint>
</HorizontalEventPoint>
<HorizontalEventPoint eventType="stationEvent" radius="0.000000000" grade="0.02781531466054" tangentialDirection="0.082316194272" radialDirection="4.794705174656" >
<GeometryPoint northing="5838254.410356220" easting="299215.172667977" elevation="0.638006868" pointType="POT" type="POT" name="" >
<station internalStation="20.000000000" externalStation="20.000000000" externalStationName="" />
</GeometryPoint>
</HorizontalEventPoint>
<HorizontalEventPoint eventType="stationEvent" radius="0.000000000" grade="-0.01416036580177" tangentialDirection="0.082316194272" radialDirection="4.794705174656" >
<GeometryPoint northing="5838256.054821500" easting="299235.104946671" elevation="0.774556356" pointType="POT" type="POT" name="" >
<station internalStation="40.000000000" externalStation="40.000000000" externalStationName="" />
</GeometryPoint>
</HorizontalEventPoint>
<HorizontalEventPoint eventType="stationEvent" radius="0.000000000" grade="-0.02603425086589" tangentialDirection="0.082316194272" radialDirection="4.794705174656" >
<GeometryPoint northing="5838257.699286780" easting="299255.037225365" elevation="0.287459632" pointType="POT" type="POT" name="" >
<station internalStation="60.000000000" externalStation="60.000000000" externalStationName="" />
</GeometryPoint> </HorizontalEventPoint>
<HorizontalEventPoint eventType="stationEvent" radius="0.000000000" grade="-0.02603425086589" tangentialDirection="0.082316194272" radialDirection="4.794705174656" >
<GeometryPoint northing="5838259.343752050" easting="299274.969504060" elevation="-0.233225385" pointType="POT" type="POT" name="" >
<station internalStation="80.000000000" externalStation="80.000000000" externalStationName="" />
</GeometryPoint>
</HorizontalEventPoint>
<HorizontalEventPoint eventType="stationEvent" radius="0.000000000" grade="-0.02603425086589" tangentialDirection="0.082316194272" radialDirection="4.794705174656" >
<GeometryPoint northing="5838260.194548440" easting="299285.281859655" elevation="-0.502611998" pointType="POE" type="END" name="" >
<station internalStation="90.347392542" externalStation="90.347393000" externalStationName="" />
</GeometryPoint>
</HorizontalEventPoint>
</HorizontalComputedEventPoints>
<HorizontalNormalEventPoints >
<EventPointLists >
<EventPointList name="rr" >
<HorizontalEventPoint eventType="stationEvent" radius="0.000000000" grade="-0.00820233459715" tangentialDirection="0.082316194272" radialDirection="4.794705174656" >
<GeometryPoint northing="5838255.821405970" easting="299232.275757552" elevation="0.806297990" pointType="POT" type="POT" name="" >
<station internalStation="37.161198514" externalStation="37.161199000" externalStationName="" />
</GeometryPoint>
</HorizontalEventPoint>
<HorizontalEventPoint eventType="stationEvent" radius="0.000000000" grade="-0.02603425086589" tangentialDirection="0.082316194272" radialDirection="4.794705174656" >
<GeometryPoint northing="5838258.192304850" easting="299261.013012043" elevation="0.131355925" pointType="POT" type="POT" name="" >
<station internalStation="65.996089830" externalStation="65.996090000" externalStationName="" />
</GeometryPoint> </HorizontalEventPoint>
<HorizontalEventPoint eventType="stationEvent" radius="0.000000000" grade="-0.02603425086589" tangentialDirection="0.082316194272" radialDirection="4.794705174656" >
<GeometryPoint northing="5838258.377685960" easting="299263.259984364" elevation="0.072658932" pointType="POT" type="POT" name="" >
<station internalStation="68.250696395" externalStation="68.250696000" externalStationName="" />
</GeometryPoint>
</HorizontalEventPoint>
</EventPointList>
</EventPointLists>
</HorizontalNormalEventPoints>
</HorizontalEventPoints>
</HorizontalAlignment>
</GeometryProject>
</InRoads>
我需要能够以正确的顺序从两个列表(HorizontalEventPoint 和 HorizontalNoramlEventPoint)输出站点,因此输出里程应该是;
0
20
37.161199000
40
60
65.996090000
68.250696395
80
90.347392542
我可以列出 HorizontalEventPoints 中的站点并生成类似这样的内容;
0
20
40
60
80
90.347392542
但不知道如何为两个列表执行此操作。
我只有这样的东西...
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.1"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:msxsl="urn:schemas-
microsoft-com:xslt" xmlns:cif="cif">
<xsl:param name="xslShowHelp" select="cif:xslShowHelp"/>
<xsl:param name="xslRootDirectory" select="cif:xslRootDirectory"/>
<xsl:template match="/">
<xsl:variable name="gridOut"
select="cif:SetGridOut(number(InRoads/@outputGridScaleFactor))"/>
<html>
<head>
<link rel="stylesheet" type="text/css" href="
{$xslRootDirectory}/_Themes/engineer/theme.css"/>
</head>
<body>
<xsl:choose>
<xsl:when test="$xslShowHelp = 'true'">
<xsl:call-template name="StyleSheetHelp"/>
</xsl:when>
<xsl:otherwise>
<xsl:for-each select="InRoads">
<center>
<h2 lang="en">CL -  <xsl:value-of select="GeometryProject/HorizontalAlignment/@name"/></h2>
</center>
<xsl:for-each select="GeometryProject">
<table border="1" cellpadding="2" cellspacing="0" width="100%">
<thead style="display:table-header-group">
<tr>
<th lang="en" valign="bottom">Type</th>
<th lang="en" valign="bottom">Chainage</th>
<th lang="en" valign="bottom">Easting</th>
<th lang="en" valign="bottom">Northing</th>
<th lang="en" valign="bottom">Level</th>
<th lang="en" valign="bottom">Bearing</th>
<th lang="en" valign="bottom">Rad/Spiral</th>
<th lang="en" valign="bottom">A.Length</th>
<th lang="en" valign="bottom">D.Angle</th>
</tr>
</thead>
<tbody>
<xsl:for-each select="HorizontalAlignment">
<xsl:for-each select="HorizontalElements">
<xsl:apply-templates select="//HorizontalLine | //HorizontalCircle | //HorizontalSpiral"/>
</xsl:for-each>
</xsl:for-each>
</tbody>
</table>
</xsl:for-each>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</body>
</html>
</xsl:template>
<xsl:template match="HorizontalLine">
<xsl:variable name="startStation" select="Start/station/@internalStation"/>
<xsl:variable name="endStation" select="End/station/@internalStation"/>
<xsl:if test="Start">
<tr>
<xsl:choose>
<xsl:when test="Start/@pointType = 'POB'">
<td align="center" lang="en">IP</td>
</xsl:when>
<xsl:when test="Start/@pointType = 'PI'">
<td align="center" lang="en">IP</td>
</xsl:when>
<xsl:otherwise>
<td align="center"><xsl:value-of select="cif:pointType(string(Start/@pointType))"/></td>
</xsl:otherwise>
</xsl:choose>
<td align="center" style="white-space:nowrap">
<xsl:value-of select="cif:stationFormat(number(Start/station/@externalStation), string(Start/station/@externalStationName))"/>
</td>
<td align="center">
<xsl:value-of select="cif:ordinateFormat(number(Start/@easting))"/>
</td>
<td align="center">
<xsl:value-of select="cif:ordinateFormat(number(Start/@northing))"/>
</td>
<td align="center">
<xsl:value-of select="cif:ordinateFormat(number(Start/@elevation))"/>
</td>
<td align="center">
<xsl:value-of select="cif:directionFormat(number(@direction))"/>
</td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</xsl:if>
<xsl:for-each select="../../HorizontalEventPoints">
<xsl:variable name="list1" select="*/HorizontalEventPoint[GeometryPoint/station/@internalStation > $startStation]"/>
<xsl:for-each select="$list1[GeometryPoint/station/@internalStation < $endStation]">
<tr>
<td> </td>
<td align="center" style="white-space:nowrap">
<xsl:value-of select="cif:stationFormat(number(GeometryPoint/station/@externalStation), string(GeometryPoint/station/@externalStationName))"/>
</td>
<td align="center">
<xsl:value-of select="cif:ordinateFormat(number(GeometryPoint/@easting))"/>
</td>
<td align="center">
<xsl:value-of select="cif:ordinateFormat(number(GeometryPoint/@northing))"/>
</td>
<td align="center">
<xsl:value-of select="cif:ordinateFormat(number(GeometryPoint/@elevation))"/>
</td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</xsl:for-each>
</xsl:for-each>
<xsl:if test="End[@pointType = 'POE']">
<tr>
<td align="center" lang="en">IP</td>
<td align="right" style="white-space:nowrap">
<xsl:value-of select="cif:stationFormat(number(End/station/@externalStation), string(End/station/@externalStationName))"/>
</td>
<td align="center">
<xsl:value-of select="cif:ordinateFormat(number(End/@easting))"/>
</td>
<td align="center">
<xsl:value-of select="cif:ordinateFormat(number(End/@northing))"/>
</td>
<td align="center">
<xsl:value-of select="cif:ordinateFormat(number(End/@elevation))"/>
</td>
<td align="center">
<xsl:value-of select="cif:directionFormat(number(@direction))"/>
</td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</xsl:if>
</xsl:template>
**strong text**</xsl:stylesheet>
提前致谢
您显示的输出可以很容易地通过以下方式生成:
XSLT 1.0
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" encoding="UTF-8"/>
<xsl:template match="/InRoads">
<xsl:for-each select="GeometryProject/HorizontalAlignment/HorizontalEventPoints/HorizontalComputedEventPoints/HorizontalEventPoint | GeometryProject/HorizontalAlignment/HorizontalEventPoints/HorizontalNormalEventPoints/EventPointLists/EventPointList/HorizontalEventPoint">
<xsl:sort select="GeometryPoint/station/@internalStation" data-type="number" order="ascending"/>
<xsl:value-of select="number(GeometryPoint/station/@internalStation)"/>
<xsl:text> </xsl:text>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
如果您可以确定在您感兴趣的两个列表之外不存在任何 HorizontalEventPoint
元素,您可以将代码缩短为:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" encoding="UTF-8"/>
<xsl:template match="/InRoads">
<xsl:for-each select="//HorizontalEventPoint">
<xsl:sort select="GeometryPoint/station/@internalStation" data-type="number" order="ascending"/>
<xsl:value-of select="number(GeometryPoint/station/@internalStation)"/>
<xsl:text> </xsl:text>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
虽然这给处理器带来了更多负担,以在整个 XML 文档中查找所有 HorizontalEventPoint
元素。
我是 XSL 编程的超级新手,我有以下 xml;
<InRoads productName="OpenRoads Designer CONNECT Edition - 2020 Release 3" productVersion="10.09.00.91" linearUnits="Metric" angularUnits="Degrees" isInternationalFoot="false" commandName="Geometry Report" >
<GeometryProject name="Default" file="C:\Users\Dennis.Chung\Desktop\GAP RD0421 new kerb setout\RIA-AEC-MOD-130-310-00-3D-CTRL-ROAD_KERBS.dgn" lastRevisedDate="4/30/2021 21:31:11" >
<HorizontalAlignment name="Unnamed" lastRevisedDate="4/30/2021 06:58:57" area="0.000000000" perimeter="90.347392542" closingDistance="90.347392542" closingDirection="-3.059276459318" closingPrecision="1.000000000" northingClosingError="7.428657504" eastingClosingError="90.041470373" fromFeature="false" >
<HorizontalElements >
<HorizontalLine length="90.347392542" direction="0.082316194272" elementNumber="1" >
<Start northing="5838252.765890940" easting="299195.240389283" elevation="-0.160761453" pointType="POB" type="START" name="" >
<station internalStation="0.000000000" externalStation="0.000000000" externalStationName="" />
</Start>
<End northing="5838260.194548440" easting="299285.281859655" elevation="-0.502611998" pointType="POE" type="END" name="" >
<station internalStation="90.347392542" externalStation="90.347393000" externalStationName="" />
</End>
</HorizontalLine>
</HorizontalElements>
<HorizontalCurveSets >
<CurvesetPoint curveSetID="0" tangentDirectionStart="0.082316194272" pointType="POB" type="START" curveSetStartElement="1" >
<GeometryPoint northing="5838252.765890940" easting="299195.240389283" elevation="-0.160761453" pointType="POB" type="START" name="" >
<station internalStation="0.000000000" externalStation="0.000000000" externalStationName="" />
</GeometryPoint>
</CurvesetPoint>
<CurvesetPoint curveSetID="1" tangentDirectionEnd="0.082316194272" pointType="POE" type="END" curveSetStopElement="1" >
<GeometryPoint northing="5838260.194548440" easting="299285.281859655" elevation="-0.502611998" pointType="POE" type="END" name="" >
<station internalStation="90.347392542" externalStation="90.347393000" externalStationName="" />
</GeometryPoint>
</CurvesetPoint>
</HorizontalCurveSets>
<HorizontalEventPoints >
<HorizontalComputedEventPoints >
<HorizontalEventPoint eventType="stationEvent" radius="0.000000000" grade="0.04251083947571" tangentialDirection="0.082316194272" radialDirection="4.794705174656" >
<GeometryPoint northing="5838252.765890940" easting="299195.240389283" elevation="-0.160761453" pointType="POB" type="START" name="" >
<station internalStation="0.000000000" externalStation="0.000000000" externalStationName="" />
</GeometryPoint>
</HorizontalEventPoint>
<HorizontalEventPoint eventType="stationEvent" radius="0.000000000" grade="0.02781531466054" tangentialDirection="0.082316194272" radialDirection="4.794705174656" >
<GeometryPoint northing="5838254.410356220" easting="299215.172667977" elevation="0.638006868" pointType="POT" type="POT" name="" >
<station internalStation="20.000000000" externalStation="20.000000000" externalStationName="" />
</GeometryPoint>
</HorizontalEventPoint>
<HorizontalEventPoint eventType="stationEvent" radius="0.000000000" grade="-0.01416036580177" tangentialDirection="0.082316194272" radialDirection="4.794705174656" >
<GeometryPoint northing="5838256.054821500" easting="299235.104946671" elevation="0.774556356" pointType="POT" type="POT" name="" >
<station internalStation="40.000000000" externalStation="40.000000000" externalStationName="" />
</GeometryPoint>
</HorizontalEventPoint>
<HorizontalEventPoint eventType="stationEvent" radius="0.000000000" grade="-0.02603425086589" tangentialDirection="0.082316194272" radialDirection="4.794705174656" >
<GeometryPoint northing="5838257.699286780" easting="299255.037225365" elevation="0.287459632" pointType="POT" type="POT" name="" >
<station internalStation="60.000000000" externalStation="60.000000000" externalStationName="" />
</GeometryPoint> </HorizontalEventPoint>
<HorizontalEventPoint eventType="stationEvent" radius="0.000000000" grade="-0.02603425086589" tangentialDirection="0.082316194272" radialDirection="4.794705174656" >
<GeometryPoint northing="5838259.343752050" easting="299274.969504060" elevation="-0.233225385" pointType="POT" type="POT" name="" >
<station internalStation="80.000000000" externalStation="80.000000000" externalStationName="" />
</GeometryPoint>
</HorizontalEventPoint>
<HorizontalEventPoint eventType="stationEvent" radius="0.000000000" grade="-0.02603425086589" tangentialDirection="0.082316194272" radialDirection="4.794705174656" >
<GeometryPoint northing="5838260.194548440" easting="299285.281859655" elevation="-0.502611998" pointType="POE" type="END" name="" >
<station internalStation="90.347392542" externalStation="90.347393000" externalStationName="" />
</GeometryPoint>
</HorizontalEventPoint>
</HorizontalComputedEventPoints>
<HorizontalNormalEventPoints >
<EventPointLists >
<EventPointList name="rr" >
<HorizontalEventPoint eventType="stationEvent" radius="0.000000000" grade="-0.00820233459715" tangentialDirection="0.082316194272" radialDirection="4.794705174656" >
<GeometryPoint northing="5838255.821405970" easting="299232.275757552" elevation="0.806297990" pointType="POT" type="POT" name="" >
<station internalStation="37.161198514" externalStation="37.161199000" externalStationName="" />
</GeometryPoint>
</HorizontalEventPoint>
<HorizontalEventPoint eventType="stationEvent" radius="0.000000000" grade="-0.02603425086589" tangentialDirection="0.082316194272" radialDirection="4.794705174656" >
<GeometryPoint northing="5838258.192304850" easting="299261.013012043" elevation="0.131355925" pointType="POT" type="POT" name="" >
<station internalStation="65.996089830" externalStation="65.996090000" externalStationName="" />
</GeometryPoint> </HorizontalEventPoint>
<HorizontalEventPoint eventType="stationEvent" radius="0.000000000" grade="-0.02603425086589" tangentialDirection="0.082316194272" radialDirection="4.794705174656" >
<GeometryPoint northing="5838258.377685960" easting="299263.259984364" elevation="0.072658932" pointType="POT" type="POT" name="" >
<station internalStation="68.250696395" externalStation="68.250696000" externalStationName="" />
</GeometryPoint>
</HorizontalEventPoint>
</EventPointList>
</EventPointLists>
</HorizontalNormalEventPoints>
</HorizontalEventPoints>
</HorizontalAlignment>
</GeometryProject>
</InRoads>
我需要能够以正确的顺序从两个列表(HorizontalEventPoint 和 HorizontalNoramlEventPoint)输出站点,因此输出里程应该是;
0
20
37.161199000
40
60
65.996090000
68.250696395
80
90.347392542
我可以列出 HorizontalEventPoints 中的站点并生成类似这样的内容;
0
20
40
60
80
90.347392542
但不知道如何为两个列表执行此操作。
我只有这样的东西...
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.1"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:msxsl="urn:schemas-
microsoft-com:xslt" xmlns:cif="cif">
<xsl:param name="xslShowHelp" select="cif:xslShowHelp"/>
<xsl:param name="xslRootDirectory" select="cif:xslRootDirectory"/>
<xsl:template match="/">
<xsl:variable name="gridOut"
select="cif:SetGridOut(number(InRoads/@outputGridScaleFactor))"/>
<html>
<head>
<link rel="stylesheet" type="text/css" href="
{$xslRootDirectory}/_Themes/engineer/theme.css"/>
</head>
<body>
<xsl:choose>
<xsl:when test="$xslShowHelp = 'true'">
<xsl:call-template name="StyleSheetHelp"/>
</xsl:when>
<xsl:otherwise>
<xsl:for-each select="InRoads">
<center>
<h2 lang="en">CL -  <xsl:value-of select="GeometryProject/HorizontalAlignment/@name"/></h2>
</center>
<xsl:for-each select="GeometryProject">
<table border="1" cellpadding="2" cellspacing="0" width="100%">
<thead style="display:table-header-group">
<tr>
<th lang="en" valign="bottom">Type</th>
<th lang="en" valign="bottom">Chainage</th>
<th lang="en" valign="bottom">Easting</th>
<th lang="en" valign="bottom">Northing</th>
<th lang="en" valign="bottom">Level</th>
<th lang="en" valign="bottom">Bearing</th>
<th lang="en" valign="bottom">Rad/Spiral</th>
<th lang="en" valign="bottom">A.Length</th>
<th lang="en" valign="bottom">D.Angle</th>
</tr>
</thead>
<tbody>
<xsl:for-each select="HorizontalAlignment">
<xsl:for-each select="HorizontalElements">
<xsl:apply-templates select="//HorizontalLine | //HorizontalCircle | //HorizontalSpiral"/>
</xsl:for-each>
</xsl:for-each>
</tbody>
</table>
</xsl:for-each>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
</body>
</html>
</xsl:template>
<xsl:template match="HorizontalLine">
<xsl:variable name="startStation" select="Start/station/@internalStation"/>
<xsl:variable name="endStation" select="End/station/@internalStation"/>
<xsl:if test="Start">
<tr>
<xsl:choose>
<xsl:when test="Start/@pointType = 'POB'">
<td align="center" lang="en">IP</td>
</xsl:when>
<xsl:when test="Start/@pointType = 'PI'">
<td align="center" lang="en">IP</td>
</xsl:when>
<xsl:otherwise>
<td align="center"><xsl:value-of select="cif:pointType(string(Start/@pointType))"/></td>
</xsl:otherwise>
</xsl:choose>
<td align="center" style="white-space:nowrap">
<xsl:value-of select="cif:stationFormat(number(Start/station/@externalStation), string(Start/station/@externalStationName))"/>
</td>
<td align="center">
<xsl:value-of select="cif:ordinateFormat(number(Start/@easting))"/>
</td>
<td align="center">
<xsl:value-of select="cif:ordinateFormat(number(Start/@northing))"/>
</td>
<td align="center">
<xsl:value-of select="cif:ordinateFormat(number(Start/@elevation))"/>
</td>
<td align="center">
<xsl:value-of select="cif:directionFormat(number(@direction))"/>
</td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</xsl:if>
<xsl:for-each select="../../HorizontalEventPoints">
<xsl:variable name="list1" select="*/HorizontalEventPoint[GeometryPoint/station/@internalStation > $startStation]"/>
<xsl:for-each select="$list1[GeometryPoint/station/@internalStation < $endStation]">
<tr>
<td> </td>
<td align="center" style="white-space:nowrap">
<xsl:value-of select="cif:stationFormat(number(GeometryPoint/station/@externalStation), string(GeometryPoint/station/@externalStationName))"/>
</td>
<td align="center">
<xsl:value-of select="cif:ordinateFormat(number(GeometryPoint/@easting))"/>
</td>
<td align="center">
<xsl:value-of select="cif:ordinateFormat(number(GeometryPoint/@northing))"/>
</td>
<td align="center">
<xsl:value-of select="cif:ordinateFormat(number(GeometryPoint/@elevation))"/>
</td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</xsl:for-each>
</xsl:for-each>
<xsl:if test="End[@pointType = 'POE']">
<tr>
<td align="center" lang="en">IP</td>
<td align="right" style="white-space:nowrap">
<xsl:value-of select="cif:stationFormat(number(End/station/@externalStation), string(End/station/@externalStationName))"/>
</td>
<td align="center">
<xsl:value-of select="cif:ordinateFormat(number(End/@easting))"/>
</td>
<td align="center">
<xsl:value-of select="cif:ordinateFormat(number(End/@northing))"/>
</td>
<td align="center">
<xsl:value-of select="cif:ordinateFormat(number(End/@elevation))"/>
</td>
<td align="center">
<xsl:value-of select="cif:directionFormat(number(@direction))"/>
</td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</xsl:if>
</xsl:template>
**strong text**</xsl:stylesheet>
提前致谢
您显示的输出可以很容易地通过以下方式生成:
XSLT 1.0
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" encoding="UTF-8"/>
<xsl:template match="/InRoads">
<xsl:for-each select="GeometryProject/HorizontalAlignment/HorizontalEventPoints/HorizontalComputedEventPoints/HorizontalEventPoint | GeometryProject/HorizontalAlignment/HorizontalEventPoints/HorizontalNormalEventPoints/EventPointLists/EventPointList/HorizontalEventPoint">
<xsl:sort select="GeometryPoint/station/@internalStation" data-type="number" order="ascending"/>
<xsl:value-of select="number(GeometryPoint/station/@internalStation)"/>
<xsl:text> </xsl:text>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
如果您可以确定在您感兴趣的两个列表之外不存在任何 HorizontalEventPoint
元素,您可以将代码缩短为:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" encoding="UTF-8"/>
<xsl:template match="/InRoads">
<xsl:for-each select="//HorizontalEventPoint">
<xsl:sort select="GeometryPoint/station/@internalStation" data-type="number" order="ascending"/>
<xsl:value-of select="number(GeometryPoint/station/@internalStation)"/>
<xsl:text> </xsl:text>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
虽然这给处理器带来了更多负担,以在整个 XML 文档中查找所有 HorizontalEventPoint
元素。