在 XSLT 1.0 中,处理这个 xml 元素的最佳方式是什么
<Product>This is a product. < and its price is < 10</Product>
请注意,“小于号”表示了两次。即作为'<' and '<'.
为了逃避<
角色,我可以这样做
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" method="html" indent="yes" />
<xsl:template match="/">
<html>
<body>
<table border="1">
<tr>
<th>Product</th>
</tr>
<tr>
<td><xsl:value-of select="Product" disable-output-escaping="yes" /></td>
</tr>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
- 如果我将 disable-output-escaping 设置为“yes”,则
<
字符会正确显示,但会"<"
被完全删除。 - 如果我将禁用输出转义设置为“否”,则该
<
字符会导致解析异常。
我能做些什么来允许两者?