0
使用XSLT,我需要在一個列中只包含「傑克」去掉一個完整的錶行,我做了它,但它的比賽XSLT刪除錶行當所有的價值
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template name="ident" match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="tr">
<xsl:if test="../../tr/td[text()='Jack']">
<xsl:call-template name="ident" />
</xsl:if>
</xsl:template>
後刪除所有行
<table>
<th>
<td>Contestant</td>
<td>Score</td>
<td>Country</td>
</th>
<tr>
<td>Jack</td>
<td>0.00</td>
<td>AUS</td>
</tr>
<tr>
<td>Jill</td>
<td>-</td>
<td>-</td>
</tr>
</table>
它的工作原理,但是當根節點的xmlns =「金塔:測試: v3「它不起作用。你知道它爲什麼會發生嗎? –
這是一個默認的名稱空間聲明。名稱空間中的元素與不在名稱空間中的元素不同,即使它們看起來具有相同的名稱。例如,請參閱https://stackoverflow.com/questions/34758492/xslt-transform-doesnt-work-until-i-remove-root-node。 –