我正在尝试将一个xsl嵌入到一个XML文件中。这样做的原因是创建可以移动到不同计算机的单个文件,这将避免移动xsl文件的需要。
xsl文件创建一个表,并从xml获取一个测试步骤,以及它是通过还是失败,这非常简单。
我认为,我遇到的问题是,xsl有javascript,当xml加载到IE中时,它会显示出来。
当我使用IE加载xml文件时,javascript显示在表的上方,而xml显示在表的下方。
下面是我的文档的布局:
<!DOCTYPE doc [
<!ATTLIST xsl:stylesheet
id ID #REQUIRED>
]>
<doc>
<xsl:stylesheet id="4.1.0"
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:user="http://www.ni.com/TestStand"
xmlns:vb_user="http://www.ni.com/TestStand/" >
<xsl:template match="xsl:stylesheet" />
<xsl:text disable-output-escaping="yes">
<msxsl:script language="vbscript" implements-prefix="vb_user">
option explicit
'This function will return the localized decimal point for a decimal number
Function GetLocalizedDecimalPoint ()
dim lDecPoint
lDecPoint = Mid(CStr(1.1),2,1)
GetLocalizedDecimalPoint = lDecPoint
End Function
</msxsl:script>
<msxsl:script language="javascript" implements-prefix="user"><![CDATA[
// This style sheet will not show tables instead of graphs for arrays of values if
// 1. TSGraph control is not installed on the machine
// 2. Using the stylesheet in windows XP SP2. Security settings prevent stylesheets from creatign the GraphControl using scripting.
// Refer to the TestStand Readme for more information.
//more javascript functions
//code to build table and insert data from the xml
</xsl:stylesheet>
<Reports>
<Report Type='UUT' Title='UUT Report' Link='-1-2008-12-3-10-46-52-713' UUTResult='Failed' StepCount='51'>
// rest of xml
</Report>
</Reports>
</doc>发布于 2010-01-26 02:29:33
除了IE之外,大多数浏览器都可以嵌入样式表。在下面的帖子中可以找到对描述和示例的引用。
IE6/7/8默认不支持嵌入式样式表。
您可能需要使用变通方法,使IE能够从以下位置处理嵌入的样式表:
http://www.biglist.com/lists/lists.mulberrytech.com/xsl-list/archives/201001/msg00390.html
发布于 2010-02-28 09:34:18
因为您的样式表使用了msxsl,所以前面为IE浏览器启用样式表嵌入的技术对您来说应该没问题。
如果您想要适用于所有浏览器的样式表嵌入,则可能需要使用support of stylesheet embedding for ALL browsers技术。
https://stackoverflow.com/questions/360628
复制相似问题