|
[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message] Using functions in replacement argument with fn:replace()?David Sewell dsewell at virginia.eduThu Jan 12 12:37:32 PST 2006
I may be trying inappropriately to get Perl functionality out of the XPath 2.0 replace() function, but I'm wondering whether according to the specs it should be possible to pass backreferences to a function in the replacement pattern. I can successfully do this with expected output: replace("abc", ".", "$0") => "abc" This also gives the expected output (run in both Saxon 8.6 and MarkLogic Server, ditto for the rest of the examples): replace("abc", ".", upper-case("x")) => "XXX" but this gives unexpected output: replace("abc", ".", upper-case("$0")) => "abc" [???!!!] and this produces a run-time error: replace("abc", ".", upper-case($0)) Using a different function, replace("123", "2", string(number("2") * 2)) => "143" but replace("123", "2", string(number("$0") * 2)) => 1NaN3 I'm not clear from the W3C XPath 2.0 documentation whether the replacement argument of fn:replace() is supposed to be a literal xs:string, or whether any expression evaluating to a string is permissible. DS -- David Sewell, Editorial and Technical Manager Electronic Imprint, The University of Virginia Press PO Box 400318, Charlottesville, VA 22904-4318 USA Courier: 310 Old Ivy Way, Suite 302, Charlottesville VA 22903 Email: http://xquery.com/mailman/listinfo/talk Tel: +1 434 924 9973 Web: http://www.ei.virginia.edu/
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|






