At 2010-06-04 21:07 -0700, Kelly Stirman wrote:
>Ken - I hadn't seen that. Cool.
Of course one thinks of improvements after the fact ... this version
using the standard library doesn't play with prefixes at all:
~/t $ cat paths.xml
<hello xmlns:abc="urn:X-abc">
<abc:def>
<ghi xmlns="urn:X-ghi"/>
</abc:def>
</hello>
~/t $ cat paths.xq
'
',
for $each in doc( 'paths.xml' )//*
return concat( '/',
string-join( $each/ancestor-or-self::*/concat('{',
namespace-uri-from-QName(node-name(.)),
'}',local-name(.)),'/'),
'
' )
~/t $ xquery paths.xq
<?xml version="1.0" encoding="UTF-8"?>
/{}hello
/{}hello/{urn:X-abc}def
/{}hello/{urn:X-abc}def/{urn:X-ghi}ghi
~/t $
>Here's another (easier to remember) MarkLogic-specific option for that:
>...
>for $node in doc('paths.xml')//* return xdmp:path($node)
>...
>for $node in doc('paths.xml')//* return xdmp:describe($node)
>...
>With the result of either xdmp:describe or xdmp:path, you can pass
>that string to xdmp:unpath to evaluate the expression:
>
>for $node in doc('paths.xml')//* return xdmp:unpath(xdmp:path($node))
>...
>xdmp:unpath(xdmp:path(doc('paths.xml')//*))
All very interesting extensions!
Thanks, Kelly.
. . . . . . . . . . . . . Ken
--
XSLT/XQuery training: after http://XMLPrague.cz 2011-03-28/04-01
Vote for your XML training: http://www.CraneSoftwrights.com/q/i/
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/q/
G. Ken Holman mailto:[email protected]
Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/q/bc
Legal business disclaimers: http://www.CraneSoftwrights.com/legal
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general