xquery expression to return a link text only if it contains within it a specific string
- by Arvind
I want to extract some links from a XML document (links are in same format as on html pages).
Now for eg a link is "http://xyz.com/start/tyu/a.html" and another is "http://ert.com/tyu/b.html" while a third link is "http://asdf.com/ghjk/c.html"
From the above 3 links (which I have with me using a for clause in a FLWOR expression)...I want only the links which contain within them a string "tyu" to be selected-- I thought of using substring for this, but substring requires start and end positions to be specified- whereas in my scenario, I dont know at which position the desired string will be.
How do I do substring matching in such a scenario, i.e. where exact position for occurrence of substring, is not known? I can use XQuery 1.0 for this purpose.
Finally, I want to extract the link URL, as well as link text...