Мне нужно отобразить текст для данного узла, подавляя текст для дочернего узла. Я попытался справиться с этим, создав пустой шаблон для дочернего узла, но он не сработал. Как подавить текст дочернего узла?Как отображать некоторые текстовые узлы в XSLT, но не другие
Вот XML:
<?xml version="1.0" encoding="UTF-8"?>
<document>
<item name="The Item">
<richtext>
<pardef/>
<par def="20">
<run>This text should </run>
<run>be displayed.
<popup><popuptext>This text should not be displayed.</popuptext></popup>
</run>
</par>
</richtext>
</item>
</document>
Вот моя таблица стилей:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:output indent="yes" method="html"/>
<xsl:template match="/*">
<html>
<body>
<table border="1">
<xsl:apply-templates/>
</table>
</body>
</html>
</xsl:template>
<xsl:template match="item">
<tr>
<td><xsl:value-of select="@name"/></td>
<td>
<xsl:apply-templates/>
</td>
</tr>
</xsl:template>
<xsl:template match="run">
<xsl:value-of select="." separator=""/>
</xsl:template>
<xsl:template match="popuptext" />
</xsl:stylesheet>