Yes, temp brain freeze. Figured out about a min after posting. Pity no delete.
--- On Thu, 10/8/09, [email protected] <[email protected]> wrote: From: [email protected] <[email protected]> Subject: General Digest, Vol 64, Issue 22 To: [email protected] Date: Thursday, October 8, 2009, 5:06 AM Send General mailing list submissions to [email protected] To subscribe or unsubscribe via the World Wide Web, visit http://xqzone.com/mailman/listinfo/general or, via email, send a message with subject or body 'help' to [email protected] You can reach the person managing the list at [email protected] When replying, please edit your Subject line so it is more specific than "Re: Contents of General digest..." Today's Topics: 1. Re: Re: Saving a document over XCC? (Wayne Feick) 2. creating new elements using old elements qname (Paul M) 3. Re: creating new elements using old elements qname (G. Ken Holman) 4. RE: creating new elements using old elements qname (Geert Josten) 5. RE: Can someone explain how I cangetthefollowing info (Glidden, Douglass A) ---------------------------------------------------------------------- Message: 1 Date: Wed, 07 Oct 2009 13:27:06 -0700 From: Wayne Feick <[email protected]> Subject: Re: [MarkLogic Dev General] Re: Saving a document over XCC? To: General Mark Logic Developer Discussion <[email protected]> Message-ID: <[email protected]> Content-Type: text/plain; charset="us-ascii" Jeroen, If you push the xdmp:security-assert() into a separate function called form your amp'd function, you'll get your expected behavior (assuming your amp is configured appropriately). The xdmp:security-assert() call does not take into consideration any amp'd roles on the immediate function, only those that were in effect prior to calling the function. Wayne. On Wed, 2009-10-07 at 05:01 -0700, Jeroen Pulles wrote: > Hi, > > I want to use an amp to get to the role names for the role id's on the > document permissions. So I add my user's role to the get-role-names > amp. > > How come I still get a privilege exception for this user? > > My understanding of amps is that once a role has the amp token for a > function, that role has root powers that include any privilege inside > the function body. > > SEC-PRIV: > xdmp:security-assert("http://marklogic.com/xdmp/privileges/get-role-names", > "execute") -- Need privilege: > http://marklogic.com/xdmp/privileges/get-role-names > > in /MarkLogic/security.xqy, on line 707 > expr: > xdmp:security-assert("http://marklogic.com/xdmp/privileges/get-role-names", > "execute"), > > in sec:get-role-names(xs:unsignedLong("5500450759246938400")) > in /content/save_check_role-names.xqy, on line 9 > > regards, > Jeroen > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://xqzone.marklogic.com/pipermail/general/attachments/20091007/c9ab9793/attachment-0001.html ------------------------------ Message: 2 Date: Wed, 7 Oct 2009 13:35:03 -0700 (PDT) From: Paul M <[email protected]> Subject: [MarkLogic Dev General] creating new elements using old elements qname To: [email protected] Message-ID: <[email protected]> Content-Type: text/plain; charset="iso-8859-1" declare namespace x="hi" define function recurse-deep($nodes as node()*) as node()* { for $node in $nodes return if ($node instance of element()) then element { fn:QName(fn:in-scope-prefixes($node)[1],fn:local-name($node)) } { $node/@*, recurse-deep($node/node() ) } else $node } let $n:= <x:hello><how xmlns="dy"><r>hello</r></how></x:hello> return recurse-deep($n) I have recursive function. I want to use the original qname of $n when creating new element. The below almost meets my needs, but not quite. The dy namespace is being lost on the r element. Any ideas? I will not know the namespace beforehand of every possible element. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://xqzone.marklogic.com/pipermail/general/attachments/20091007/66cf0b47/attachment-0001.html ------------------------------ Message: 3 Date: Wed, 07 Oct 2009 16:46:25 -0400 From: "G. Ken Holman" <[email protected]> Subject: Re: [MarkLogic Dev General] creating new elements using old elements qname To: General Mark Logic Developer Discussion <[email protected]> Message-ID: <[email protected]> Content-Type: text/plain; charset="us-ascii"; format=flowed At 2009-10-07 13:35 -0700, Paul M wrote: >declare namespace x="hi" >define function recurse-deep($nodes as node()*) as node()* >{ > for $node in $nodes > return > if ($node instance of element()) then > element { > fn:QName(fn:in-scope-prefixes($node)[1],fn:local-name($node)) } > { $node/@*, > recurse-deep($node/node() ) > } > > else $node >} > >let $n:= <x:hello><how xmlns="dy"><r>hello</r></how></x:hello> >return recurse-deep($n) > >I have recursive function. I want to use the original qname of $n >when creating new element. I'm assuming you mean $node. >The below almost meets my needs, but not quite. The dy namespace is >being lost on the r element. Any ideas? >I will not know the namespace beforehand of every possible element. Your element name constructor is convoluted. I'm not sure why are you asking for "[1]" as I'm pretty sure the order returned of the prefixes is indeterminate. All you need is node-name($node) as in the example below. You are trying to reconstitute a QName syntactically from strings, yet node-name() already returns a QName value: http://www.w3.org/TR/2007/REC-xpath-functions-20070123/#func-node-name I hope this helps. . . . . . . . . . Ken t:\ftemp>type doc.xml <doc/> t:\ftemp>type paul.xq declare namespace x="hi"; declare function local:recurse-deep($nodes as node()*) as node()* { for $node in $nodes return if ($node instance of element()) then element { node-name($node) } { $node/@*, local:recurse-deep($node/node() ) } else $node }; let $n:= <x:hello><how xmlns="dy"><r>hello</r></how></x:hello> return local:recurse-deep($n) t:\ftemp>xquery doc.xml paul.xq Source document ignored - query does not access the context item <?xml version="1.0" encoding="UTF-8"?> <x:hello xmlns:x="hi"> <how xmlns="dy"> <r>hello</r> </how> </x:hello> t:\ftemp> -- Upcoming: hands-on code list, UBL, XSLT, XQuery and XSL-FO classes in Copenhagen Denmark and Washington DC USA, October/November 2009 Interested in other classes? http://www.CraneSoftwrights.com/q/i/ Crane Softwrights Ltd. http://www.CraneSoftwrights.com/q/ Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video Video lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18 Video overview: http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18 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 ------------------------------ Message: 4 Date: Thu, 8 Oct 2009 08:02:21 +0200 From: Geert Josten <[email protected]> Subject: RE: [MarkLogic Dev General] creating new elements using old elements qname To: General Mark Logic Developer Discussion <[email protected]> Message-ID: <0260356c6dfe754ba6fa48e659a14338334e32b...@helios.olympus.borgus.nl> Content-Type: text/plain; charset="Windows-1252" Hi Paul, You could have used a function like this: declare function local:QName($nsnode as node(), $local-name as xs:string) as xs:QName { let $ns-uri := namespace-uri($nsnode) let $prefix := prefix-from-QName(node-name($nsnode)) return QName($ns-uri, if ($prefix) then concat($prefix, ':', $local-name) else $local-name) }; ..which can be used to combine the local-name of one node with the namespace and prefix of any other node. In your code, you could also have used namespace-uri function instead of in-scope-prefixes. The latter returns prefixes, not namespace-uri's, so it is inappropriate in the first place, and your node doesn't have a prefix in the second place. But the shortest solution of all is the suggestion of Ken: simply use node-name to get the Qname of the original node.. Kind regards, Geert > Drs. G.P.H. Josten Consultant http://www.daidalos.nl/ Daidalos BV Source of Innovation Hoekeindsehof 1-4 2665 JZ Bleiswijk Tel.: +31 (0) 10 850 1200 Fax: +31 (0) 10 850 1199 http://www.daidalos.nl/ KvK 27164984 De informatie - verzonden in of met dit emailbericht - is afkomstig van Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan dit bericht kunnen geen rechten worden ontleend. > From: [email protected] > [mailto:[email protected]] On Behalf Of Paul M > Sent: woensdag 7 oktober 2009 22:35 > To: [email protected] > Subject: [MarkLogic Dev General] creating new elements using > old elements qname > > > declare namespace x="hi" > define function recurse-deep($nodes as node()*) as node()* { > for $node in $nodes > return > if ($node instance of element()) then > element { > fn:QName(fn:in-scope-prefixes($node)[1],fn:local-name($node)) } > { $node/@*, > recurse-deep($node/node() ) > } > > else $node > } > > let $n:= <x:hello><how xmlns="dy"><r>hello</r></how></x:hello> > return recurse-deep($n) > > I have recursive function. I want to use the original qname > of $n when creating new element. > The below almost meets my needs, but not quite. The dy > namespace is being lost on the r element. Any ideas? > I will not know the namespace beforehand of every possible element. > > > > ------------------------------ Message: 5 Date: Thu, 8 Oct 2009 07:06:31 -0500 From: "Glidden, Douglass A" <[email protected]> Subject: RE: [MarkLogic Dev General] Can someone explain how I cangetthefollowing info To: "[email protected]" <[email protected]> Message-ID: <e75f905154e9f64cb9f3ae5ab51165b70277273...@xch-mw-11v.mw.nos.boeing.com> Content-Type: text/plain; charset="us-ascii" Good catch, Geert; thank you for correcting that. Doug Glidden Software Engineer The Boeing Company [email protected] _____ From: [email protected] [mailto:[email protected]] On Behalf Of Geert Josten Sent: Wednesday, October 07, 2009 13:55 To: General Mark Logic Developer Discussion Subject: RE: [MarkLogic Dev General] Can someone explain how I cangetthefollowing info The more verbose version of my response.. ;-) The abbreviated syntax is explained in detail here: http://www.w3.org/TR/xquery/#abbrev Just one note to Doug's reply: '//' is the abbreviation for '/descendant-or-self::node()/' not '/descendant::'. In most cases the result is the same, but there can be significant differences when predicates are involved.. :-P Kind regards, Geert Drs. G.P.H. Josten Consultant <http://www.daidalos.nl/> Daidalos BV Source of Innovation Hoekeindsehof 1-4 2665 JZ Bleiswijk Tel.: +31 (0) 10 850 1200 Fax: +31 (0) 10 850 1199 www.daidalos.nl<http://www.daidalos.nl/> KvK 27164984 De informatie - verzonden in of met dit emailbericht - is afkomstig van Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan dit bericht kunnen geen rechten worden ontleend. _____ From: [email protected] [mailto:[email protected]] On Behalf Of Glidden, Douglass A Sent: woensdag 7 oktober 2009 19:19 To: [email protected] Subject: RE: [MarkLogic Dev General] Can someone explain how I can get thefollowing info Corrections inline below. There might be additional errors I missed. Doug Glidden Software Engineer The Boeing Company [email protected] _____ From: [email protected] [mailto:[email protected]] On Behalf Of [email protected] Sent: Wednesday, October 07, 2009 12:43 To: General Mark Logic Developer Discussion Subject: [MarkLogic Dev General] Can someone explain how I can get thefollowing info I have part of an xml document below I run the following xquery for $question in doc()//Section/PrintQuestion let $questionid := $question/@id let $questions := $question/*/TextFragment Here's the problem: The line above should be "let $questions := $question//TextFragment". To understand the difference, it's helpful to use full, rather than abbreviated, syntax for the XPath: Your XPath expression is equivalent to: $question/child::*/child::TextFragment My corrected version is quite different: $question/descendant::TextFragment Always remember that a single slash that is not followed by an axis selector selects the child axis. return (<div>{string($questionid)}:{for $question in $questions return string($questions/@value)}</div>) There are two problems in this line: First, the TextFragment element does not appear to have a value attribute, and second, for each iteration of the for expression, you're returning the value of all of the questions. What you probably intended was "... return string($question/value()) ...". I can get the PrintQuestionAttribute, but how do I get the TextFragment Question under it? that reads "Randall will spin the spinner twice and add the numbers. What is the probability that he will get a sum that is greater than 5?" -- Thanks, Mike <PrintQuestion id="P620_S4940_0" type="pickOne"> <Standards> <Standard value="" /> </Standards> <References> <PassageRef id="" /> </References> <content contentID=""> <multichoice> <max_score>1</max_score> <question cssClass="" cssStyle=""> <Passage> <Paragraph> <TextFragment><![CDATA[Randall will spin the spinner twice and add the numbers. What is the probability that he will get a sum that is greater than 5?]]></TextFragment> </Paragraph> <Paragraph> <TextFragment type="graphic"></TextFragment> </Paragraph> </Passage> </question> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://xqzone.marklogic.com/pipermail/general/attachments/20091008/a6b22de5/attachment.html ------------------------------ _______________________________________________ General mailing list [email protected] http://xqzone.com/mailman/listinfo/general End of General Digest, Vol 64, Issue 22 ***************************************
_______________________________________________ General mailing list [email protected] http://xqzone.com/mailman/listinfo/general
