[xquery-talk] Query the attributes

Michael Kay mike at saxonica.com
Thu May 23 01:48:09 PDT 2013


I can't see anything wrong with your code. Sorry if that's not a helpful answer but at least you know someone is listening!

Giving a complete query and source document might help, then at least we can see if it works on other processors, or we might spot something strange in the XML. The only XML I can think of that's consistent with your observations is where the id attribute is present with a value of "" (empty string).

Michael Kay
Saxonica

On 23 May 2013, at 09:34, Mailing Lists Mail wrote:

> Dear All,
> I was trying to query the atribute value using Xquery in MarkLogic and
> no matter what, I dont seem to be printing the value...
> So this is what I do...
> 
> for $college at $position in  $doc//college
>    return
>         <div>
>             {$college/name}
>         </div>
>        <div>
>             {$college/@id}
>         </div>
> 
> This is interesting as the first div is prints the name of the
> college... the second is empty..  if I change the xpath to:
>  <div>
>             {$college/@*[1]/name()}
>         </div>
>  this does print the text "id"  , which is correct.
> 
> so I tried
> 
> <div>
>             {$college/@*[1] }
>         </div>
> 
> I thought that this should print the value in the attribute id, which
> is also the first attribute...
> 
> There is probably something very basic, I am missing... So please help!
> 
> Thanks
> --Dak
> _______________________________________________
> talk at x-query.com
> http://x-query.com/mailman/listinfo/talk




More information about the talk mailing list