Hello Everyone, I am having a problem extracting value from an element
Here is the XML on which I am trying to run my query


Let $document := "<report>
        <body>
        <row>
            <ChapterTitle>Front Matter</ChapterTitle>
</row

</body>

</report>"


These are the functions that I have written to extract the value of the 
"ChapterTitle" Tag


declare function oxy:getHierarchyElements() {
    let $TagName := "Chapter Title"


        (:removing the space between Chapter and Title:)

let $tokenizedString := fn:tokenize(($TagName), '\s')
        let $concatString :=  fn:concat($tokenizedString[1], 
$tokenizedString[2])
         return
            element {$concatString} {''}

};

declare function oxy:getLevel($document as xs:string){
    let $file := doc($document)
    let $hierarchy := oxy:getHierarchyElements()
    return
            $file/report/body/row/$hierarchy
};


When I call oxy:getLevel($oxy:document) I get <ChapterTitle/>  instead of 
"Front Matter" from the XML file.


If I replace   $file/report/body/row/$hierarchy with  
$file/report/body/row/ChapterTitle I get the correct value.


Thanks for your help in advance

————————————————
Kashif Khan
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to