xml – 使用XSLT将一个字符串模式转换为另一个字符串模式
发布时间:2020-12-15 23:54:12 所属栏目:百科 来源:网络整理
导读:我有我的源 XML,如下所示 contents contentAuthorInformation/content contentPersonInformation/content contentPersonPersonalInformation/content contentGurdianDetails/content/contents 我想将上面的XML转换成 contents contentAuthor Information/con
我有我的源
XML,如下所示
<contents> <content>AuthorInformation</content> <content>PersonInformation</content> <content>PersonPersonalInformation</content> <content>GurdianDetails</content> </contents> 我想将上面的XML转换成 <contents> <content>Author Information</content> <content>Person Information</content> <content>Person Personal Information</content> <content>Gurdian Details</content> </contents> 在源xml文件中的任何地方,内容元素数据都有大写字母,我想在其间添加空格.我可以使用XSLT 2.0示例如何实现这一目标.
使用这样的模板:
<xsl:template match="text()"> <xsl:value-of select="replace(.,'([a-z])([A-Z])','$1 $2')"/> </xsl:template> 这通常对输入中的所有文本内容执行规则.您可以轻松地使其更具体(如果您不想翻译其他元素).替换功能是关键点. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- Flash AS3.0 常用函数收集
- iphone – Xcode构建和运行错误:“进程启动失败:无法获得
- ios – 保持在顶部的UITableView标头
- flash学习之mouseChildren 与 mouseEnabled
- ORA-01078: failure in processing system parameters LRM-
- 设计模式原则篇(3):依赖倒转原则---Dependence Inversion P
- 使用JSONP over SSL的WCF服务
- C#实现组合排列的方法
- PostgreSQL 9.1:如何连接数组中没有重复项的行,JOIN另一个
- ruby-on-rails – 切换到Rails 4.1时的错误 – “method_mi