简体   繁体   English

XSLT-在XML中查找和替换wordt

[英]XSLT - find and replace wordt in XML

I have this tool in a website system what has an XML feed as output, it gives the possibility to write functions yourself, it works like this: 我在网站系统中拥有此工具,该工具具有XML提要作为输出,它使您可以自己编写函数,其工作方式如下:

    <xsl:value-of select="url:Encode(Regions/Region[1]/@Value)"/>



<msxml:script implements-prefix="url" language="C#">
    <msxml:assembly name="System.Web"/>
    <msxml:using namespace="System.Web"/>
    <![CDATA[
        public string Encode(string text)
        {
            return HttpUtility.UrlEncode(text);
        }      
    ]]>
  </msxml:script>

So now I am looking for a find and replace function, a function that can filter a text and replace words in it, but I don't know where to start with this code. 因此,现在我正在寻找一个查找和替换功能,该功能可以过滤文本并替换其中的单词,但是我不知道从哪里开始。

Since XSLT 2.0/XPath 2.0, you can use the XPath's standard function fn:replace for string search/replace in your XSLT stylesheet. 从XSLT 2.0 / XPath 2.0开始,您可以在XSLT样式表中使用XPath的标准函数fn:replace进行字符串搜索/替换。 Any XSLT >= 2.0 processor (eg SAXON ) should provide that out-of-the-box. 任何XSLT> = 2.0处理器(例如SAXON )都应立即提供。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM