Thanks. It was helpful. Regards, Sini
On Fri, May 10, 2013 at 11:33 AM, Fahad Khan <[email protected]> wrote: > Hi, > > To get the first available language "fra" or "eng", I would use: > > let $x := > > <languages> > <language iso3="ita"/> > <language iso3="fra"/> > <language iso3="slv"/> > <language iso3="deu"/> > <language iso3="eng"/> > </languages> > > return ($x/language[@iso3="fra" or @iso3="eng"])[1] > > If you really want the position, something like: > > ($x/language[@iso3="fra" or > @iso3="eng"])[1]/fn:count(preceding-sibling::language) + 1 > > Hope that helps. > > Cheers, > > Fahad. > > > On 05/10/2013 06:52 AM, sini narayanan wrote: > > Hi All, > > I have an xml document with different language nodes. > > for example: > > <languages> > <language iso3="ita"/> > <language iso3="fra"/> > <language iso3="slv"/> > <language iso3="deu"/> > <language iso3="eng"/> > </languages> > > I need to fid out, the first available language "fra" or "eng". (If > "fra" node comes first or "eng" comes first) > > Which is the best way to do this ? > Is ther a way to get the position of a node in xquery? > > Thanks, > Sini > > > > _______________________________________________ > General mailing > [email protected]http://developer.marklogic.com/mailman/listinfo/general > > > > _______________________________________________ > General mailing list > [email protected] > http://developer.marklogic.com/mailman/listinfo/general > >
_______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
