[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message]

last possible child's attribute

G. Ken Holman gkholman at CraneSoftwrights.com
Sun Mar 8 09:57:50 PST 2009


  last possible child's attribute
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:http://x-query.com/mailman/listinfo/talk>http://x-query.com/mailman/listinfo/talk> 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:http://x-query.com/mailman/listinfo/talk
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



PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.