How do I choose parent node attribute and its child values using XML and Xquery?

There are no a1 a2 or a3 attributes in the provided XML document! Use : pss/ps/@*name(.)='n' or name(.)='m' | /pss/ps/sc/@a This is the XPath expression that selects the wanted nodes from the provided XML document. I am not sure how it should be combined into an SQL command.

There are no a1, a2 or a3 attributes in the provided XML document! Use: /pss/ps/@*name(.)='n' or name(.)='m' | /pss/ps/sc/@a This is the XPath expression that selects the wanted nodes from the provided XML document. I am not sure how it should be combined into an SQL command.

Thanx, but ERROR: XQuery mts.dbo.bill.xCol.nodes(): There is no function '{w3. Org/2004/07/xpath-functions}:name()'. – Kai Osmon Oct 20 '10 at 11:42 "There are no a1, a2 or a3 attributes in the provided XML document!" - this is attribute "s" of node, sorry – Kai Osmon Oct 20 '10 at 11:43 @Kai: My answer is in pure XPath 1.0 -- you didn't specify XQuery as a tag!.

Now I updated the answer and it will run both in XPath 1.0 and XPath 2.0 (XQuery is a superset of XPath 2.0). – Dimitre Novatchev Oct 20 '10 at 12:45 Dimitre. I am quite new to all thу X... stuff.

Will you please give me a solution to thу xml at the very top: is the root node and it has several nodes. Nodes have nodes. What I need is: Get an attribute of node and all atributes of its nodes (repeats for each node).

– Kai Osmon Oct 21 '10 at 5:20 I need a query to have the above selected... – Kai Osmon Oct 21 '10 at 5:21.

Declare @document xml set @document = N' ' select pses.ps. Value(N'@m', N'NVARCHAR(10)') , scs.sc. Value(N'@s', N'NVARCHAR(2)') from @document.

Nodes(N'//ps') pses(ps) cross apply pses.ps. Nodes(N'//sc') scs(sc).

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions