[xquery-talk] last possible child's attribute

Michalmas michalmas at gmail.com
Sun Mar 8 15:02:03 PST 2009


@Christian, Ken
Yes, the solution works perfect

@Jens
Also, works good.


My confusion was that the attribute can't be find not that it can't be
displayed.

Thank you!

On Sun, Mar 8, 2009 at 2:57 PM, G. Ken Holman <gkholman at cranesoftwrights.com
> wrote:

> At 2009-03-08 14:45 +0100, Michalmas wrote:
>
>> It still gives me the same error:
>>
>> XQuery Serialization Error!
>> A document node may not have an attribute node or a namespace node as a
>> child
>>
>
> Yes, because attribute nodes can only be attached to an element.
>
> You are putting out a document and you are trying to add just the
> attribute.
>
> I posted code that was working, and you'll see that I used the string()
> function in order to add a string to the document node, not the attribute
> itself.
>
>  On Sun, Mar 8, 2009 at 2:32 PM, G. Ken Holman <<mailto:
>> gkholman at cranesoftwrights.com>gkholman at cranesoftwrights.com> wrote:
>> t:\ftemp>type michalmas.xml
>>
>> <a>
>>  <aa lc="1">
>>    <aaa lc="00">
>>    </aaa>
>>  </aa>
>>  <bb lc="0">
>>  </bb>
>>  <zz lc="1">
>>    <ccc lc="123">
>>    </ccc>
>>  </zz>
>> </a>
>>
>> t:\ftemp>type michalmas.xq
>> string( a/descendant::*[last()]/@lc ),
>> string( (a//@lc)[last()] )
>> t:\ftemp>xquery michalmas.xml michalmas.xq
>> <?xml version="1.0" encoding="UTF-8"?>123 123
>> t:\ftemp>
>>
>
> Notice above how I'm adding the values of the attributes, not the
> attributes themselves to the result.
>
> I hope this helps.
>
> . . . . . . . Ken
>
> --
> XQuery/XSLT training in Prague, CZ 2009-03 http://www.xmlprague.cz
> XQuery/XSLT/XSL-FO training in Los Angeles/Anaheim - 2009-06-01/10
> Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video
> Video lesson:    http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18
> Video overview:  http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18
> G. Ken Holman                 mailto:gkholman at CraneSoftwrights.com
> Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/q/
> Male Cancer Awareness Nov'07  http://www.CraneSoftwrights.com/q/bc
> Legal business disclaimers:  http://www.CraneSoftwrights.com/legal
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://x-query.com/pipermail/talk/attachments/20090308/fed9d17d/attachment.htm


More information about the talk mailing list