When i try to do
from("direct:start")
.transform(xquery("<Name>{/bookstore/book[1]/author/text()}</Name>"));,
it give the expected result <Name>Giada De Laurentiis</Name>
But when i try with loop condition as below
from("direct:start")
.transform(xquery("<BookList>{for $x at $i in /bookstore/book return
<book>{bookstore/book[{$i}]/title/text()}</book>}</BookList>"));
I throw error on line 1 column 73
XPST0003 XQuery syntax error near #...turn <book>'{bookstore/book[{$#:
Unexpected token "{" in path expression
org.apache.camel.CamelExecutionException: Exception occurred during
execution on the exchange: Exchange[Message: <?xml version="1.0"
encoding="UTF-8"?>
If i remove braces print reponse as
"<BookList><book>bookstore/book[1]/title/text()</book><book>bookstore/book[2]/title/text()</book><book>bookstore/book[3]/title/text()</book><book>bookstore/book[4]/title/text()</book></BookList>"
Is there a way i can execute this for condition "{for $x at $i in
/bookstore/book return <book>{bookstore/book[{$i}]/title/text()}</book>}"
through camel xquery API
Thank you!
--
View this message in context:
http://camel.465427.n5.nabble.com/Xquery-Transform-using-camel-tp5764730.html
Sent from the Camel Development mailing list archive at Nabble.com.