Mercurial > hg > mpdl-group
view software/eXist/webapp/mpdl/_stuff/oxygen-projects/monte-project/util/functx.xql @ 7:5589d865af7a
Erstellung XQL/XSL Applikation
author | Josef Willenborg <jwillenborg@mpiwg-berlin.mpg.de> |
---|---|
date | Tue, 08 Feb 2011 15:16:46 +0100 |
parents | |
children |
line wrap: on
line source
xquery version "1.0"; module namespace functx = "http://www.functx.com"; declare function functx:substring-before-last( $arg as xs:string?, $delim as xs:string ) as xs:string { if (matches($arg, functx:escape-for-regex($delim))) then replace($arg, concat('^(.*)', functx:escape-for-regex($delim),'.*'), '$1') else '' }; declare function functx:substring-after-last( $arg as xs:string?, $delim as xs:string ) as xs:string { replace ($arg,concat('^.*',functx:escape-for-regex($delim)),'') }; declare function functx:escape-for-regex( $arg as xs:string? ) as xs:string { replace($arg, '(\.|\[|\]|\\|\||\-|\^|\$|\?|\*|\+|\{|\}|\(|\))','\\$1') };