我希望有人可以通过 Muenchian 分组为我指出正确的方向来帮助我。
我有以下形式的数据:
<?xml version="1.0" encoding="UTF-16"?>
<LandXML schemaLocation="http://www.landxml.org/schema/LandXML-1.2 http://www.landxml.org/schema/LandXML-1.2.xsd" version="1.2" date="2013-08-01" time="22:10:15.294-00:00" readOnly="false" language="english">
<Application name="ListechStyleSheet" version="1, 0, 0, 0" manufacturer="LISTech Pty Ltd" manufacturerURL="www.liscad.com">
<Author createdBy="Listech Development Team" />
</Application>
<Project name="LISCAD" desc="OLC ANGLES JULY 2013" />
<Units>
<Metric linearUnit="meter" areaUnit="squareMeter" volumeUnit="cubicMeter" temperatureUnit="celsius" pressureUnit="HPA" />
</Units>
<Survey>
<ReducedObservation setupID="liscadGM04" azimuth="70.0112" horizDistance="254.696" azimuthType="measured" azimuthAccuracy="0.000300" distanceAccuracy="0.00251">
<TargetPoint pntRef="GM03" />
</ReducedObservation>
<ReducedObservation setupID="liscadGM04" azimuth="70.0114" horizDistance="254.696" azimuthType="measured" azimuthAccuracy="0.000300" distanceAccuracy="0.00251">
<TargetPoint pntRef="GM03" />
</ReducedObservation>
<ReducedObservation setupID="liscadGM04" azimuth="70.0113" horizDistance="254.698" azimuthType="measured" azimuthAccuracy="0.000300" distanceAccuracy="0.00251">
<TargetPoint pntRef="GM03" />
</ReducedObservation>
<ReducedObservation setupID="liscadGM04" azimuth="252.3441" horizDistance="107.081" azimuthType="measured" azimuthAccuracy="0.000300" distanceAccuracy="0.00221">
<TargetPoint pntRef="SAW53" />
</ReducedObservation>
<ReducedObservation setupID="liscadGM04" azimuth="252.3429" horizDistance="107.081" azimuthType="measured" azimuthAccuracy="0.000300" distanceAccuracy="0.00221">
<TargetPoint pntRef="SAW53" />
</ReducedObservation>
<ReducedObservation setupID="liscadGM04" azimuth="309.3846" horizDistance="275.373" azimuthType="measured" azimuthAccuracy="0.000300" distanceAccuracy="0.00255">
<TargetPoint pntRef="HB402" />
</ReducedObservation>
<ReducedObservation setupID="liscadGM04" azimuth="309.3854" horizDistance="275.374" azimuthType="measured" azimuthAccuracy="0.000300" distanceAccuracy="0.00255">
<TargetPoint pntRef="HB402" />
</ReducedObservation>
<ReducedObservation setupID="liscadGM04" azimuth="320.3917" horizDistance="287.557" azimuthType="measured" azimuthAccuracy="0.000300" distanceAccuracy="0.00258">
<TargetPoint pntRef="GM05" />
</ReducedObservation>
<ReducedObservation setupID="liscadGM04" azimuth="320.3913" horizDistance="287.557" azimuthType="measured" azimuthAccuracy="0.000300" distanceAccuracy="0.00258">
<TargetPoint pntRef="GM05" />
</ReducedObservation>
<ReducedObservation setupID="liscadGM04" azimuth="348.0615" horizDistance="108.041" azimuthType="measured" azimuthAccuracy="0.000300" distanceAccuracy="0.00222">
<TargetPoint pntRef="SAW144B" />
</ReducedObservation>
<ReducedObservation setupID="liscadGM04" azimuth="348.0627" horizDistance="108.041" azimuthType="measured" azimuthAccuracy="0.000300" distanceAccuracy="0.00222">
<TargetPoint pntRef="SAW144B" />
</ReducedObservation>
<ReducedObservation setupID="liscadGM04" azimuth="35.4956" horizDistance="174.694" azimuthType="measured" azimuthAccuracy="0.000300" distanceAccuracy="0.00235">
<TargetPoint pntRef="SAW144" />
</ReducedObservation>
<ReducedObservation setupID="liscadGM04" azimuth="35.4955" horizDistance="174.695" azimuthType="measured" azimuthAccuracy="0.000300" distanceAccuracy="0.00235">
<TargetPoint pntRef="SAW144" />
</ReducedObservation>
<ReducedObservation setupID="liscadGM04" azimuth="70.0114" horizDistance="254.696" azimuthType="measured" azimuthAccuracy="0.000300" distanceAccuracy="0.00251">
<TargetPoint pntRef="GM03" />
</ReducedObservation>
<ReducedObservation setupID="liscadGM04" azimuth="70.0112" horizDistance="254.697" azimuthType="measured" azimuthAccuracy="0.000300" distanceAccuracy="0.00251">
<TargetPoint pntRef="GM03" />
</ReducedObservation>
<ReducedObservation setupID="liscadGM04" azimuth="252.3442" horizDistance="107.081" azimuthType="measured" azimuthAccuracy="0.000300" distanceAccuracy="0.00221">
<TargetPoint pntRef="SAW53" />
</ReducedObservation>
<ReducedObservation setupID="liscadGM04" azimuth="252.3431" horizDistance="107.081" azimuthType="measured" azimuthAccuracy="0.000300" distanceAccuracy="0.00221">
<TargetPoint pntRef="SAW53" />
</ReducedObservation>
<ReducedObservation setupID="liscadGM04" azimuth="309.3848" horizDistance="275.374" azimuthType="measured" azimuthAccuracy="0.000300" distanceAccuracy="0.00255">
<TargetPoint pntRef="HB402" />
</ReducedObservation>
<ReducedObservation setupID="liscadGM04" azimuth="309.3855" horizDistance="275.374" azimuthType="measured" azimuthAccuracy="0.000300" distanceAccuracy="0.00255">
<TargetPoint pntRef="HB402" />
</ReducedObservation>
<ReducedObservation setupID="liscadGM04" azimuth="320.3917" horizDistance="287.556" azimuthType="measured" azimuthAccuracy="0.000300" distanceAccuracy="0.00258">
<TargetPoint pntRef="GM05" />
</ReducedObservation>
<ReducedObservation setupID="liscadGM04" azimuth="320.3914" horizDistance="287.557" azimuthType="measured" azimuthAccuracy="0.000300" distanceAccuracy="0.00258">
<TargetPoint pntRef="GM05" />
</ReducedObservation>
<ReducedObservation setupID="liscadGM04" azimuth="348.0613" horizDistance="108.040" azimuthType="measured" azimuthAccuracy="0.000300" distanceAccuracy="0.00222">
<TargetPoint pntRef="SAW144B" />
</ReducedObservation>
<ReducedObservation setupID="liscadGM04" azimuth="348.0626" horizDistance="108.040" azimuthType="measured" azimuthAccuracy="0.000300" distanceAccuracy="0.00222">
<TargetPoint pntRef="SAW144B" />
</ReducedObservation>
<ReducedObservation setupID="liscadGM04" azimuth="35.4955" horizDistance="174.695" azimuthType="measured" azimuthAccuracy="0.000300" distanceAccuracy="0.00235">
<TargetPoint pntRef="SAW144" />
</ReducedObservation>
<ReducedObservation setupID="liscadGM04" azimuth="35.4954" horizDistance="174.695" azimuthType="measured" azimuthAccuracy="0.000300" distanceAccuracy="0.00235">
<TargetPoint pntRef="SAW144" />
</ReducedObservation>
<ReducedObservation setupID="liscadGM04" azimuth="70.0111" horizDistance="254.697" azimuthType="measured" azimuthAccuracy="0.000300" distanceAccuracy="0.00251">
<TargetPoint pntRef="GM03" />
</ReducedObservation>
<ReducedObservation setupID="liscadGM04" azimuth="70.0116" horizDistance="254.698" azimuthType="measured" azimuthAccuracy="0.000300" distanceAccuracy="0.00251">
<TargetPoint pntRef="GM03" />
</ReducedObservation>
<ReducedObservation setupID="liscadGM04" azimuth="252.3441" horizDistance="107.081" azimuthType="measured" azimuthAccuracy="0.000300" distanceAccuracy="0.00221">
<TargetPoint pntRef="SAW53" />
</ReducedObservation>
<ReducedObservation setupID="liscadGM04" azimuth="252.3433" horizDistance="107.081" azimuthType="measured" azimuthAccuracy="0.000300" distanceAccuracy="0.00221">
<TargetPoint pntRef="SAW53" />
</ReducedObservation>
<ReducedObservation setupID="liscadGM04" azimuth="309.3848" horizDistance="275.374" azimuthType="measured" azimuthAccuracy="0.000300" distanceAccuracy="0.00255">
<TargetPoint pntRef="HB402" />
</ReducedObservation>
<ReducedObservation setupID="liscadGM04" azimuth="309.3857" horizDistance="275.374" azimuthType="measured" azimuthAccuracy="0.000300" distanceAccuracy="0.00255">
<TargetPoint pntRef="HB402" />
</ReducedObservation>
<ReducedObservation setupID="liscadGM04" azimuth="320.3917" horizDistance="287.557" azimuthType="measured" azimuthAccuracy="0.000300" distanceAccuracy="0.00258">
<TargetPoint pntRef="GM05" />
</ReducedObservation>
<ReducedObservation setupID="liscadGM04" azimuth="320.3911" horizDistance="287.557" azimuthType="measured" azimuthAccuracy="0.000300" distanceAccuracy="0.00258">
<TargetPoint pntRef="GM05" />
</ReducedObservation>
<ReducedObservation setupID="liscadGM04" azimuth="348.0614" horizDistance="108.041" azimuthType="measured" azimuthAccuracy="0.000300" distanceAccuracy="0.00222">
<TargetPoint pntRef="SAW144B" />
</ReducedObservation>
<ReducedObservation setupID="liscadGM04" azimuth="348.0627" horizDistance="108.040" azimuthType="measured" azimuthAccuracy="0.000300" distanceAccuracy="0.00222">
<TargetPoint pntRef="SAW144B" />
</ReducedObservation>
<ReducedObservation setupID="liscadGM04" azimuth="35.4957" horizDistance="174.695" azimuthType="measured" azimuthAccuracy="0.000300" distanceAccuracy="0.00235">
<TargetPoint pntRef="SAW144" />
</ReducedObservation>
<ReducedObservation setupID="liscadSAW160" azimuth="329.0304" horizDistance="138.077" azimuthType="measured" azimuthAccuracy="0.000300" distanceAccuracy="0.00228">
<TargetPoint pntRef="SAW61" />
</ReducedObservation>
<ReducedObservation setupID="liscadSAW160" azimuth="148.0017" horizDistance="133.943" azimuthType="measured" azimuthAccuracy="0.000300" distanceAccuracy="0.00227">
<TargetPoint pntRef="GM06" />
</ReducedObservation>
<ReducedObservation setupID="liscadSAW160" azimuth="148.0026" horizDistance="133.944" azimuthType="measured" azimuthAccuracy="0.000300" distanceAccuracy="0.00227">
<TargetPoint pntRef="GM06" />
</ReducedObservation>
<ReducedObservation setupID="liscadSAW160" azimuth="149.1505" horizDistance="249.106" azimuthType="measured" azimuthAccuracy="0.000300" distanceAccuracy="0.00250">
<TargetPoint pntRef="SAW59" />
</ReducedObservation>
<ReducedObservation setupID="liscadSAW160" azimuth="149.1451" horizDistance="249.106" azimuthType="measured" azimuthAccuracy="0.000300" distanceAccuracy="0.00250">
<TargetPoint pntRef="SAW59" />
</ReducedObservation>
<ReducedObservation setupID="liscadSAW160" azimuth="160.2644" horizDistance="260.353" azimuthType="measured" azimuthAccuracy="0.000300" distanceAccuracy="0.00252">
<TargetPoint pntRef="SAW159" />
</ReducedObservation>
<ReducedObservation setupID="liscadSAW160" azimuth="160.2659" horizDistance="260.353" azimuthType="measured" azimuthAccuracy="0.000300" distanceAccuracy="0.00252">
<TargetPoint pntRef="SAW159" />
</ReducedObservation>
<ReducedObservation setupID="liscadSAW160" azimuth="244.5944" horizDistance="52.087" azimuthType="measured" azimuthAccuracy="0.000300" distanceAccuracy="0.00210">
<TargetPoint pntRef="SAW60" />
</ReducedObservation>
ETC...
我试图获得如下分组的输出:
liscadGM04
pntRef GM03 Min azimuth=:”70.0109”
pntRef GM03 Max azimuth=:”70.0117”
liscadGM04
pntRef SAW53 Min azimuth=:”107.3429”
pntRef SAW53 Max azimuth=:”107.3442”
liscadGM04
pntRef HB402 Min azimuth=:”309.3845”
pntRef HB402 Max azimuth=:”309.3857”
Etc…..
liscadSAW160
pntRef SAW61 Min azimuth=:”10.0112”
pntRef SAW61 Max azimuth=:”70.0112”
Etc…
我正在努力获得这样的 XSL 代码嵌套,这是我迄今为止的微弱尝试的摘录:
<!-- Define a key that uses our element or attribute for grouping -->
<xsl:key name="SetUp" match="LandXML/Survey/ReducedObservation" use="@setupID" />
<!--<xsl:key name="Target" match="LandXML/Survey/ReducedObservation/TargetPoint" use="@pntRef" />-->
<xsl:key name="Target" match="LandXML/Survey/ReducedObservation/TargetPoint" use="concat(@setupID, '|', @pntRef)" />
<xsl:template match="/">
<html>
<!-- Create a node set for the current Row item (.) and the first
item in the Key of the Current item Category. Then we check the count to see is it 1 or 2..
If 1, So we've the same item in the node set; We have a new Category.-->
<xsl:for-each select="LandXML/Survey/ReducedObservation[count(. | key('SetUp', @setupID)[1]) = 1]">
<!--<xsl:for-each select="LandXML/Survey/ReducedObservation/TargetPoint[count(. | key('Target', @pntRef)[1]) = 1]">-->
<!-- Sort by the Category -->
<xsl:sort select="@setupID" />
<xsl:sort select="TargetPoint/@pntRef" />
<xsl:sort select="@azimuth"/>
<xsl:value-of select='substring(@setupID,7)' />
<br />
<!-- Now loop on the items of this Category, We get them from the Key we defined -->
<xsl:for-each select="key('SetUp', @setupID)">
<!--<xsl:for-each select="key('Target', @pntRef)">-->
<!-- Sort by the item Value -->
<xsl:if test="position() = 1">
Min
<xsl:value-of select="TargetPoint/@pntRef"/>:
<xsl:value-of select="@azimuth"/><br />
</xsl:if>
<xsl:if test="position() = last()">
Max
<xsl:value-of select="TargetPoint/@pntRef"/>:
<xsl:value-of select="@azimuth"/>
</xsl:if>
<!--</xsl:for-each>-->
</xsl:for-each>
<hr />
<br />
</xsl:for-each>
谁能指出我正确的方向?
谢谢
李莫尔斯