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