When you state (in-scope)... xmlns="msearch" is the in-scope namespace declaration?
If this declaration were not to exist, would a declared default attribute namespace be utilized? Date: Fri, 29 Jan 2010 13:29:34 -0800 From: Michael Blakeley <[email protected]> Subject: Re: [MarkLogic Dev General] 4.1 vs 3.2 attribute namespace To: General Mark Logic Developer Discussion <[email protected]> Cc: Paul M <[email protected]> Message-ID: <[email protected]> Content-Type: text/plain; charset=UTF-8; format=flowed Paul, If $pr-qname didn't have a namespace in 3.2, that may have been a bug in 3.2. Per http://www.w3.org/TR/xquery-operators/#constructor-qname-notation the xs:QName() constructor is affected by in-scope namespace declarations. In this situation I would use the fn:QName() function, which takes a separate namespace parameter. That can be the empty string. .... let $pr-qname := QName('', fn:concat("ps-rk-",$pos)) .... Alternatively, you could leave $pr-qname as a string. .... let $pr-qname := fn:concat("ps-rk-",$pos) .... Either way, the result is the same: the constructed attribute is in the empty namespace. <m-ps-group xmlns="msearch"><m-ps-rk-1>8888</m-ps-rk-1><m-ps-cd ps-rk-1="8888">8888</m-ps-cd><m-ps-text ps-cd="8888">alleights</m-ps-text></m-ps-group> -- Mike On 2010-01-29 10:49, Paul M wrote: > xquery version "0.9-ml" > > define function processm-p() as node()* > { > <m-ps-group xmlns="msearch"> > { > let $pos := "1" > let $new-value := "8888" > let $ps-text := "alleights" > let $pr-qname := xs:QName(fn:concat("ps-rk-",$pos)) > let $epr-qname := xs:QName(fn:concat("m-ps-rk-",$pos)) > return (element {$epr-qname} {$new-value}, element m-ps-cd >{attribute {$pr-qname} {$new-value}, $new-value},<m-ps-text >ps-cd="{$new-value}">{$ps-text}</m-ps-text>) > } > </m-ps-group> > } > let $s := processm-p() > return $s > > > <m-ps-group xmlns="msearch"> > <m-ps-rk-1>8888</m-ps-rk-1> > <m-ps-cd _1:ps-rk-1="8888" xmlns:_1="msearch">8888</m-ps-cd><m-ps-text > ps-cd="8888">alleights</m-ps-text> > </m-ps-group> > > > When run under 3.2, the attribute ps-rk-1 does not contain a namespace... > > So what would be the best method to make certain ps-rk-1 does not have a > namespace, if possible? > let $pr-qname := xs:QName(fn:concat("ps-rk-",$pos)) > No namespace was specified. > > > > >
_______________________________________________ General mailing list [email protected] http://xqzone.com/mailman/listinfo/general
