XSLT的Replace函数

简介:
Xslt的替换 " 为 " 的编码

<? xml version="1.0" encoding="utf-8" ?>
< xsl:stylesheet  version ="1.0"   xmlns:xsl ="http://www.w3.org/1999/XSL/Transform" >
  
< xsl:template  name ="root"  match  ="/" >
    
< xsl:variable  name ="abc" >
      
< xsl:variable  name ="x" > &quot; </ xsl:variable >
      
< xsl:variable  name ="y" > %22 </ xsl:variable >
      
< xsl:call-template  name ="replaceFunc" >
        
< xsl:with-param  name  ="text"  select ="//abc" />
        
< xsl:with-param  name  ="replace"  select ="$x" />
        
< xsl:with-param  name  ="by"  select ="$y" />
      
</ xsl:call-template >
    
</ xsl:variable >
    
< xsl:value-of  select ="$abc" />
  
</ xsl:template >

  
< xsl:template  name ="replaceFunc" >
    
< xsl:param  name ="text" />
    
< xsl:param  name ="replace" />
    
< xsl:param  name ="by" />
    
< xsl:choose >
      
< xsl:when  test ="contains($text,$replace)" >
        
< xsl:value-of  select ="substring-before($text,$replace)" />
        
< xsl:value-of  select ="$by" />
        
< xsl:call-template  name ="replaceFunc" >
          
< xsl:with-param  name ="text"  select ="substring-after($text,$replace)" />
          
< xsl:with-param  name ="replace"  select ="$replace" />
          
< xsl:with-param  name ="by"  select ="$by" />
        
</ xsl:call-template >
      
</ xsl:when >
      
< xsl:otherwise >
        
< xsl:value-of  select ="$text" />
      
</ xsl:otherwise >
    
</ xsl:choose >
  
</ xsl:template >   
  
</ xsl:stylesheet >

< root >
  
< abc > 'asjb'a'aaaa'" </ abc >
</ root >
来源: <http://www.cnblogs.com/xiaoc/archive/2009/07/31/1535997.html>
目录
相关文章
|
消息中间件 Java Kafka
关于kafka消费者超时配置
关于kafka消费者超时配置
2008 2
|
XML JSON Java
SpringMVC中HttpMessageConverter使用实践详解
SpringMVC中HttpMessageConverter使用实践详解
1106 0
|
9月前
|
人工智能 运维 BI
Top5 主流工单管理系统全对比(2025 版):功能、价格、行业适配性详解
在数字化浪潮推动下,工单管理系统已成为企业提升运营效率、优化客户体验的关键工具。本文解析其核心价值与选型要点,并对合力亿捷、Zendesk、Freshdesk、Jira Service Management、钉钉宜搭五大主流系统进行多维度对比,涵盖功能、价格、行业适配性等,助力企业精准选型,加速数字化转型进程。
|
SQL 关系型数据库 数据库
在 Postgres 中使用 Between
【8月更文挑战第12天】
1335 4
|
安全 算法 应用服务中间件
SSL/TLS协议信息泄露漏洞(CVE-2016-2183)【原理扫描】
SSL/TLS协议信息泄露漏洞(CVE-2016-2183)【原理扫描】 【可验证】 详细描述TLS是安全传输层协议,用于在两个通信应用程序之间提供保密性和数据完整性。
12629 2
|
存储 SQL Oracle
02-PostgreSQL 存储过程的进阶介绍(含游标、错误处理、自定义函数、事务)
02-PostgreSQL 存储过程的进阶介绍(含游标、错误处理、自定义函数、事务)
|
安全 Java
JAVA反射调用方法
JAVA反射调用方法
|
前端开发 JavaScript API
js【详解】ajax (含XMLHttpRequest、 同源策略、跨域、JSONP)
js【详解】ajax (含XMLHttpRequest、 同源策略、跨域、JSONP)
550 0
|
JSON JavaScript 前端开发
json模块与jsonpath详解
json模块与jsonpath详解
|
网络协议 Linux Windows
测试端口是否开放 tcp端口 udp端口 测试服务器端口连通性
测试端口是否开放 tcp端口 udp端口 测试服务器端口连通性
1109 0