替换<;br>;与<;br/>;在XSLT2.0中
这个问题显然被问了很多次,但我找不到任何帮助 我想更换所有的替换<;br>;与<;br/>;在XSLT2.0中,xslt,xslt-2.0,Xslt,Xslt 2.0,这个问题显然被问了很多次,但我找不到任何帮助 我想更换所有的 <br> 到 在某些节点中 XML 在实验室和实验室的临时设备上安装直径传感器。安装直径传感器。在vero-eos和accusam和justo-duo-dolores和ea-Reum上安装直径传感器。]]> XSL 公众的 不幸的是,撒克逊退出了 SXXP0003: Error reported by XML parser: The value of attribute "select" assoc
<br>
到
在某些节点中
XML
在实验室和实验室的临时设备上安装直径传感器。
安装直径传感器。
在vero-eos和accusam和justo-duo-dolores和ea-Reum上安装直径传感器。]]>
XSL
公众的
不幸的是,撒克逊退出了
SXXP0003: Error reported by XML parser: The value of attribute "select" associated with an element type "null" must not contain the '<' character. org.xml.sax.SAXParseException: The value of attribute "select" associated with an element type "null" must not contain the '<' character.
SXXP0003:XML解析器报告的错误:与元素类型“null”关联的属性“select”的值不能包含“请尝试以下方法:
<xsl:template match="paragraph">
<paragraph type="public">
<xsl:value-of select="replace(., '<br>', '<br/>')"/>
</paragraph>
</xsl:template>
演示:您不能使用,也不需要XSLT。您需要一个生成XHTML的纠错HTML解析器,例如,它是Apache Xerces上的一个薄层。如果您将输出属性设置为HTML,它将生成不带斜杠的
标记
但是,如果将输出属性设置为XML,转换器将自动关闭空标记,因此请使用:
<xsl:output method="xml"/>
我担心您用
标记表示的“XML”输入根本不是XML,因此想要替换
的整个问题相当奇怪,考虑到XSLT通常与XML输入一起工作,您只能使用
或
或
,而不能使用
。因此,除非您在某些HTML输入上使用HTML解析器,然后将该输入提供给XSLT,否则我根本不知道如何使用XSLT处理您的输入。在这种情况下,不存在转换问题,只需将整个树序列化为XML或XHTML,然后就可以得到
。还要注意的是replace()
函数对字符串有效,而不是对标记有效。逃脱的方法你绝对是对的。我忘了。“变压器将自动关闭空标签”在这种情况下不会,因为它们不是标签。
SXXP0003: Error reported by XML parser: The value of attribute "select" associated with an element type "null" must not contain the '<' character. org.xml.sax.SAXParseException: The value of attribute "select" associated with an element type "null" must not contain the '<' character.
<xsl:template match="paragraph">
<paragraph type="public">
<xsl:value-of select="replace(., '<br>', '<br/>')"/>
</paragraph>
</xsl:template>
<xsl:output method="xml"/>