.net AddExtensionObject在我的XML上到处都是
我使用XSLT的目的是为了将表单1 xml表单映射到另一个表单 由于M$缺乏对2.0的支持和所有附带的可爱功能(有没有人进行无大小写比较?我希望有人因为将其从1.0中删除而失去了工作)以及更多,我希望使用AddExtensionObject添加一些功能来添加我需要的支持。我相信这比允许运行脚本要安全得多 令人烦恼的是我所有的标签上都贴满了骨灰盒。比如说.net AddExtensionObject在我的XML上到处都是,.net,xml,xslt,.net,Xml,Xslt,我使用XSLT的目的是为了将表单1 xml表单映射到另一个表单 由于M$缺乏对2.0的支持和所有附带的可爱功能(有没有人进行无大小写比较?我希望有人因为将其从1.0中删除而失去了工作)以及更多,我希望使用AddExtensionObject添加一些功能来添加我需要的支持。我相信这比允许运行脚本要安全得多 令人烦恼的是我所有的标签上都贴满了骨灰盒。比如说 <INVAC xmlns:myColor="urn:myColor"> <MEMBO>7131</MEMBO>
<INVAC xmlns:myColor="urn:myColor">
<MEMBO>7131</MEMBO>
<FUNDNAME>Fund00b</FUNDNAME>
</INVAC>
7131
基金00B
当我遵循
我想使用额外的功能,但没有输出
提前谢谢 您已经找到了主要问题的答案——
xsl:stylesheet
的exclude result prefixes
属性应该用于指定我们不希望复制到文本结果元素上的所有名称空间前缀(以空格分隔的列表)
您的另一个问题也很容易回答:
<a>
<b/>
<dell/>
<c/>
</a>
有人吗
使用:
translate($s1, $vUpper, $vLower)
=
translate($s2, $vUpper, $vLower)
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:param name="pNameOfElementsToDelete" select="'DeLetE'"/>
<xsl:variable name="vUpper" select=
"'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
<xsl:variable name="vLower" select=
"'abcdefghijklmnopqrstuvwxyz'"/>
<xsl:template match="node()|@*" name="identity">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="*[true()]">
<xsl:if test=
"not(
translate(name(), $vUpper, $vLower)
=
translate($pNameOfElementsToDelete, $vUpper, $vLower)
)
">
<xsl:call-template name="identity"/>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
<a>
<b>
<Delete/>
</b>
<dell/>
<c>
<deLete/>
</c>
</a>
当两个字符串$s1
和$s2
不区分大小写相等时,该值计算为true()
变量$vUpper
应包含字母表的所有大写字母,变量$vLower
应包含字母表的所有小写字母
下面是一个完整的示例:
translate($s1, $vUpper, $vLower)
=
translate($s2, $vUpper, $vLower)
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:param name="pNameOfElementsToDelete" select="'DeLetE'"/>
<xsl:variable name="vUpper" select=
"'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
<xsl:variable name="vLower" select=
"'abcdefghijklmnopqrstuvwxyz'"/>
<xsl:template match="node()|@*" name="identity">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="*[true()]">
<xsl:if test=
"not(
translate(name(), $vUpper, $vLower)
=
translate($pNameOfElementsToDelete, $vUpper, $vLower)
)
">
<xsl:call-template name="identity"/>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
<a>
<b>
<Delete/>
</b>
<dell/>
<c>
<deLete/>
</c>
</a>
嗯,添加以下内容似乎可以摆脱这个实例“exclude result prefixes=“myColor”’我是否可以建议阅读一本关于XSLT的好书,这将大大增强您至少理解最基本XSLT概念的能力?