[xquery-talk] Query the attributes
Mailing Lists Mail
daktapaal at gmail.com
Thu May 23 02:01:11 PDT 2013
Hi Mike/ JOhn/
As far as my knowledge went, i did not think anything was wrong as
calling a child element should be the same as calling attribute for
practical purposes.
I will try to reproduce the issue with something smaller. In the
meantime, I shall try John's suggestion..,
Thanks both for your replies.
Dak
On Thu, May 23, 2013 at 9:53 AM, John Snelson
<john.snelson at marklogic.com> wrote:
> On 23/05/13 09:34, Mailing Lists Mail wrote:
>>
>> 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>
>
>
> In both those cases you're selecting nodes, and the nodes are being added to
> the result tree. I suspect the browser is displaying the name, as it is an
> element with text content, but the "id" attribute is added as an attribute,
> which browsers don't display.
>
> In both cases what you really want is probably the string value of those
> nodes, which you can get be calling the string() function on them.
>
> John
>
> --
> John Snelson, Lead Engineer http://twitter.com/jpcs
> MarkLogic Corporation http://www.marklogic.com
> _______________________________________________
> talk at x-query.com
> http://x-query.com/mailman/listinfo/talk
More information about the talk
mailing list