我的xml是:
<content type="text/html" title="flow-active-timeout">
<body>
<dl>
</dl>
<p> </p>
<div mt-section-origin="Product_Documentation/Command_Reference/Configuration_Commands/flow-active-timeout" class="mt-section" id="section_1"><span id="vManage_Feature_Template"></span><h2 class="editable">vManage Feature Template</h2>
<p>For vSmart controllers:</p>
<p>Configuration ► Policies ► Centralized Policy</p>
</div>
</body>
我的xslt代码是:
<xsl:template match="*[not(normalize-space(translate(., ' ', ' ')))]"/>
但它只会删除空的<p>
标签而不是<dl>
标签
使用上面的xslt输出:
<body>
<dl/>
<div mt-section-origin="Product_Documentation/Command_Reference/Configuration_Commands/flow-active-timeout" class="mt-section" id="section_1"><span id="vManage_Feature_Template"></span><h2 class="editable">vManage Feature Template</h2>
<p>For vSmart controllers:</p>
<p>Configuration ► Policies ► Centralized Policy</p>
</div>
</body>
预期输出为:
<body>
<div mt-section-origin="Product_Documentation/Command_Reference/Configuration_Commands/flow-active-timeout" class="mt-section" id="section_1"><span id="vManage_Feature_Template"></span><h2 class="editable">vManage Feature Template</h2>
<p>For vSmart controllers:</p>
<p>Configuration ► Policies ► Centralized Policy</p>
</div>
</body>
请提供一些说明以实现预期的输出
答案 0 :(得分:0)
<xsl:template match="*[text()=' ' or normalize-space(.)='']"/>
You may also use like this