使用.NET XSLT小写 [英] XSLT lower-case using .NET

查看:166
本文介绍了使用.NET XSLT小写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

?XML版本=1.0编码=UTF-;

 <:

我使用XMLSpy的使用下面的XSLT 16>?;
<的xsl:样式版本=2.0的xmlns:XSL =http://www.w3.org/1999/XSL/Transform的xmlns:XS =http://www.w3.org/ 2001 / XML模式的xmlns:FN =http://www.w3.org/2005/xpath-functions>
< XSL:输出方法=XML版本=1.0编码=UTF-16缩进=YES/>
<的xsl:模板匹配=*>
< XSL:元素名称={小写(当地名())}>
< XSL:申请模板选择=@ */>
< XSL:申请模板选择=* |文()/>
< / XSL:组件>
< / XSL:模板>
<的xsl:模板匹配=@ *>
<的xsl:属性名={小写(当地名())}><的xsl:value-of的选择= />< / XSL。:属性>
< / XSL:模板>
< / XSL:样式>

如果我尝试在我的源代码(XslCompiledTransform)来使用它,我得到一个异常告诉我函数'小写()'不是XSLT synthax的一部分



所以我改变了改造一点点:

  FN:小写

现在我的例外是由http://www.w3.org/2005/xpath-functions为前缀的脚本或外部对象无法找到。
请告诉我这里的事?我该如何解决呢?



问候


解决方案

.NET没有实现XSLT 2.0 / XPath 2.0中。



在XPath 1.0中我们可以使用下面的表达式,而不是较低情况下()

 翻译(yourString,
'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'ABCDEFGHIJKLMNOPQRSTUVWXYZ')


i use the following XSLT by using XMLSpy:

<?xml version="1.0" encoding="UTF-16"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions">
    <xsl:output method="xml" version="1.0" encoding="UTF-16" indent="yes"/>
        <xsl:template match="*">
        <xsl:element name="{lower-case(local-name())}">
            <xsl:apply-templates select="@*"/>
            <xsl:apply-templates select="* | text()"/>
        </xsl:element>
    </xsl:template>
    <xsl:template match="@*">
        <xsl:attribute name="{lower-case(local-name())}"><xsl:value-of select="."/></xsl:attribute>
    </xsl:template>
</xsl:stylesheet>

If i try to use it in my source (XslCompiledTransform) i get an exception telling me that the function 'lower-case()' is not part of the XSLT synthax.

So i changed the transformation a little bit:

fn:lower-case

Now my exception is that the script or external object prefixed by 'http://www.w3.org/2005/xpath-functions' can not be found. Whats the matter here? How can i fix it?

Regards

解决方案

.NET does not implement XSLT 2.0/XPath 2.0.

In XPath 1.0 one can use the following expression, instead of lower-case():

translate(yourString, 
          'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 
          'abcdefghijklmnopqrstuvwxyz')

这篇关于使用.NET XSLT小写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆