|
[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message] last possible child's attributeMichalmas michalmas at gmail.comSun 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 <http://x-query.com/mailman/listinfo/talk > 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: >> 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 > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://x-query.com/pipermail/talk/attachments/20090308/fed9d17d/attachment.htm
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|






