Как устранить все <TAG /> и весь атрибут = «» с помощью XSLT?
Вxsl:stylesheet
У меня есть это «идентичность как» преобразование, чтобы исключить комментарии, пустые (терминальные) теги и пустые атрибуты ... Новторой xsl:when
не работает
<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>
Кто выражает условие для пустых тегов в этом контексте?
PS: «пустые правила»объяснил здесьЯ пытаюсь использовать его, но не вижу, почему не работает.