xsl for-each多重结果过滤
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了xsl for-each多重结果过滤相关的知识,希望对你有一定的参考价值。
关于这里的第一个问题,对于任何格式错误都很抱歉......我在使用xslt 1.0过滤一些xml结果时遇到了问题,并且已经让我的大脑震惊了一个星期。我在这里看了一下但找不到我想做的事情,所以我想我会问自己的问题。
我想要的输出是一个包含行和列的表;不能在这里使用实际的html(我使用下划线代替制表符),所以这里是一般的外观:
Process Log for Pressure Tests:
第6步 - 压力测试#1 __开始时间:09-FEB-2018 14:21:01 __持续时间:00:45:00 日期时间_____压力(psi)_______温度(°C)_______温度2(°C)_______排水压力(psi)_______ 09-FEB-2018 12:21:01 _______ 4.4 _______ 77.8 _______ 80.1 ______ 0.2 09-FEB-2018 12:22:01 _______ 4.3 _______ 77.9 _______ 80.0 ______ 0.2 ... 09-FEB-2018 12:55:01 _______ 4.5 _______ 81.7 _______ 88.2 ______ 1.1 第8步 - 压力测试#2 __开始时间:09-FEB-2018 15:21:01 __持续时间:00:15:00 日期时间__压力(psi)__温度(°C)__温度2(°C)__排水压力(psi)__ 09-FEB-2018 15:21:01 _______ 6.4 _______ 77.8 _______ 80.1 ______ 0.3 09-FEB-2018 15:22:01 _______ 6.3 _______ 77.9 _______ 80.0 ______ 0.1 ... 09-FEB-2018 15:35:01 _______ 6.5 _______ 81.7 _______ 88.2 ______ 0.9
xml源类似于以下内容:
<folders NODE_NUMBER="87" RUN_START_DATETIME_LOCAL="2018-02-09 15:21:01.000"
DURATION="15 Mins 00 Secs" START_DATETIME_UTC="2018-02-09 20:21:01.000"
CONTEXT_SOURCE="1" UTC_EXPLICIT="FALSE" RUN_TYPE="folders" NUMBER="Step 13 -
Pressure Test #2" START_DATETIME_LOCAL="2018-02-09 15:21:01.000"
RUN_STOP_DATETIME="09-Feb-2018 15:36:01" IN_PROGRESS="FALSE"
END_DATETIME_LOCAL="2018-02-09 15:36:01.000" RUN_STOP_DATETIME_LOCAL="2018-02-09 15:36:01.000" RUN_NAME="Step 13 - Pressure Test #2" RUN_START_DATETIME="09-Feb-2018 15:21:01" END_DATETIME="09-Feb-2018 15:36:01" START_SORTTIME="20180209152101" TOTALSECONDS_UTC="900.0" DURATION_UTC="DAY=0000;HR=00;MIN=14;SEC=59;MS=1000;" TOTALSECONDS="900" START_DATETIME="09-Feb-2018 15:21:01" RUN_ID="{301C81C5-5266-4DEA-901D-5D9B2C285CC0}" END_DATETIME_UTC="2018-02-09 20:36:01.000" STOP_SORTTIME="20180209153601" NAME="Step Time Range" VISIBLE="1" REQUIRED="1" OUTPUT_TO_REPORT="1" HIERARCHY_PATH="cyclefolders" START_SOURCE="*" END_SOURCE="*">
<ITEM NODE_NUMBER="88" SORT_ORDER="20" UTC="0" DATASOURCE_ID="10" PSTART="" SOURCE_ID="" TAG="PL" VISIBLE="1" DESCRIPTION="" IDPK="2023" EXEC_CONDITION="" DELIMITER="" PRECISION="1" VERSION="1" OCCURRENCE="" ITEMTYPE="DEFAULT" SOURCE="10-LSV1-XI105/AI1/OUT.CV" OUTPUT_TO_REPORT="1" ID="12062" NAME="Drain Press" DATA_SCOPE="0" PLENGTH="" REQUIRED="1" UOM="psig">
<RESULT NODE_NUMBER="89" TYPE="TABLE" NAME="TABLE" AGGREGATE="INTERPOLATIVE" VISIBLE="1" OUTPUT_TO_REPORT="1">
<RESULT_RECORD DATA="28.8" TIME="09-Feb-2018 15:21:01" QUALITY="200C0 (OPCHDA_INTERPOLATED | OPC_QUALITY_GOOD)" TAG="10-LSV1-XI105/AI1/OUT.CV"/>
<RESULT_RECORD DATA="46.2" TIME="09-Feb-2018 15:22:01" QUALITY="200C0 (OPCHDA_INTERPOLATED | OPC_QUALITY_GOOD)" TAG="10-LSV1-XI105/AI1/OUT.CV"/>
<RESULT_RECORD DATA="46.2" TIME="09-Feb-2018 15:23:01" QUALITY="200C0 (OPCHDA_INTERPOLATED | OPC_QUALITY_GOOD)" TAG="10-LSV1-XI105/AI1/OUT.CV"/>
<RESULT_RECORD DATA="46.2" TIME="09-Feb-2018 15:24:01" QUALITY="200C0 (OPCHDA_INTERPOLATED | OPC_QUALITY_GOOD)" TAG="10-LSV1-XI105/AI1/OUT.CV"/>
<RESULT_RECORD DATA="46.2" TIME="09-Feb-2018 15:25:01" QUALITY="200C0 (OPCHDA_INTERPOLATED | OPC_QUALITY_GOOD)" TAG="10-LSV1-XI105/AI1/OUT.CV"/>
<RESULT_RECORD DATA="46.2" TIME="09-Feb-2018 15:26:01" QUALITY="200C0 (OPCHDA_INTERPOLATED | OPC_QUALITY_GOOD)" TAG="10-LSV1-XI105/AI1/OUT.CV"/>
<RESULT_RECORD DATA="46.2" TIME="09-Feb-2018 15:27:01" QUALITY="200C0 (OPCHDA_INTERPOLATED | OPC_QUALITY_GOOD)" TAG="10-LSV1-XI105/AI1/OUT.CV"/>
<RESULT_RECORD DATA="21.7" TIME="09-Feb-2018 15:28:01" QUALITY="200C0 (OPCHDA_INTERPOLATED | OPC_QUALITY_GOOD)" TAG="10-LSV1-XI105/AI1/OUT.CV"/>
<RESULT_RECORD DATA="0.2" TIME="09-Feb-2018 15:29:01" QUALITY="200C0 (OPCHDA_INTERPOLATED | OPC_QUALITY_GOOD)" TAG="10-LSV1-XI105/AI1/OUT.CV"/>
<RESULT_RECORD DATA="0.2" TIME="09-Feb-2018 15:30:01" QUALITY="200C0 (OPCHDA_INTERPOLATED | OPC_QUALITY_GOOD)" TAG="10-LSV1-XI105/AI1/OUT.CV"/>
<RESULT_RECORD DATA="0.2" TIME="09-Feb-2018 15:31:01" QUALITY="200C0 (OPCHDA_INTERPOLATED | OPC_QUALITY_GOOD)" TAG="10-LSV1-XI105/AI1/OUT.CV"/>
<RESULT_RECORD DATA="0.2" TIME="09-Feb-2018 15:32:01" QUALITY="200C0 (OPCHDA_INTERPOLATED | OPC_QUALITY_GOOD)" TAG="10-LSV1-XI105/AI1/OUT.CV"/>
<RESULT_RECORD DATA="0.2" TIME="09-Feb-2018 15:33:01" QUALITY="200C0 (OPCHDA_INTERPOLATED | OPC_QUALITY_GOOD)" TAG="10-LSV1-XI105/AI1/OUT.CV"/>
<RESULT_RECORD DATA="0.2" TIME="09-Feb-2018 15:34:01" QUALITY="200C0 (OPCHDA_INTERPOLATED | OPC_QUALITY_GOOD)" TAG="10-LSV1-XI105/AI1/OUT.CV"/>
<RESULT_RECORD DATA="0.2" TIME="09-Feb-2018 15:35:01" QUALITY="200C0 (OPCHDA_INTERPOLATED | OPC_QUALITY_GOOD)" TAG="10-LSV1-XI105/AI1/OUT.CV"/>
</RESULT>
<RESULT NODE_NUMBER="90" TYPE="CALC" EVENTVALUE="MINIMUM" VISIBLE="1" OUTPUT_TO_REPORT="1">
<RESULT_RECORD DATA="0.2" RAW_DATA="0.200000" TIME="09-Feb-2018 15:21:01" TAG="10-LSV1-XI105/AI1/OUT.CV"/>
</RESULT>
<RESULT NODE_NUMBER="91" TYPE="CALC" EVENTVALUE="MAXIMUM" VISIBLE="1" OUTPUT_TO_REPORT="1">
<RESULT_RECORD DATA="46.2" RAW_DATA="46.200001" TIME="09-Feb-2018 15:21:01" TAG="10-LSV1-XI105/AI1/OUT.CV"/>
</RESULT>
</ITEM>
<ITEM NODE_NUMBER="92" SORT_ORDER="30" UTC="1" DATASOURCE_ID="10" PSTART="" SOURCE_ID="" TAG="PL" VISIBLE="1" DESCRIPTION="" IDPK="2024" EXEC_CONDITION="" DELIMITER="" PRECISION="1" VERSION="1" OCCURRENCE="" ITEMTYPE="DEFAULT" SOURCE="10-LSV1-XI106/AI1/OUT.CV" OUTPUT_TO_REPORT="1" ID="12065" NAME="Bypass Drain Temp" DATA_SCOPE="0" PLENGTH="" REQUIRED="1" UOM="Deg C">
<RESULT NODE_NUMBER="93" TYPE="TABLE" NAME="TABLE" AGGREGATE="INTERPOLATIVE" VISIBLE="1" OUTPUT_TO_REPORT="1">
<RESULT_RECORD DATA="23.9" TIME="09-Feb-2018 15:21:01" QUALITY="200C0 (OPCHDA_INTERPOLATED | OPC_QUALITY_GOOD)" TAG="10-LSV1-XI106/AI1/OUT.CV"/>
<RESULT_RECORD DATA="24.1" TIME="09-Feb-2018 15:22:01" QUALITY="200C0 (OPCHDA_INTERPOLATED | OPC_QUALITY_GOOD)" TAG="10-LSV1-XI106/AI1/OUT.CV"/>
<RESULT_RECORD DATA="24.1" TIME="09-Feb-2018 15:23:01" QUALITY="200C0 (OPCHDA_INTERPOLATED | OPC_QUALITY_GOOD)" TAG="10-LSV1-XI106/AI1/OUT.CV"/>
<RESULT_RECORD DATA="24.1" TIME="09-Feb-2018 15:24:01" QUALITY="200C0 (OPCHDA_INTERPOLATED | OPC_QUALITY_GOOD)" TAG="10-LSV1-XI106/AI1/OUT.CV"/>
<RESULT_RECORD DATA="24.1" TIME="09-Feb-2018 15:25:01" QUALITY="200C0 (OPCHDA_INTERPOLATED | OPC_QUALITY_GOOD)" TAG="10-LSV1-XI106/AI1/OUT.CV"/>
<RESULT_RECORD DATA="24.1" TIME="09-Feb-2018 15:26:01" QUALITY="200C0 (OPCHDA_INTERPOLATED | OPC_QUALITY_GOOD)" TAG="10-LSV1-XI106/AI1/OUT.CV"/>
<RESULT_RECORD DATA="24.1" TIME="09-Feb-2018 15:27:01" QUALITY="200C0 (OPCHDA_INTERPOLATED | OPC_QUALITY_GOOD)" TAG="10-LSV1-XI106/AI1/OUT.CV"/>
<RESULT_RECORD DATA="24.1" TIME="09-Feb-2018 15:28:01" QUALITY="200C0 (OPCHDA_INTERPOLATED | OPC_QUALITY_GOOD)" TAG="10-LSV1-XI106/AI1/OUT.CV"/>
<RESULT_RECORD DATA="24.1" TIME="09-Feb-2018 15:29:01" QUALITY="200C0 (OPCHDA_INTERPOLATED | OPC_QUALITY_GOOD)" TAG="10-LSV1-XI106/AI1/OUT.CV"/>
<RESULT_RECORD DATA="24.1" TIME="09-Feb-2018 15:30:01" QUALITY="200C0 (OPCHDA_INTERPOLATED | OPC_QUALITY_GOOD)" TAG="10-LSV1-XI106/AI1/OUT.CV"/>
<RESULT_RECORD DATA="24.1" TIME="09-Feb-2018 15:31:01" QUALITY="200C0 (OPCHDA_INTERPOLATED | OPC_QUALITY_GOOD)" TAG="10-LSV1-XI106/AI1/OUT.CV"/>
<RESULT_RECORD DATA="24.1" TIME="09-Feb-2018 15:32:01" QUALITY="200C0 (OPCHDA_INTERPOLATED | OPC_QUALITY_GOOD)" TAG="10-LSV1-XI106/AI1/OUT.CV"/>
<RESULT_RECORD DATA="24.1" TIME="09-Feb-2018 15:33:01" QUALITY="200C0 (OPCHDA_INTERPOLATED | OPC_QUALITY_GOOD)" TAG="10-LSV1-XI106/AI1/OUT.CV"/>
<RESULT_RECORD DATA="24.1" TIME="09-Feb-2018 15:34:01" QUALITY="200C0 (OPCHDA_INTERPOLATED | OPC_QUALITY_GOOD)" TAG="10-LSV1-XI106/AI1/OUT.CV"/>
<RESULT_RECORD DATA="24.1" TIME="09-Feb-2018 15:35:01" QUALITY="200C0 (OPCHDA_INTERPOLATED | OPC_QUALITY_GOOD)" TAG="10-LSV1-XI106/AI1/OUT.CV"/>
</RESULT>
<RESULT NODE_NUMBER="94" TYPE="CALC" EVENTVALUE="MINIMUM" VISIBLE="1" OUTPUT_TO_REPORT="1">
<RESULT_RECORD DATA="23.9" RAW_DATA="23.900000" TIME="09-Feb-2018 15:21:01" TAG="10-LSV1-XI106/AI1/OUT.CV"/>
</RESULT>
<RESULT NODE_NUMBER="95" TYPE="CALC" EVENTVALUE="MAXIMUM" VISIBLE="1" OUTPUT_TO_REPORT="1">
<RESULT_RECORD DATA="24.1" RAW_DATA="24.100000" TIME="09-Feb-2018 15:21:01" TAG="10-LSV1-XI106/AI1/OUT.CV"/>
</RESULT>
</ITEM>
<ITEM NODE_NUMBER="96" SORT_ORDER="40" UTC="1" DATASOURCE_ID="10" PSTART="" SOURCE_ID="" TAG="PL" VISIBLE="1" DESCRIPTION="" IDPK="2025" EXEC_CONDITION="" DELIMITER="" PRECISION="1" VERSION="1" OCCURRENCE="" ITEMTYPE="DEFAULT" SOURCE="10-LSV1-XI107/AI1/OUT.CV" OUTPUT_TO_REPORT="1" ID="12070" NAME="Drain Temp" DATA_SCOPE="0" PLENGTH="" REQUIRED="1" UOM="Deg C">
<RESULT NODE_NUMBER="97" TYPE="TABLE" NAME="TABLE" AGGREGATE="INTERPOLATIVE" VISIBLE="1" OUTPUT_TO_REPORT="1">
<RESULT_RECORD DATA="25.9" TIME="09-Feb-2018 15:21:01" QUALITY="200C0 (OPCHDA_INTERPOLATED | OPC_QUALITY_GOOD)" TAG="10-LSV1-XI107/AI1/OUT.CV"/>
<RESULT_RECORD DATA="25.5" TIME="09-Feb-2018 15:22:01" QUALITY="200C0 (OPCHDA_INTERPOLATED | OPC_QUALITY_GOOD)" TAG="10-LSV1-XI107/AI1/OUT.CV"/>
<RESULT_RECORD DATA="25.5" TIME="09-Feb-2018 15:23:01" QUALITY="200C0 (OPCHDA_INTERPOLATED | OPC_QUALITY_GOOD)" TAG="10-LSV1-XI107/AI1/OUT.CV"/>
<RESULT_RECORD DATA="25.5" TIME="09-Feb-2018 15:24:01" QUALITY="200C0 (OPCHDA_INTERPOLATED | OPC_QUALITY_GOOD)" TAG="10-LSV1-XI107/AI1/OUT.CV"/>
<RESULT_RECORD DATA="25.5" TIME="09-Feb-2018 15:25:01" QUALITY="200C0 (OPCHDA_INTERPOLATED | OPC_QUALITY_GOOD)" TAG="10-LSV1-XI107/AI1/OUT.CV"/>
<RESULT_RECORD DATA="25.5" TIME="09-Feb-2018 15:26:01" QUALITY="200C0 (OPCHDA_INTERPOLATED | OPC_QUALITY_GOOD)" TAG="10-LSV1-XI107/AI1/OUT.CV"/>
<RESULT_RECORD DATA="25.5" TIME="09-Feb-2018 15:27:01" QUALITY="200C0 (OPCHDA_INTERPOLATED | OPC_QUALITY_GOOD)" TAG="10-LSV1-XI107/AI1/OUT.CV"/>
<RESULT_RECORD DATA="25.5" TIME="09-Feb-2018 15:28:01" QUALITY="200C0 (OPCHDA_INTERPOLATED | OPC_QUALITY_GOOD)" TAG="10-LSV1-XI107/AI1/OUT.CV"/>
<RESULT_RECORD DATA="25.5" TIME="09-Feb-2018 15:29:01" QUALITY="200C0 (OPCHDA_INTERPOLATED | OPC_QUALITY_GOOD)" TAG="10-LSV1-XI107/AI1/OUT.CV"/>
<RESULT_RECORD DATA="25.5" TIME="09-Feb-2018 15:30:01" QUALITY="200C0 (OPCHDA_INTERPOLATED | OPC_QUALITY_GOOD)" TAG="10-LSV1-XI107/AI1/OUT.CV"/>
<RESULT_RECORD DATA="25.5" TIME="09-Feb-2018 15:31:01" QUALITY="200C0 (OPCHDA_INTERPOLATED | OPC_QUALITY_GOOD)" TAG="10-LSV1-XI107/AI1/OUT.CV"/>
<RESULT_RECORD DATA="25.5" TIME="09-Feb-2018 15:32:01" QUALITY="200C0 (OPCHDA_INTERPOLATED | OPC_QUALITY_GOOD)" TAG="10-LSV1-XI107/AI1/OUT.CV"/>
<RESULT_RECORD DATA="25.5" TIME="09-Feb-2018 15:33:01" QUALITY="200C0 (OPCHDA_INTERPOLATED | OPC_QUALITY_GOOD)" TAG="10-LSV1-XI107/AI1/OUT.CV"/>
<RESULT_RECORD DATA="25.5" TIME="09-Feb-2018 15:34:01" QUALITY="200C0 (OPCHDA_INTERPOLATED | OPC_QUALITY_GOOD)" TAG="10-LSV1-XI107/AI1/OUT.CV"/>
<RESULT_RECORD DATA="25.5" TIME="09-Feb-2018 15:35:01" QUALITY="200C0 (OPCHDA_INTERPOLATED | OPC_QUALITY_GOOD)" TAG="10-LSV1-XI107/AI1/OUT.CV"/>
</RESULT>
<RESULT NODE_NUMBER="98" TYPE="CALC" EVENTVALUE="MINIMUM" VISIBLE="1" OUTPUT_TO_REPORT="1">
<RESULT_RECORD DATA="25.5" RAW_DATA="25.500000" TIME="09-Feb-2018 15:21:01" TAG="10-LSV1-XI107/AI1/OUT.CV"/>
</RESULT>
<RESULT NODE_NUMBER="99" TYPE="CALC" EVENTVALUE="MAXIMUM" VISIBLE="1" OUTPUT_TO_REPORT="1">
<RESULT_RECORD DATA="25.9" RAW_DATA="25.900000" TIME="09-Feb-2018 15:21:01" TAG="10-LSV1-XI107/AI1/OUT.CV"/>
</RESULT>
</ITEM>
<ITEM NODE_NUMBER="100" SORT_ORDER="50" UTC="1" DATASOURCE_ID="10" PSTART="" SOURCE_ID="" TAG="PL" VISIBLE="1" DESCRIPTION="" IDPK="2026" EXEC_CONDITION="" DELIMITER="" PRECISION="1" VERSION="1" OCCURRENCE="" ITEMTYPE="DEFAULT" SOURCE="10-LSV1-XI104/AI1/OUT.CV" OUTPUT_TO_REPORT="1" ID="12075" NAME="Filter Drain Temp" DATA_SCOPE="0" PLENGTH="" REQUIRED="1" UOM="Deg C">
<RESULT NODE_NUMBER="101" TYPE="TABLE" NAME="TABLE" AGGREGATE="INTERPOLATIVE" VISIBLE="1" OUTPUT_TO_REPORT="1">
<RESULT_RECORD DATA="21.0" TIME="09-Feb-2018 15:21:01" QUALITY="200C0 (OPCHDA_INTERPOLATED | OPC_QUALITY_GOOD)" TAG="10-LSV1-XI104/AI1/OUT.CV"/>
<RESULT_RECORD DATA="22.3" TIME="09-Feb-2018 15:22:01" QUALITY="200C0 (OPCHDA_INTERPOLATED | OPC_QUALITY_GOOD)" TAG="10-LSV1-XI104/AI1/OUT.CV"/>
<RESULT_RECORD DATA="22.3" TIME="09-Feb-2018 15:23:01" QUALITY="200C0 (OPCHDA_INTERPOLATED | OPC_QUALITY_GOOD)" TAG="10-LSV1-XI104/AI1/OUT.CV"/>
<RESULT_RECORD DATA="22.3" TIME="09-Feb-2018 15:24:01" QUALITY="200C0 (OPCHDA_INTERPOLATED | OPC_QUALITY_GOOD)" TAG="10-LSV1-XI104/AI1/OUT.CV"/>
<RESULT_RECORD DATA="22.3" TIME="09-Feb-2018 15:25:01" QUALITY="200C0 (OPCHDA_INTERPOLATED | OPC_QUALITY_GOOD)" TAG="10-LSV1-XI104/AI1/OUT.CV"/>
<RESULT_RECORD DATA="22.3" TIME="09-Feb-2018 15:26:01" QUALITY="200C0 (OPCHDA_INTERPOLATED | OPC_QUALITY_GOOD)" TAG="10-LSV1-XI104/AI1/OUT.CV"/>
<RESULT_RECORD DATA="22.3" TIME="09-Feb-2018 15:27:01" QUALITY="200C0 (OPCHDA_INTERPOLATED | OPC_QUALITY_GOOD)" TAG="10-LSV1-XI104/AI1/OUT.CV"/>
<RESULT_RECORD DATA="22.3" TIME="09-Feb-2018 15:28:01" QUALITY="200C0 (OPCHDA_INTERPOLATED | OPC_QUALITY_GOOD)" TAG="10-LSV1-XI104/AI1/OUT.CV"/>
<RESULT_RECORD DATA="22.3" TIME="09-Feb-2018 15:29:01" QUALITY="200C0 (OPCHDA_INTERPOLATED | OPC_QUALITY_GOOD)" TAG="10-LSV1-XI104/AI1/OUT.CV"/>
<RESULT_RECORD DATA="22.3" TIME="09-Feb-2018 15:30:01" QUALITY="200C0 (OPCHDA_INTERPOLATED | OPC_QUALITY_GOOD)" TAG="10-LSV1-XI104/AI1/OUT.CV"/>
<RESULT_RECORD DATA="22.3" TIME="09-Feb-2018 15:31:01" QUALITY="200C0 (OPCHDA_INTERPOLATED | OPC_QUALITY_GOOD)" TAG="10-LSV1-XI104/AI1/OUT.CV"/>
<RESULT_RECORD DATA="22.3" TIME="09-Feb-2018 15:32:01" QUALITY="200C0 (OPCHDA_INTERPOLATED | OPC_QUALITY_GOOD)" TAG="10-LSV1-XI104/AI1/OUT.CV"/>
<RESULT_RECORD DATA="22.3" TIME="09-Feb-2018 15:33:01" QUALITY="200C0 (OPCHDA_INTERPOLATED | OPC_QUALITY_GOOD)" TAG="10-LSV1-XI104/AI1/OUT.CV"/>
<RESULT_RECORD DATA="22.3" TIME="09-Feb-2018 15:34:01" QUALITY="200C0 (OPCHDA_INTERPOLATED | OPC_QUALITY_GOOD)" TAG="10-LSV1-XI104/AI1/OUT.CV"/>
<RESULT_RECORD DATA="22.3" TIME="09-Feb-2018 15:35:01" QUALITY="200C0 (OPCHDA_INTERPOLATED | OPC_QUALITY_GOOD)" TAG="10-LSV1-XI104/AI1/OUT.CV"/>
</RESULT>
<RESULT NODE_NUMBER="102" TYPE="CALC" EVENTVALUE="MINIMUM" VISIBLE="1" OUTPUT_TO_REPORT="1">
<RESULT_RECORD DATA="21.0" RAW_DATA="21.000000" TIME="09-Feb-2018 15:21:01" TAG="10-LSV1-XI104/AI1/OUT.CV"/>
</RESULT>
<RESULT NODE_NUMBER="103" TYPE="CALC" EVENTVALUE="MAXIMUM" VISIBLE="1" OUTPUT_TO_REPORT="1">
<RESULT_RECORD DATA="22.3" RAW_DATA="22.299999" TIME="09-Feb-2018 15:21:01" TAG="10-LSV1-XI104/AI1/OUT.CV"/>
</RESULT>
</ITEM>
</folders>
我的XSL如下:
<div>
<!--ProcessLog-->
<table class="Item" id="Item_ProcessLog">
<tr>
<td COLSPAN="6">
<h2>Process Log for Pressure Tests:</h2>
</td>
</tr>
</table>
<table class="Item" width="100%">
<xsl:for-each select="//folders[@NAME='Step Time Range'][contains(@RUN_NAME,'Pressure Test')]" >
<tr>
<td style="text-align:right" colspan="2">
<b>
<xsl:value-of select="./@RUN_NAME" />
</b>
</td>
<td style="text-align:center" colspan="2">
Start Time: <xsl:value-of select="./@RUN_START_DATETIME" /></td>
<td style="text-align:left" colspan="2">
Duration:
<xsl:variable name="seconds" select="./@TOTALSECONDS_UTC" /><xsl:value-of select="format-number(floor($seconds div 3600), '00')" /><xsl:value-of select="format-number(floor($seconds div 60 mod 60), ':00')" /><xsl:value-of select="format-number($seconds mod 60, ':00')" /></td>
</tr>
<tr>
<th style="text-align:center;">Date Time
</th>
<xsl:for-each select=".//ITEM[@TAG='PL']">
<th style="text-align:center;">
<xsl:value-of select="@NAME" />
<br>
<xsl:value-of select="@UOM" />
</br>
</th>
</xsl:for-each>
</tr>
<xsl:for-each select="(.//ITEM[@TAG='PL'])/RESULT[@TYPE='TABLE']/RESULT_RECORD">
<xsl:variable name="num" select="position()" />
<tr>
<td>
<xsl:value-of select="@TIME" />
</td>
<td>
<xsl:value-of select="@DATA" />
</td>
</tr>
</xsl:for-each>
</xsl:for-each>
</table>
</div>
它“工作”到目前为止显示每个结果的日期/时间,只显示第一列数据。我无法为我的生活获得所有四列数据的输出。我有一个不同的样式表,可以使用显示所有数据的相同xsl,而不仅仅是这些多个数据子集。
任何有任何想法或提示将不胜感激!感谢您抽出宝贵时间来查看我的问题:)
逐列显示的数据是从<ITEM>
元素的不同索引中获取的。 Drain Press
取自<RESULT_RECORD>
下的ITEM[1]
元素,Bypass Drain Temp
取自<RESULT_RECORD>
下的ITEM[2]
元素,依此类推。
muenchian grouping
和普通<xsl:for-each>
的组合可用于获得所需的输出。启动<folders>
元素的外部循环,它与共享的XSL相同。
<xsl:for-each select="//folders[@NAME='Step Time Range'][contains(@RUN_NAME,'Pressure Test')]">
在此循环中,可以构建标题行和列标题。我修改了共享代码片段以使用concat()
函数而不是连续的<xsl:value-of>
。
<tr>
<td style="text-align:right" colspan="2">
<b>
<xsl:value-of select="@RUN_NAME" />
</b>
</td>
<td style="text-align:center" colspan="2">
<xsl:value-of select="concat('Start Time: ', @RUN_START_DATETIME)" />
</td>
<td style="text-align:left">
<xsl:variable name="totalSeconds" select="@TOTALSECONDS_UTC" />
<xsl:variable name="hours" select="format-number(floor($totalSeconds div 3600), '00')" />
<xsl:variable name="minutes" select="format-number(floor($totalSeconds div 60 mod 60), ':00')" />
<xsl:variable name="seconds" select="format-number($totalSeconds mod 60, ':00')" />
<xsl:value-of select="concat('Duration: ', $hours, $minutes, $seconds)" />
</td>
</tr>
<tr>
<th style="text-align:center;">Date Time</th>
<xsl:for-each select="ITEM[@TAG='PL']">
<th style="text-align:center;">
<xsl:value-of select="@NAME" />
<br>
<xsl:value-of select="@UOM" />
</br>
</th>
</xsl:for-each>
</tr>
为了获取和显示单个列式数据,使用muenchian grouping
。键被定义为基于<RESULT_RECORD>
属性的值将具有@QUALITY
属性的@TIME
组合在一起。 @QUALITY
属性过滤器用于排除提取数据不需要的其他<RESULT_RECORD>
元素。
<xsl:key name="groupKey" match="RESULT_RECORD[@QUALITY]" use="@TIME" />
嵌套循环在分组元素上运行,用于获取@TIME
和@DATA
<xsl:for-each select="//RESULT_RECORD[@QUALITY][generate-id() = generate-id(key('groupKey', @TIME)[1])]">
<tr>
<td style="text-align:center;">
<xsl:value-of select="@TIME" />
</td>
<xsl:for-each select="key('groupKey', @TIME)">
<td style="text-align:center;">
<xsl:value-of select="@DATA" />
</td>
</xsl:for-each>
</tr>
</xsl:for-each>
整个XSLT如下
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" />
<xsl:strip-space elements="*" />
<xsl:key name="groupKey" match="RESULT_RECORD[@QUALITY]" use="@TIME" />
<xsl:template match="/">
<div>
<!--ProcessLog -->
<table class="Item" id="Item_ProcessLog" border="1">
<tr>
<td COLSPAN="5">
<h2>Process Log for Pressure Tests:</h2>
</td>
</tr>
</table>
<table class="Item" width="100%" border="1">
<xsl:for-each select="//folders[@NAME='Step Time Range'][contains(@RUN_NAME,'Pressure Test')]">
<tr>
<td style="text-align:right" colspan="2">
<b>
<xsl:value-of select="@RUN_NAME" />
</b>
</td>
<td style="text-align:center" colspan="2">
<xsl:value-of select="concat('Start Time: ', @RUN_START_DATETIME)" />
</td>
<td style="text-align:left">
<xsl:variable name="totalSeconds" select="@TOTALSECONDS_UTC" />
<xsl:variable name="hours" select="format-number(floor($totalSeconds div 3600), '00')" />
<xsl:variable name="minutes" select="format-number(floor($totalSeconds div 60 mod 60), ':00')" />
<xsl:variable name="seconds" select="format-number($totalSeconds mod 60, ':00')" />
<xsl:value-of select="concat('Duration: ', $hours, $minutes, $seconds)" />
</td>
</tr>
<tr>
<th style="text-align:center;">Date Time</th>
<xsl:for-each select="ITEM[@TAG='PL']">
<th style="text-align:center;">
<xsl:value-of select="@NAME" />
<br>
<xsl:value-of select="@UOM" />
</br>
</th>
</xsl:for-each>
</tr>
<xsl:for-each select="//RESULT_RECORD[@QUALITY][generate-id() = generate-id(key('groupKey', @TIME)[1])]">
<tr>
<td style="text-align:center;">
<xsl:value-of select="@TIME" />
</td>
<xsl:for-each select="key('groupKey', @TIME)">
<td style="text-align:center;">
<xsl:value-of select="@DATA" />
</td>
</xsl:for-each>
</tr>
</xsl:for-each>
</xsl:for-each>
</table>
</div>
</xsl:template>
</xsl:stylesheet>
输出的图像可以在附件中找到。为了便于理解,我在border
添加了一个table
。随意删除它。
以上是关于xsl for-each多重结果过滤的主要内容,如果未能解决你的问题,请参考以下文章
如何计算没有。 xsl:choose 语句在 xsl:for-each 中执行的次数?
如何在已排序的 xsl:for-each 循环中访问前一个和下一个元素的值
XSL 风格:在 XSLT 中使用 <xsl:for-each select> 或 <xsl:template match> 或其他解决方案?