0
我想选择从XHTML文件除了所需要的所有超链接的元件的所有文本将被完全印刷:XSLT选择的所有文本和特定节点
XHTML
<?xml version="1.0" encoding="UTF-8" ?>
<html>
<body>
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
<a href="www.link.com">This is a link.</a>
</body>
</html>
所需的输出:
This is a paragraph. This is another paragraph. <a href="www.link.com">This is a link.</a>
我使用下面的XSLT,但没有得到任何结果:
XSLT在这个
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:template match="@*|node()">
<xsl:apply-templates select="@*|node()"/>
</xsl:template>
<xsl:template match="ancestor-or-self::text()">
<xsl:value-of select="text()"/>
</xsl:template>
<xsl:template match="a">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
任何帮助将是非常赞赏。
感谢您的回答,但这两者都不适合我。 – BernatL
@BernatL“*不能正常工作*”是什么意思? - P.S.看到它在这里工作:http://xsltransform.net/94rmq68 –
我得到_null_结果,但也许这是一个处理器错误。我正在使用不同的XSLT处理器检查您的解决方案,看起来像现在一样。 – BernatL