【发布时间】:2014-06-20 14:19:06
【问题描述】:
我想用 XSLT 创建一个表,其中流程阶段是标题,而 processNo 是值。
<PV_Batch masterBatchNo="KH8944">
<tempTable processStage="Blending" processNo="KF0285" />
<tempTable processStage="Coating" processNo="KF0282" />
<tempTable processStage="Compression" processNo="KF0283" />
<tempTable processStage="Granulation" processNo="12345" />
<tempTable processStage="Granulation" processhNo="KF0284" />
<tempTable processStage="Mixing" processNo="KF0286" />
<tempTable processStage="mixing" processNo="K12035" />
</PV_Batch>
Blending | Coating | Compression | Granulation | Mixing
KF0285 | KF0282 | KF0283 | 12345 | KF0286
| | | Kf0284 | K12035
我在重复值方面遇到问题,每当我有重复时,它们就会超出范围,就像这样。
Blending | Coating | Compression | Granulation | Mixing
KF0285 | KF0282 | KF0283 | 12345 | Kf0284 | KF0268 | K12035
这是我的表格 xslt 样式表中的代码片段。
<xsl:for-each select="//tempTable[generate-id() = generate-id(key('keyComponent', @processStage)[1])]">
<th width="" align="Left" class="tableHeaderRow">
<xsl:value-of select="@processStage" />
</th>
</xsl:for-each>
<tr>
<xsl:for-each select="tempTable">
<td align="Left" class="tableNormalRow">
<xsl:value-of select="@processNo"/>
</td>
</xsl:for-each>
</tr>
【问题讨论】: