1

我希望有人可以通过 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>

谁能指出我正确的方向?

谢谢

李莫尔斯

4

2 回答 2

3

好的,试试这个基于密钥的解决方案。事实证明,由于您没有按 setupID 进行分组,因此它只是单级分组,而不是多级分组,因此只需要一个键。当我开始根据您的问题标题进行基于变量的分组时,我没有注意到这一点。它产生与我的基于变量的解决方案相同的结果。它将占用更少的内存,希望更少的内存足以在您的环境中工作。

另请注意,您的最小/最大计算是多余的,我的两个解决方案都建议使用更简单的方法。

t:\ftemp>type land.xml 
<?xml version="1.0" encoding="UTF-16"?>
<LandXML 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>
</Survey>
</LandXML>
t:\ftemp>call xslt land.xml land.xsl 
liscadGM04
            pntRef  GM03   Min azimuth:70.0111
            pntRef  GM03   Max azimuth:70.0116
liscadGM04
            pntRef  SAW53   Min azimuth:252.3429
            pntRef  SAW53   Max azimuth:252.3442
liscadGM04
            pntRef  HB402   Min azimuth:309.3846
            pntRef  HB402   Max azimuth:309.3857
liscadGM04
            pntRef  GM05   Min azimuth:320.3911
            pntRef  GM05   Max azimuth:320.3917
liscadGM04
            pntRef  SAW144B   Min azimuth:348.0613
            pntRef  SAW144B   Max azimuth:348.0627
liscadGM04
            pntRef  SAW144   Min azimuth:35.4954
            pntRef  SAW144   Max azimuth:35.4957
liscadSAW160
            pntRef  SAW61   Min azimuth:329.0304
            pntRef  SAW61   Max azimuth:329.0304
liscadSAW160
            pntRef  GM06   Min azimuth:148.0017
            pntRef  GM06   Max azimuth:148.0026
liscadSAW160
            pntRef  SAW59   Min azimuth:149.1451
            pntRef  SAW59   Max azimuth:149.1505
liscadSAW160
            pntRef  SAW159   Min azimuth:160.2644
            pntRef  SAW159   Max azimuth:160.2659
liscadSAW160
            pntRef  SAW60   Min azimuth:244.5944
            pntRef  SAW60   Max azimuth:244.5944

t:\ftemp>type land.xsl 
<?xml version="1.0" encoding="US-ASCII"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version="1.0">

<xsl:output method="text"/>

<xsl:key name="setup-refs" match="ReducedObservation"
         use="concat(@setupID,' ',TargetPoint/@pntRef)"/>

<xsl:template match="/">
  <xsl:for-each select="LandXML/Survey/ReducedObservation
          [generate-id(.)=
           generate-id(key('setup-refs',
                           concat(@setupID,' ',TargetPoint/@pntRef))[1])]">
    <xsl:value-of select="@setupID"/>
    <xsl:text>&#xa;</xsl:text>
    <xsl:variable name="azimuths"
                  select="key('setup-refs',
                              concat(@setupID,' ',TargetPoint/@pntRef))/
                          @azimuth"/>
    <xsl:text>            pntRef  </xsl:text>
    <xsl:value-of select="TargetPoint/@pntRef"/>
    <xsl:text>   Min azimuth:</xsl:text>
    <xsl:value-of select="$azimuths[not(.>$azimuths)][1]"/>
    <xsl:text>&#xa;            pntRef  </xsl:text>
    <xsl:value-of select="TargetPoint/@pntRef"/>
    <xsl:text>   Max azimuth:</xsl:text>
    <xsl:value-of select="$azimuths[not(.&lt;$azimuths)][1]"/>
    <xsl:text>&#xa;</xsl:text>
  </xsl:for-each>
</xsl:template>

</xsl:stylesheet>
t:\ftemp>rem Done! 
于 2013-08-02T21:48:47.793 回答
2

你必须使用Muenchian方法吗?我告诉我的学生,对于多级分组,我发现基于变量的分组方法更容易编写。

t:\ftemp>type land.xml 
<?xml version="1.0" encoding="UTF-16"?>
<LandXML 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>
</Survey>
</LandXML>
t:\ftemp>call xslt land.xml land.xsl 
liscadGM04
            pntRef  GM03   Min azimuth:70.0111
            pntRef  GM03   Max azimuth:70.0116
liscadGM04
            pntRef  SAW53   Min azimuth:252.3429
            pntRef  SAW53   Max azimuth:252.3442
liscadGM04
            pntRef  HB402   Min azimuth:309.3846
            pntRef  HB402   Max azimuth:309.3857
liscadGM04
            pntRef  GM05   Min azimuth:320.3911
            pntRef  GM05   Max azimuth:320.3917
liscadGM04
            pntRef  SAW144B   Min azimuth:348.0613
            pntRef  SAW144B   Max azimuth:348.0627
liscadGM04
            pntRef  SAW144   Min azimuth:35.4954
            pntRef  SAW144   Max azimuth:35.4957
liscadSAW160
            pntRef  SAW61   Min azimuth:329.0304
            pntRef  SAW61   Max azimuth:329.0304
liscadSAW160
            pntRef  GM06   Min azimuth:148.0017
            pntRef  GM06   Max azimuth:148.0026
liscadSAW160
            pntRef  SAW59   Min azimuth:149.1451
            pntRef  SAW59   Max azimuth:149.1505
liscadSAW160
            pntRef  SAW159   Min azimuth:160.2644
            pntRef  SAW159   Max azimuth:160.2659
liscadSAW160
            pntRef  SAW60   Min azimuth:244.5944
            pntRef  SAW60   Max azimuth:244.5944

t:\ftemp>type land.xsl 
<?xml version="1.0" encoding="US-ASCII"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version="1.0">

<xsl:output method="text"/>

<xsl:template match="/">
  <xsl:variable name="obs" select="LandXML/Survey/ReducedObservation"/>
  <xsl:for-each select="$obs">
    <xsl:if test="generate-id(.)=
                  generate-id($obs[@setupID=current()/@setupID][1])">
      <xsl:variable name="setups" 
                    select="$obs[@setupID=current()/@setupID]"/>
      <xsl:variable name="thisSetup" select="@setupID"/>
      <xsl:for-each select="$setups">
        <xsl:if test="generate-id(.)=
                      generate-id($setups[TargetPoint/@pntRef=
                                          current()/TargetPoint/@pntRef][1])">
          <xsl:value-of select="$thisSetup"/>
          <xsl:text>&#xa;</xsl:text>
          <xsl:variable name="points" 
                        select="$setups[TargetPoint/@pntRef=
                                        current()/TargetPoint/@pntRef]"/>
          <xsl:variable name="azimuths"
                        select="$points/@azimuth"/>
          <xsl:text>            pntRef  </xsl:text>
          <xsl:value-of select="TargetPoint/@pntRef"/>
          <xsl:text>   Min azimuth:</xsl:text>
          <xsl:value-of select="$azimuths[not(.>$azimuths)][1]"/>
          <xsl:text>&#xa;            pntRef  </xsl:text>
          <xsl:value-of select="TargetPoint/@pntRef"/>
          <xsl:text>   Max azimuth:</xsl:text>
          <xsl:value-of select="$azimuths[not(.&lt;$azimuths)][1]"/>
          <xsl:text>&#xa;</xsl:text>
        </xsl:if>
      </xsl:for-each>
    </xsl:if>
  </xsl:for-each>
</xsl:template>

</xsl:stylesheet>
t:\ftemp>rem Done! 
于 2013-08-02T15:08:26.183 回答