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 文件 (normSpace.xml)<?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>
XSLT 文件 (normSpace.xsl)<?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='') 参数 ...
随机推荐
- Mac Pro 日历增强工具 Itsycal
Mac 自带的日历工具一点也不好用,好在 Itsycal 弥补了这个缺陷,效果图如下: 下载地址:https://www.mowglii.com/itsycal/,下载解压后,把 Itsycal.ap ...
- 关于Spring的核心组件以及概念
1.什么是企业级应用 大型企业级应用的结构是非常复杂的,涉及外部资源非常多,事务密集,数据规模大,用户数量多,有较强的安全性考虑和较高的性能要求. 2.Spring概念理解 Spring是一个轻量 ...
- centos7 使用updatedb和locate命令
centos7默认是没有安装mlocate的,所以无法使用这两个命令 yum install mlocate 就可以了 参考:https://fedorahosted.org/mlocate/
- C和指针 第十六章 习题
16.8 计算平均年龄 #include <stdlib.h> #include <stdio.h> #define MAX_LEN 512 int main() { int ...
- mySQL 中主键值自动增加
转 http://stevenjohn.iteye.com/blog/976397 MySql 主键自动增长 博客分类: DataBase MySQLSQL 创建数据库,创建表. mysql> ...
- 面localStorage用作数据缓存的简易封装
面localStorage用作数据缓存的简易封装 最近做了一些前端控件的封装,需要用到数据本地存储,开始采用cookie,发现很容易就超过了cookie的容量限制,于是改用localStorage,但 ...
- (原创)RecyclerView结合xUtils2.6实现滚动时不加载item,xUtils2.6的源码分析与改造
我们知道xUtils中的bitmapUtils与listview相配合可以实现滚动时暂停加载 只需要一句话: listview.addOnScrollListener(new PauseOnScrol ...
- 参数名ASCII码从小到大排序(字典序)
/// <summary> /// Hashtable字典排序 /// </summary> /// <param name="parameters" ...
- Gitlab完美安装【CentOS6.5安装gitlab-6.9.2】
摘要: 拆腾了几天,终于在今天找到了快速安装Gitlab的方法.CentOS6.5安装gitlab-6.9.2 参考网址:https://gitlab.com/gitlab-org/omnibus-g ...
- maven发布项目到私服-snapshot快照库和release发布库的区别和作用及maven常用命令
maven发布项目到私服-snapshot快照库和release发布库的区别和作用及maven常用命令 在日常的工作中由于各种原因,会出现这样一种情况,某些项目并没有打包至mvnrepository. ...
警告