在这种情况下如何获得价值并比较价值?

时间:2013-06-18 03:42:59

标签: xml xslt xpath

这是我的XML文件

<?xml version='1.0'  encoding='utf-8' ?>
<RESULTS>
    <ROW>
        <COLUMN NAME="DN"><![CDATA[PLMN-PLMN/RNC-14/WBTS-1/LCG-1]]></COLUMN>
        <COLUMN NAME="ROPTIME"><![CDATA[2013-05-15T07:00:00.000+07:00:00]]></COLUMN>
        <COLUMN NAME="MAX_AVAIL_CE"><![CDATA[432]]></COLUMN>
        <COLUMN NAME="MIN_AVAIL_CE"><![CDATA[432]]></COLUMN>
        <COLUMN NAME="AVG_AVAIL_CE"><![CDATA[432]]></COLUMN>
        <COLUMN NAME="MAX_USED_CE_DL"><![CDATA[33]]></COLUMN>
        <COLUMN NAME="MAX_USED_CE_UL"><![CDATA[15]]></COLUMN>
        <COLUMN NAME="RNC_2283A"><![CDATA[   7.64]]></COLUMN>
        <COLUMN NAME="RNC_2280A"><![CDATA[399]]></COLUMN>
        <COLUMN NAME="RNC_2277A"><![CDATA[   7.64]]></COLUMN>
        <COLUMN NAME="RNC_2278A"><![CDATA[   3.47]]></COLUMN>
        <COLUMN NAME="M5006C15"><![CDATA[720]]></COLUMN>
        <COLUMN NAME="M5006C16"><![CDATA[0]]></COLUMN>
        <COLUMN NAME="M5006C17"><![CDATA[0]]></COLUMN>
        <COLUMN NAME="M5006C18"><![CDATA[0]]></COLUMN>
        <COLUMN NAME="M5006C19"><![CDATA[0]]></COLUMN>
        <COLUMN NAME="M5006C20"><![CDATA[0]]></COLUMN>
        <COLUMN NAME="RNC_2253A"><![CDATA[ 100.00]]></COLUMN>
        <COLUMN NAME="RNC_2254A"><![CDATA[    .00]]></COLUMN>
        <COLUMN NAME="RNC_2255A"><![CDATA[    .00]]></COLUMN>
        <COLUMN NAME="RNC_2256A"><![CDATA[    .00]]></COLUMN>
        <COLUMN NAME="RNC_2257A"><![CDATA[    .00]]></COLUMN>
        <COLUMN NAME="RNC_2258A"><![CDATA[    .00]]></COLUMN>
    </ROW>
    <ROW>
        <COLUMN NAME="DN"><![CDATA[PLMN-PLMN/RNC-14/WBTS-10/LCG-1]]></COLUMN>
        <COLUMN NAME="ROPTIME"><![CDATA[2013-05-15T07:00:00.000+07:00:00]]></COLUMN>
        <COLUMN NAME="MAX_AVAIL_CE"><![CDATA[324]]></COLUMN>
        <COLUMN NAME="MIN_AVAIL_CE"><![CDATA[324]]></COLUMN>
        <COLUMN NAME="AVG_AVAIL_CE"><![CDATA[324]]></COLUMN>
        <COLUMN NAME="MAX_USED_CE_DL"><![CDATA[35]]></COLUMN>
        <COLUMN NAME="MAX_USED_CE_UL"><![CDATA[11]]></COLUMN>
        <COLUMN NAME="RNC_2283A"><![CDATA[  10.80]]></COLUMN>
        <COLUMN NAME="RNC_2280A"><![CDATA[289]]></COLUMN>
        <COLUMN NAME="RNC_2277A"><![CDATA[  10.80]]></COLUMN>
        <COLUMN NAME="RNC_2278A"><![CDATA[   3.40]]></COLUMN>
        <COLUMN NAME="M5006C15"><![CDATA[721]]></COLUMN>
        <COLUMN NAME="M5006C16"><![CDATA[0]]></COLUMN>
        <COLUMN NAME="M5006C17"><![CDATA[0]]></COLUMN>
        <COLUMN NAME="M5006C18"><![CDATA[0]]></COLUMN>
        <COLUMN NAME="M5006C19"><![CDATA[0]]></COLUMN>
        <COLUMN NAME="M5006C20"><![CDATA[0]]></COLUMN>
        <COLUMN NAME="RNC_2253A"><![CDATA[ 100.00]]></COLUMN>
        <COLUMN NAME="RNC_2254A"><![CDATA[    .00]]></COLUMN>
        <COLUMN NAME="RNC_2255A"><![CDATA[    .00]]></COLUMN>
        <COLUMN NAME="RNC_2256A"><![CDATA[    .00]]></COLUMN>
        <COLUMN NAME="RNC_2257A"><![CDATA[    .00]]></COLUMN>
        <COLUMN NAME="RNC_2258A"><![CDATA[    .00]]></COLUMN>
    </ROW>
</RESULTS>

我只想获取@NAME='DN'的数据,DN的值为'PLMN-PLMN/RNC-14/WBTS-1/LCG-1'。 之后,我获得了@NAME='MAX_AVAIL_CE'的数据来计算和导出报告。那我该怎么做呢?

1 个答案:

答案 0 :(得分:0)

此查询将在COLUMNS中返回名称为MAX_AVAIL_CE的所有ROW,其中包含名为DN的列,其值为:

//ROW[COLUMN[@NAME='DN'] = 'PLMN-PLMN/RNC-14/WBTS-1/LCG-1']/COLUMN[@NAME='MAX_AVAIL_CE']