[英]XSLT problem during transformation
<xsl:stylesheet xmlns="http://www.w3.org/1999/xhtml"
version="1.0"
xmlns:ms="urn:schemas-microsoft-com:xslt"
xmlns:infoRequest="ControlSkin3"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
exclude-result-prefixes="xmlns">
<xsl:output omit-xml-declaration="yes" method="xml" encoding="utf-8" />
我在xhtml转换期间遇到问题,像这样的元素:xmlns:ms =“ urn:schemas-microsoft-com:xslt”已插入许多我的xhtml标记中。
例如:
<script type="text/javascript" src="/style/js/etablissement/videos.js"
xmlns:infoRequest="ControlSkin3"
xmlns:ms="urn:schemas-microsoft-com:xslt" ></script>
我正在使用IIS6。 而且我没有任何解释。
你有同样的问题吗? 我的代码有什么问题?
谢谢。
exclude-result-prefixes =“ xmlns”>
我的代码有什么问题?
这并不是很有意义,因为XSLT样式表中没有名为"xmlns"
名称空间前缀。
另一方面,现有的前缀是: "ms"
, "infoRequest"
和"xsl"
。
如果将这些前缀指定为用空白分隔的列表作为exclude-result-prefixes
属性的值,则它们将不会出现在任何文字结果元素的序列化(输出)中。
例如 :
<xsl:stylesheet xmlns="http://www.w3.org/1999/xhtml"
version="1.0"
xmlns:ms="urn:schemas-microsoft-com:xslt"
xmlns:infoRequest="ControlSkin3"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
exclude-result-prefixes="ms infoRequest xsl">
<xsl:output omit-xml-declaration="yes" method="xml" encoding="utf-8" />
<xsl:template match="/">
<html>
<head>
<script type="text/javascript" src="/style/js/etablissement/videos.js">
/* Script code here */
</script>
</head>
</html>
</xsl:template>
</xsl:stylesheet>
当执行此转换时 (在任何源XML文档上-未使用), 结果不包含任何不需要的名称空间 :
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript" src="/style/js/etablissement/videos.js">
/* Script code here */
</script>
</head>
</html>
您可以通过exclude-result-prefixes
属性禁止显示这些名称空间。 您需要列出用空格分隔的名称空间前缀:
<xsl:stylesheet xmlns="http://www.w3.org/1999/xhtml"
version="1.0"
xmlns:ms="urn:schemas-microsoft-com:xslt"
xmlns:infoRequest="ControlSkin3"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
exclude-result-prefixes="infoRequest ms">
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.