problem using for loop in function
Posted: Fri Jul 31, 2009 11:59 am
Hello,
I am trying to access a secondary source document from within a Xquery function. As follows:
-------------------------------------
declare function kzf:make-observations2 ($recipient as element(*,v1:CaregroupcourseParticipant))
as element(hl7:component)* {
for $i in (doc("file:///C:/HISKIS/exe/CIM/v2/wsdls/EvT v0.3.xml")/messageComposition/messageDef)
return
<component>
<observation classCode="OBS" moodCode="EVN">
<id root="1.2.34.5.7968694845657694"/>
<code code="{data($i/id/@extension)}" codeSystem="2.16.840.1.113883.6.1" displayName="Bloedglucosewaarden nuchter"/>
<effectiveTime value="200904021044"/>
<value xsi:type="PQ" value="5.5" unit="mmol/l"/>
</observation>
</component>
};
------------------------------------
This code is validated succesfully and executed however the code attribute value remains empty "".
If I extract this code and execute it in (main)standalone xquery file it gives the results I expect.
What am I missing out here ?
any suggestions ?
Thanks
Peter Geerts
I am trying to access a secondary source document from within a Xquery function. As follows:
-------------------------------------
declare function kzf:make-observations2 ($recipient as element(*,v1:CaregroupcourseParticipant))
as element(hl7:component)* {
for $i in (doc("file:///C:/HISKIS/exe/CIM/v2/wsdls/EvT v0.3.xml")/messageComposition/messageDef)
return
<component>
<observation classCode="OBS" moodCode="EVN">
<id root="1.2.34.5.7968694845657694"/>
<code code="{data($i/id/@extension)}" codeSystem="2.16.840.1.113883.6.1" displayName="Bloedglucosewaarden nuchter"/>
<effectiveTime value="200904021044"/>
<value xsi:type="PQ" value="5.5" unit="mmol/l"/>
</observation>
</component>
};
------------------------------------
This code is validated succesfully and executed however the code attribute value remains empty "".
If I extract this code and execute it in (main)standalone xquery file it gives the results I expect.
What am I missing out here ?
any suggestions ?
Thanks
Peter Geerts