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