xsl: normalize-space(string str) 函数
本文出自http://technet.microsoft.com/zh-cn/magazine/ms256063%28VS.90%29.aspx
通过去掉前导和尾随空白并使用单个空格替换一系列空白字符,使空白标准化。 如果省略了该参数,上下文节点的字符串值将标准化并返回。
以下函数调用返回“abc def”:
normalize-space(" abc def ")
如果参数不是字符串类型,将先转换成字符串再计算。 请参见下面的示例。
如果参数不是字符串类型,将先使用 string() 函数转换为字符串,然后计算该转换的结果。
![]() |
---|
作为参数传递给此函数的节点集的字符串转换可能会产生意外的结果。 有关更多信息,请参见 string 函数。 |
此函数区分大小写。
以下示例使用非标准化的空白(单词间的制表符、前导和尾随的空格以及多个空格)标准化文本字符串块。 文本字符串是 <text> 元素的值。

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="normalizeSpace.xsl"?>
<text>
This is a
test, with a lot of
irregular spacing and
waiting to be normalizaed. </text>

<?xml version='1.0'?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml"
omit-xml-declaration="yes"/> <xsl:template match="/text">
Unnormalized:
"<xsl:value-of select='.'/>"
Normalized: "<xsl:value-of select='normalize-space()'/>"
</xsl:template> </xsl:stylesheet>
该 XSLT 生成以下输出:
Unormalized:
"
This is a
test, with a lot of
irregular spacing and
waiting to be normalizaed.
"
Normalized:
"This is a test, with a lot of irregular spacing and waiting to be normalized."
xsl: normalize-space(string str) 函数的更多相关文章
- 经典String str = new String("abc")内存分配问题
出自:http://blog.csdn.net/ycwload/article/details/2650059 今天要找和存储管理相关的一些知识,网上搜了半天也没有找到完善的(30%的程度都不到),没 ...
- string.capwords()函数
string.capwords()函数 string.capwords()函数,有需要的朋友可以参考下. 代码 : import syssys.path.append("C:/Python2 ...
- Python repr() 或str() 函数(转)
Python 有办法将任意值转为字符串:将它传入repr() 或str() 函数.函数str() 用于将值转化为适于人阅读的形式,而repr() 转化为供解释器读取的形式(如果没有等价的语法,则会发生 ...
- public static void main(String[] args){}函数诠释
public static void main(String[] args){}函数诠释 主函数的一般写法如下: public static void main(String[] args){-} 下 ...
- Java——String.split()函数
在java doc里有 String[] java.lang.String.split(String regex) Splits this string around matches of the g ...
- c++中string.erase()函数的用法(转)
erase函数的原型如下:(1)string& erase ( size_t pos = 0, size_t n = npos );(2)iterator erase ( iterator p ...
- String 常用函数
判断字符串是否包含指定字符str.contains("string"); 查找指定字符索引str.indexOf("s"'); 查找最后出现的字符索引str.i ...
- C++中的string常用函数用法
标准c++中string类函数介绍 注意不是CString 之所以抛弃char*的字符串而选用C++标准程序库中的string类,是因为他和前者比较起来,不必 担心内存是否足够.字符串长度等等,而 ...
- Python str() 函数
Python str() 函数 Python 内置函数 描述 str() 函数将对象转化为适于人阅读的形式. 语法 以下是 str() 方法的语法: class str(object='') 参数 ...
随机推荐
- 增量式PID推导及C语言实现
PID控制器表达式为: \[ u(t) = K_pe(t) + K_i\int_0^t e(\tau)d\tau + K_d\frac{de(t)}{dt} \] 离散化: 令 $ t = nT,~T ...
- nexus的使用
一.在百度网盘或官网下载nexus,并部署. 注意修改: https://repository.apache.org/content/repositories/releases/ 二.下载m ...
- Visual Studio 默认保存为UTF8编码
Visual Studio (中文版)默认保存的文本文件是GB2312编码(代码页936)的,默认的行尾(End of line)是CRLF的. 如果仅仅是在windows下开发问题也不大,但是涉及到 ...
- Python全栈开发【面向对象】
Python全栈开发[面向对象] 本节内容: 三大编程范式 面向对象设计与面向对象编程 类和对象 静态属性.类方法.静态方法 类组合 继承 多态 封装 三大编程范式 三大编程范式: 1.面向过程编程 ...
- 八款常见的Android游戏引擎
原文地址:http://bbs.csdn.net/topics/380203732 1.Angle Angle是一款专为Android平台设计的,敏捷且适合快速开发的2D游戏引擎,基于OpenGL ...
- NFC OMA 访问
正常的OMA访问: 但基本上IC原厂都会提供NFC swp-sim这一块的访问,但关于NFC内部eSe的访问一般NFC服务商又会整一套出来,导致有两套独立的SmartcardSevice需要运行,但他 ...
- mysql workbench连接不上远程数据库,xshell无法连接远程主机的问题
1.先说xshell无法连接的问题 最近使用virtualbox装了个ubuntu-16.04,然后在win7上使用xshell连接,首先确认win7能ping通虚拟机ip.然后确认是否安装了open ...
- 关于计算机改名无法连接TFS的问题
今天重新导入了两台服务器, 修改了机器名,结果VS2012链接TFS报错 --------------------------- Microsoft Visual Studio ----------- ...
- 常用类string的用法
在Java中string是我们用的很多的一种类,下面就来说说string类中经常用到的一些方法. 1.string与数组相关的方法: 比如:string str = "fsafdsafdas ...
- "飞机大战"游戏_Java实现_详细注释
1 package cn.xiaocangtian.Util; import java.awt.Frame; import java.awt.Graphics; import java.awt.Ima ...