Changeset 3071 for TI07-MOLES


Ignore:
Timestamp:
29/11/07 13:23:35 (12 years ago)
Author:
lawrence
Message:

Fix to Kev's strip namespace routine so it doesn't strip
mixed content as well ...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TI07-MOLES/trunk/eXist specific/xqueryLib/Utilities/utility_xquery_lib.xquery

    r2511 r3071  
    44declare variable $utillib:moles_id_separator as xs:string {'__'}; 
    55 
    6 declare function utillib:strip-namespace($e as element()) as element()  
     6declare function utillib:kev-strip-namespace($e as element()) as element()  
    77(: Removes namespace info from the element tree being addressed so that it will lie in the default namespace  :) 
    8 { 
    9 element {QName('', local-name($e))}   
    10 { 
     8{  
     9element {QName('', local-name($e))} { 
    1110let $parent :=$e 
    1211let $childcount := count($parent/*) 
     
    1514for $child in ($e/*) 
    1615return 
    17 utillib:strip-namespace($child) 
     16utillib:kev-strip-namespace($child) 
    1817else (data($e)) 
    19 } 
    20 }; 
     18}  
     19};  
     20declare function utillib:strip-namespace($e as element()) as element()  
     21(: Bryan's version of Kev's code, based on Google and Michael Kay 
     22which actually does what it says on the  tin, unlike the above :) 
     23{ 
     24   element {QName((), local-name($e))} 
     25   { 
     26     for $child in $e/(@*,node() ) 
     27     return 
     28       if ($child instance of element()) 
     29       then utillib:strip-namespace($child) 
     30       else $child 
     31   } 
     32 }; 
Note: See TracChangeset for help on using the changeset viewer.