Thanks, Geert. I figured it was something semi-esoteric like that. -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Geert Josten Sent: Wednesday, March 18, 2009 10:51 AM To: General Mark Logic Developer Discussion Subject: RE: [MarkLogic Dev General] Unexpected results when using a filterexpression
Hi Stewart, It is a mistake made in XSLT as well. The positional predicate operates on document order. Your expression is literally searching for any xh:a element that occurs as first xh:a element within its parent. That is quite something different then ($div//xh:a)[1].. :-) Best regards, Geert > Drs. G.P.H. Josten Consultant http://www.daidalos.nl/ Daidalos BV Source of Innovation Hoekeindsehof 1-4 2665 JZ Bleiswijk Tel.: +31 (0) 10 850 1200 Fax: +31 (0) 10 850 1199 http://www.daidalos.nl/ KvK 27164984 De informatie - verzonden in of met dit emailbericht - is afkomstig van Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan dit bericht kunnen geen rechten worden ontleend. > From: [email protected] > [mailto:[email protected]] On Behalf Of > Stewart Shelline > Sent: woensdag 18 maart 2009 17:43 > To: General Mark Logic Developer Discussion > Subject: [MarkLogic Dev General] Unexpected results when > using a filter expression > > 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 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
