Exactly $list/@* ,
Thanks David! Mike On Fri, Jun 11, 2010 at 2:52 PM, Lee, David <[email protected]> wrote: > Not sure exactly from this question what is variable and what is fixed. > > The simple answer is to get all attributes use @* > > > > Taking a **guess** at how you want to link things > > > > for $list in //list > > return > > <list>{ $list/@* , > > for $item in $list/* > > return > > //stuff/it...@foo eq $item/foo] > > } > > </list> > > > > > > return > > > > > > > > > > *From:* [email protected] [mailto: > [email protected]] *On Behalf Of *Mike Brevoort > *Sent:* Friday, June 11, 2010 4:36 PM > *To:* General Mark Logic Developer Discussion > *Subject:* [MarkLogic Dev General] How to get a node without children > > > > I posted this question up at StackOverflow as well: > http://stackoverflow.com/questions/3026038/how-to-get-node-without-children-in-xquery > > > > Hopefully this has a simple answer, "xQuery/xPath 201" perhaps. So I have > two nodes of elements that I'm essentially trying to join. I want the top > level node to stay the same but the child nodes to be replaced by those > cross referenced. > > > > Given: > > > > <stuff> > > <item foo="foo" boo="1"/> > > <item foo="bar" boo="2" /> > > <item foo="baz" boo="3"/> > > <item foo="blah boo="4""/> > > </stuff> > > > > <list a="1" b="2"> > > <foo>bar</foo> > > <foo>baz</foo> > > </list> > > > > I want to loop through "list" and cross reference elements in "stuff" for > this result: > > > > <list a="1" b="2"> > > <item foo="bar" boo="2" /> > > <item foo="baz" boo="3"/> > > </list> > > > > I want to do this without having to know about what attributes might be on > "list". In other words I don't want to have to explicitly call them out like > > > > attribute a { $list/@a }, attribute b { $list/@b } > > > > Thanks! > > Mike > > > > _______________________________________________ > General mailing list > [email protected] > http://developer.marklogic.com/mailman/listinfo/general > > -- Mike Brevoort / Enterprise Web Practice Manager / Avalon Consulting LLC / 303-834-7509 / twitter:mbrevoort
_______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
