我在准备正确的XSLT模板以将值填充到HTML时遇到问题。就我而言,我想填充列Test2的值作为其上的验证类型。
我的XSL模板部分是:
<xsl:for-each select="CurrentFile/RejRow[Col/ValidationType='Task: Non-Numeric']">
<tr>
<td>
<span>
<xsl:value-of select="Col/ColVal"/>
</span>
</td>
</tr>
</xsl:for-each>
XML是:
<CurrentFile>
<RejRow>
<Col>
<ColName>Test1</ColName>
<ColVal>TestVal1</ColVal>
</Col>
<Col>
<ColName>Test2</ColName>
<ColVal>TestVal2</ColVal>
<ValidationType>Task: Non-Numeric</ValidationType>
</Column>
</RejRow>
</CurrentFile>
我已经找到了解决方案,希望这会对某人有所帮助。
<xsl:for-each select="RejRow[Col/ValidationType='Task: Non-Numeric']">
<tr>
<xsl:for-each select="Col[ColName='Test2']">
<td>
<span >
<xsl:value-of select="ColVal"/>
</span>
</td>
</xsl:for-each>
</tr>