XSLT/XPath:MSXML 4.0 中没有大写函数? [英] XSLT/XPath : No upper-case function in MSXML 4.0?

查看:25
本文介绍了XSLT/XPath:MSXML 4.0 中没有大写函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试在 XPATH 中使用大写(),我的解析器是 MSXML 4.0,我得到:

I try to use upper-case() in an XPATH, my parser is MSXML 4.0, and I get :

upper-case is not a valid XSLT or XPath function.

真的没有实现吗?

推荐答案

xslt 1.0 中没有转换为大写或小写的函数.而是执行以下操作:

There are no functions in xslt 1.0 to convert to uppercase or lowercase. Instead do the following:

如果很多地方都需要:

声明这两个xsl变量(这是为了让xslt更具可读性)

Declare these two xsl variables (this is to make the xslt more readable)

<!-- xsl variables up and lo and translate() are used to change case -->
  <xsl:variable name="up" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
  <xsl:variable name="lo" select="'abcdefghijklmnopqrstuvwxyz'"/>

并在您的翻译功能中使用它们来更改大小写

And use them in your translate function to change the case

<xsl:value-of select="translate(@name,$lo,$up)"/>

如果只需要在一个地方使用,不需要声明变量

<xsl:value-of select="translate(@name,'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>

这篇关于XSLT/XPath:MSXML 4.0 中没有大写函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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