删除 XSL 样式表标签中的 XSL 命名空间前缀

Ros*_*oss 2 xslt xslt-1.0

是否可以在 XSL 样式表中删除xsl:to XSL 标签?

例如,可以:

<xsl:if test=''>
Run Code Online (Sandbox Code Playgroud)

键入为:

<if test=''>
Run Code Online (Sandbox Code Playgroud)

编辑: 样式表中包含 HTML 和 XML 节点。

谢谢,罗斯

ysd*_*sdx 5

事实上,您可以通过将 XSLT(“http://www.w3.org/1999/XSL/Transform”)命名空间定义为默认命名空间来做到这一点:

 <stylesheet xmlns="http://www.w3.org/1999/XSL/Transform">
    ...
 </stylesheet>
Run Code Online (Sandbox Code Playgroud)

缺点是您必须为“域”命名空间使用另一个前缀:

 <stylesheet xmlns="http://www.w3.org/1999/XSL/Transform" xmlns:foo="http://whatever" xmlns:html="http://www.w3.org/1999/xhtml">
    <template match="foo:bar">
       <html:form>
           ...
       </html:form>
    </template>
 </stylesheet>
Run Code Online (Sandbox Code Playgroud)