As you requested the XQuery proposal and solution, here it is:
declare function local:createTestDoc() as node()* { <simple> <propertyid> <value>p1</value> <value>p2</value> <value>p3</value> <value>p4</value> </propertyid> <complexid> <value>c1</value> <value>c2</value> <value>c3</value> </complexid> </simple> }; declare function local:doProcessing($arg as node()*) as xs:string* { let $simpleElement := $arg return ( concat("ColumnName", " ", "Value") , for $propertyId in $simpleElement/propertyid/* return ( concat("propertyid", " ", data($propertyId)) ) , for $complexId in $simpleElement/complexid/* return ( concat("complexid", " ", data($complexId)) ) ) }; local:doProcessing(local:createTestDoc())
Instead of using local: createTestDoc () you will have to include your document using something like:
declare variable $myDoc := doc("urlToDoc");
and pass it to local: doProcessing () fn.
local:doProcessing($myDoc)
source share