Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xslt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xml 如何在XSLT中使用fn:replace(字符串、模式、替换)_Xml_Xslt - Fatal编程技术网

Xml 如何在XSLT中使用fn:replace(字符串、模式、替换)

Xml 如何在XSLT中使用fn:replace(字符串、模式、替换),xml,xslt,Xml,Xslt,如何使用 fn:replace(string,pattern,replace) 在XSLT中 它像是吗?我想你是这样做的: <xsl:value-of select="fn:replace(value, 'some-pattern', 'with some text')" /> 编辑: 找到此函数指定如下: fn:replace($input, $pattern, $replacement, [$flags]) $input xs:string?

如何使用

      fn:replace(string,pattern,replace) 
在XSLT中


它像是吗?

我想你是这样做的:

<xsl:value-of select="fn:replace(value, 'some-pattern', 'with some text')" />

编辑:


找到此

函数指定如下:

fn:replace($input, $pattern, $replacement, [$flags])

$input        xs:string?  the string to change
$pattern      xs:string   regular expression to match the areas to be replaced
$replacement  xs:string   the replacement string
$flags        xs:string   flags for multiline mode, case insensitivity, etc
return value  xs:string
请注意,
$pattern
是一个替换字符串,替换字符串也有一些特殊的替换语法

以下是一些例子:

# simple replacement
replace('query', 'r', 'as')               queasy

# character class
replace('query', '[ry]', 'l')             quell

# capturing group substitution
replace('abc123', '([a-z])', '$1x')       axbxcx123

# practical example
replace('2315551212',                     (231) 555-1212
    '(\d{3})(\d{3})(\d{4})',
    '($1) $2-$3'
)
工具书类
  • -
  • -,
  • -很好的教程