问题描述
Gidday,
我有一个XSLT的页面做了很少的真棒,它大部分进展顺利,但是我遇到了一个路障。 / p>
此页面:,同样的方法不起作用。
这是源.xsl文件:,关联的.xml是有效的,它在这里:。
任何想法?
应该注意的是,我真的不喜欢将3个脚本块中的2个移动到外部文件 - 一个是Cufon字体替换(所以我可以移动它),另一个是Luke Smith的head标签中的一个wee脚本,当JS可用时,该脚本被转换为CSS。
在< xsl:text> $ c中使用
CDATA
$ C>元素
像这样:
< xsl:text disable-output-escaping =yes>< ![CDATA [
.....
]]>< / xsl:text>
在上面的评论中,你发现自己更好:
< xsl:comment><![CDATA [
.....
]]>< / xsl :评论>
Gidday,
I have a page with XSLT doing small amounts of awesome, and it has mostly been going quite well, but I've hit a roadblock.
This page: http://codefinger.co.nz/_testing/build_2011/ chokes on CDATA sections that aren't actually in part of my .xsl file, they seem to be inserted during transformation (Javascript parse errors thrown).
Interestingly, this SO question: xslt, javascript and unescaped html entities solved the problem on my local test site (I wrapped the contents of my script blocks with the disable-output-escaping XSL tags), which is a WAMP 2.0 stack with this XSL config:
My live, hosted server has this config: http://codefinger.co.nz/php-info.php, and this same approach does not work.
Here's the source .xsl file: http://codefinger.co.nz/_testing/build_2011/xsl/siteContent.xsl, the associated .xml is valid, it is here: http://codefinger.co.nz/_testing/build_2011/xml/siteContent.xml.
Any ideas?
It should be noted that I really don't fancy moving 2 of the 3 scripts blocks to external files - one is Cufon font replacement (so I could move it), the other is a wee script in the head tag by Luke Smith, which is converted to CSS when JS is available.
Use CDATA
sections in your <xsl:text>
elementsLike this:
<xsl:text disable-output-escaping="yes"><![CDATA[
.....
]]></xsl:text>
In the comments above, you found yourself that this is even better:
<xsl:comment><![CDATA[
.....
]]></xsl:comment>
这篇关于XSLT禁用 - 输出转义,而不是跨两个差异服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!