Subject:Dynamical xpath Author:Doug Hoople Date:26 Aug 2005 11:28 AM
Eugene,
Depending on your parser, you can use the evaluate() extension function.
Assuming the Saxon 8.4 parser, try:
declare function local:selectChapter($var as xs:string) as node()* {
let $exprString := string-join( ("/book/", $var), "" )
return saxon:evaluate($exprString)
};
Of course, you'll have to also set your context properly to make this work, but this at least answers your dynamic expression formation question.