在xml样式表中,“带状空间”选择所有元素(elements=“*”),而“保留空间”选择部分元素,样式表的两个根元素是否相互冲突?
如何解析属于"strip-space“和"preserve-space”的元素?比如"abbrev","abbrev_journal_title"?
<xsl:strip-space elements="*"/>
<!-- Space is preserved in all elements allowing #PCDATA -->
<xsl:preserve
我有以下XML:
<node><mtype>code</mtype><mtext><script>
// a Javascript example
alert("Hello World");
</script></mtext></node>
HTML中的相同文本如下:
<pre><code><script>
// a Javascript example
alert("Hello W
我不明白。
我的xml输入:
<?xml version="1.0" encoding="UTF-8"?>
<results>
<error file="mixed.cpp" line="11" id="unreadVariable" severity="style" msg="Variable 'wert' is assigned a value that is never used."/>
首先尝试对xml进行编码,并使用xsl进行html输出。
我采用了W3示例并根据需要对它们进行了修改,但是我遗漏了一些东西,因为在浏览器中查看xml确实可以正常工作。没有html代码显示在浏览器中,但来自xml的项目信息显示为长列表。
浏览器中显示的内容:
SCALARADD Image1inSCALARADD Add one value to an image. A B A same as B allowed redLevel, greenLevel, blueLevel TRIMFILL Image1inTRIMFILL Trim an image and fill the trim ar
这就是我的XML输出中显示的内容(注意换行符)
<root>
<Item type="Comment">
<comment>this is a test
this is a test
this is a test</comment>
</Item>
</root>
在我的样式表中
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl=