Changeset 4669


Ignore:
Timestamp:
17/12/08 09:33:03 (11 years ago)
Author:
sdonegan
Message:

Get rid of bug with targetCollection setter.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • exist/trunk/xquery/moles2dif.xq

    r4436 r4669  
    1 declare default element namespace 'http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/'; 
     1declare default element namespace 'http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/'; 
    22declare namespace xsi='http://www.w3.org/2001/XMLSchema-instance'; 
    33declare namespace moles='http://ndg.nerc.ac.uk/moles'; 
    44declare namespace f='http://ndg.nerc.ac.uk/moles/localfunctions'; 
     5 
     6 
     7import module namespace voclib='http://ndg.nerc.ac.uk/xquery/lib/vocab' at 'vocab_xquery_lib.xquery'; 
     8import module namespace inputParse='http://ndg.nerc.ac.uk/xquery/lib/inputParse' at 'inputParse_xquery_lib.xquery'; 
     9 
    510 
    611(: 
     
    1116 
    1217(: Keep this in official lib version :) 
     18(:declare variable collection($targetCollection) := doc('molesOP.xml'); 
     19declare variable $repositoryIdentifier as xs:string := 'Input_Repository_Code'; 
     20declare variable $localIdentifier as xs:string := 'MRMLN00400000061'; 
     21:) 
    1322declare variable $targetCollection as xs:string := 'TargetCollection'; 
    1423declare variable $repositoryIdentifier as xs:string := 'RepositoryID'; 
     
    1625 
    1726(: Keep 
    18 declare variable $targetCollection as xs:string := '/db/ndg_B_metadata'; 
     27declare variable collection($targetCollection) as xs:string := '/db/ndg_B_metadata'; 
    1928declare variable $repositoryIdentifier as xs:string := 'badc.nerc.ac.uk'; 
    2029declare variable $localIdentifier as xs:string := 'dataent_CIRA'; 
    2130:) 
    22  
    2331 
    2432for $DE in collection($targetCollection)/moles:dgMetadata/moles:dgMetadataRecord[ 
     
    9098        return 
    9199            element Sensor_Name { 
    92                (: for $DepDPTAbbrev in distinct-values(($targetCollection/moles:dgMetadata/moles:dgMetadataRecord[moles:dgMetadataID[moles:schemeIdentifier='NDG-B0' and moles:repositoryIdentifier=$DepDPT/moles:repositoryIdentifier and moles:localIdentifier=$DepDPT/moles:localIdentifier]]/moles:abbreviation)):) 
     100               (: for $DepDPTAbbrev in distinct-values((collection($targetCollection)/moles:dgMetadata/moles:dgMetadataRecord[moles:dgMetadataID[moles:schemeIdentifier='NDG-B0' and moles:repositoryIdentifier=$DepDPT/moles:repositoryIdentifier and moles:localIdentifier=$DepDPT/moles:localIdentifier]]/moles:abbreviation)):) 
    93101                for $DepDPTAbbrev in distinct-values((collection($targetCollection)/moles:dgMetadata/moles:dgMetadataRecord[moles:dgMetadataID[moles:schemeIdentifier='NDG-B0' and moles:repositoryIdentifier=$DepDPT/moles:repositoryIdentifier and moles:localIdentifier=$DepDPT/moles:localIdentifier]]/moles:abbreviation)) 
    94102                    return element Short_Name {data($DepDPTAbbrev)}, 
    95                 (:for $DepDPTName in distinct-values(($targetCollection/moles:dgMetadata/moles:dgMetadataRecord[moles:dgMetadataID[moles:schemeIdentifier='NDG-B0' and moles:repositoryIdentifier=$DepDPT/moles:repositoryIdentifier and moles:localIdentifier=$DepDPT/moles:localIdentifier]]/moles:name)):) 
     103                (:for $DepDPTName in distinct-values((collection($targetCollection)/moles:dgMetadata/moles:dgMetadataRecord[moles:dgMetadataID[moles:schemeIdentifier='NDG-B0' and moles:repositoryIdentifier=$DepDPT/moles:repositoryIdentifier and moles:localIdentifier=$DepDPT/moles:localIdentifier]]/moles:name)):) 
    96104                for $DepDPTName in distinct-values((collection($targetCollection)/moles:dgMetadata/moles:dgMetadataRecord[moles:dgMetadataID[moles:schemeIdentifier='NDG-B0' and moles:repositoryIdentifier=$DepDPT/moles:repositoryIdentifier and moles:localIdentifier=$DepDPT/moles:localIdentifier]]/moles:name)) 
    97105                    return element Long_Name {data($DepDPTName)} 
     
    100108        return 
    101109            element Source_Name { 
    102                 (:for $DepObsStnAbbrev in distinct-values(($targetCollection/moles:dgMetadata/moles:dgMetadataRecord[moles:dgMetadataID[moles:schemeIdentifier='NDG-B0' and moles:repositoryIdentifier=$DepObsStn/moles:repositoryIdentifier and moles:localIdentifier=$DepObsStn/moles:localIdentifier]]/moles:abbreviation)):) 
     110                (:for $DepObsStnAbbrev in distinct-values((collection($targetCollection)/moles:dgMetadata/moles:dgMetadataRecord[moles:dgMetadataID[moles:schemeIdentifier='NDG-B0' and moles:repositoryIdentifier=$DepObsStn/moles:repositoryIdentifier and moles:localIdentifier=$DepObsStn/moles:localIdentifier]]/moles:abbreviation)):) 
    103111                for $DepObsStnAbbrev in distinct-values((collection($targetCollection)/moles:dgMetadata/moles:dgMetadataRecord[moles:dgMetadataID[moles:schemeIdentifier='NDG-B0' and moles:repositoryIdentifier=$DepObsStn/moles:repositoryIdentifier and moles:localIdentifier=$DepObsStn/moles:localIdentifier]]/moles:abbreviation)) 
    104112                    return element Short_Name {data($DepObsStnAbbrev)}, 
    105                 (:for $DepObsStnName in distinct-values(($targetCollection/moles:dgMetadata/moles:dgMetadataRecord[moles:dgMetadataID[moles:schemeIdentifier='NDG-B0' and moles:repositoryIdentifier=$DepObsStn/moles:repositoryIdentifier and moles:localIdentifier=$DepObsStn/moles:localIdentifier]]/moles:name)):) 
     113                (:for $DepObsStnName in distinct-values((collection($targetCollection)/moles:dgMetadata/moles:dgMetadataRecord[moles:dgMetadataID[moles:schemeIdentifier='NDG-B0' and moles:repositoryIdentifier=$DepObsStn/moles:repositoryIdentifier and moles:localIdentifier=$DepObsStn/moles:localIdentifier]]/moles:name)):) 
    106114                for $DepObsStnName in distinct-values((collection($targetCollection)/moles:dgMetadata/moles:dgMetadataRecord[moles:dgMetadataID[moles:schemeIdentifier='NDG-B0' and moles:repositoryIdentifier=$DepObsStn/moles:repositoryIdentifier and moles:localIdentifier=$DepObsStn/moles:localIdentifier]]/moles:name)) 
    107115                    return element Long_Name {data($DepObsStnName)} 
     
    165173                    order by $DataCreatorRole/moles:startDate empty least 
    166174                            return 
    167                               (:##for $DataCreatorRoleHolder in $targetCollection/moles:dgMetadata/(moles:dgOrganisation | moles:dgPerson):) 
     175                              (:##for $DataCreatorRoleHolder in collection($targetCollection)/moles:dgMetadata/(moles:dgOrganisation | moles:dgPerson):) 
    168176                                for $DataCreatorRoleHolder in collection($targetCollection)/moles:dgMetadata/(moles:dgOrganisation | moles:dgPerson) 
    169177                                                [(moles:dgMetadataID/moles:schemeIdentifier='NDG-B0' 
Note: See TracChangeset for help on using the changeset viewer.