0
这是可能使用XSL我需要用一个模板
输入XML使用,去除的H#序列号删除所有
<table>
<tbody>
<tr>
<td>
<h2>
<img src="https://admin.com" />
</h2>
</td>
<td>
<h3>
<img src="https://admin.com" />
</h3>
</td>
<td>
<h4>
<img src="https://admin.com" />
</h4>
</td>
</tr>
</tbody>
</table>
XSL我使用:
<xsl:template match="table/tbody/tr/td/h2[img]">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="table/tbody/tr/td/h3[img]">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="table/tbody/tr/td/h4[img]">
<xsl:apply-templates/>
</xsl:template>
就像在所有输入很多h#将在表中可能。是否可以编写单个模板以从表格中删除所有h1 h2 h3 ....... h系列?
嗨@马丁。谢谢。这可能使用任何正则表达式为该h系列数字删除。请建议? – User501
我不确定在模式中使用正则表达式来匹配不同的元素名称是个不错的主意,您当然可以尝试'* [match(name(),'^ h(1 | 2 | 3 | 4 | 5 | 6)$'']]'但为了清楚起见y的效率可能会更好地说明元素名称在步骤模式。 –
感谢@Martin。它的工作正常。 – User501