xsl 试图输出 '<'与“&lt;"相反 [英] xsl trying to ouput '<' as opposed to '&lt;'
问题描述
更新:
问题仍然存在,尽管与以前不太一样.下面是输入的内容,输出的内容以及我想要输出的内容的示例
The issue still persists although it is not quite the same as before. Below is an example of what is being input, what is being output and what I want to have output
输入示例:
&lt;p&gt;&lt;span style=&quot;font-size: medium&quot;&gt;Product description text&lt;/span&gt;&lt;/p&gt;
当前输出:
<p><span style="font-size: medium">Product description text</span></p>
预期输出:
<p><span style="font-size: medium">Product description text</span></p>
.
使用 CDATA 有帮助,因为它允许我输入<"但如上面的输出所示,即使使用禁用输出转义,它在输出中也发生了变化
Using CDATA has helped as it allows me to input '<' but as seen in the output above, even when using disable-output-escaping, it has changed in the output
.
.
原始问题:
我得到的错误是'<',十六进制值 0x3C,是一个无效的属性字符"
The error I'm getting is "'<', hexadecimal value 0x3C, is an invalid attribute character"
我要做的是替换所有出现的 < ;>与 <和 > 分别.
What I'm trying to do is replace all occurrences of < ; and > ; with < and > respectively.
为了尽可能简单,这里是 lt; 的代码:
To keep this as simple as possible, here is the code for just lt;:
<xsl:variable name="lt">
<xsl:text><</xsl:text>
</xsl:variable>
<xsl:variable name="lthex">&lt;</xsl:variable>
<xsl:copy-of select="ew:replacestring(products_description/node(),$lthex,$lt)"/>
我尝试了各种方法来代替文本,例如价值等
I've tried various things in place of text e.g. value-of etc.
我知道代码格式和链接到它的 vb 代码没有任何问题,因为我多次使用它来替换和输出其他地方
I know there's nothing wrong with the code format and the vb code linked to it because I'm using it multiple times to replace and output elsewhere
这个问题是我想要 <和 > 字面上的输出,而不是浏览器看到并更改的代码
The problem with this though is that I want < and > to literally be ouput, not a code which is then seen by the browser and changed
.
如果您需要更多信息,请询问(我正在努力解释这一点)
If you need more information just ask (I'm struggling to explain this very well)
任何帮助将不胜感激
推荐答案
<xsl:text disable-output-escaping="yes"><![CDATA[<]]></xsl:text>
这是因为 <
是非法的(这就是您的应用程序抱怨的原因).对于 >
,您可以使用:
This is because <
is illegal (and that's why your app is complaining). For >
, you can use:
<xsl:text disable-output-escaping="yes">></xsl:text>
这篇关于xsl 试图输出 '<'与“&lt;"相反的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!