我需要帮助编写正则表达式以使用 XSLT 删除单词。
我需要将 XML 文件的“详细路径”的输出更改为:
/活动/262/26207
...简单地说:
262/26207
XSL 是:
<xsl:value-of select="detailpath"/>
如何删除“/events/”?
提前致谢。
正则表达式模式就是'/events/'
您可以在XSLT 2.0 替换() http://www.w3.org/TR/xpath-functions/#func-replace函数调用:
<xsl:value-of select="replace(detailpath,'/events/','')"/>
函数返回 xs:string 即
通过替换每个得到
$input 的非重叠子字符串
与给定的 $pattern 匹配
$replacement 的出现
细绳。
您可以选择指定flags http://www.w3.org/TR/xpath-functions/#flags
fn:replace( $input as xs:string?,
$pattern as xs:string,
$replacement as xs:string) as xs:string
fn:replace( $input as xs:string?,
$pattern as xs:string,
$replacement as xs:string,
$flags as xs:string) as xs:string
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)