在xsl:stylesheet
我有這樣的「身份像」改造,消除意見,空(終端)標籤和空屬性...但秒xsl:when
不工作如何通過XSLT消除所有<TAG/>和所有attribute =「」?
<xsl:template match="node()">
<xsl:choose>
<xsl:when test="name()='p' and not(./*) and not(normalize-space(.))"></xsl:when>
<xsl:when test="not(name()='img') and not(name()='br') and not(./*) and not(text())"
></xsl:when> <!-- this line NOT WORKS -->
<xsl:otherwise><xsl:copy><xsl:apply-templates select="@*|node()"/></xsl:copy></xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="@*">
<xsl:choose>
<xsl:when test="not(normalize-space(.))"></xsl:when>
<xsl:otherwise><xsl:copy><xsl:apply-templates select="@*|node()"/></xsl:copy></xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="comment()"></xsl:template>
Whow表達狀態空標籤在這種情況下?
PS:「空的規則」是explained here,我嘗試使用它,但不明白爲什麼不工作。
唯一的參考是郵件列表?! :D rtfm!順便說一句,請接受答案 – hek2mgl