In the example below, I would expect the statement $div//xh:a[1] to return the first <a> element, but instead, it returns two <a> elements. Curiously, if I filter for the second <a> element using [2], it works. What am I missing?
xquery version "1.0-ml"; declare namespace xh = "http://www.w3.org/1999/xhtml"; <lds-terms> { for $letter at $ctr in ("A") let $url := concat( "http://scriptures.lds.org/en/bd/", lower-case( $letter ), "/contents" ) let $page := xdmp:tidy( xdmp:http-get( $url )[2] )//xh:d...@class = "contents"] return for $div in $page//xh:d...@class = "topics"] return <term>{ $div//xh:a[1] }</term> } </lds-terms> NOTICE: This email message is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.
_______________________________________________ General mailing list [email protected] http://xqzone.com/mailman/listinfo/general
