well without the input I can only guess, but teh name of an element
thatuses a start tag of <dialog> is dialog not <dialog> and local-name
is the same if you are not using namespaces.
I would guess that the first temp above is the correct output.
You generae a temp element node, copy the attribute nodes (which will
appear as attributes in the start tag when serialised) then you
{$b/@*,
then you make a sequence of three strings
name($b), local-name($b), namespace-uri($b)
when you linearise such a sequence you put spaces between each string so
you end up with
dialog dialog
The second <temp< element is not well formed, presumably a cut and paste
wrong.
David
Thanks.. I understand a bit more now.
Well, if you have any more time...
I want to see if I can get the element name (i.e. "book" in this case) of the
elements with any attribute of value "1992".
I'm getting the entire element <book> in all its glory.. I'd like to just get
the "name" of the element that has the attributes, not of its child elements
also.
If I use the input below (books.xml)
and I I submit this query
for $b in document("books.xml")//*[@*="1992"]
return
<temp>{$b/@*, $b/.[name()]}</temp>
{-- results in this output
<temp year="1992">
<book year="1992">a1992<title>Advanced Programming in the UNIX
Environment</title>
<author>
<last>Stevens</last>
<first>W.</first>
</author>
<publisher>Addison-Wesley</publisher>
<price>65.95</price>
</book>
</temp>
--}
books.xml:
<bib>
<book year="1994">a1994 <title>TCP/IP Illustrated</title>
<author>
<last>Stevens</last>
<first>W.</first>
</author>
<publisher>Addison-Wesley</publisher>
<price>65.95</price>
</book>
<book year="1992">a1992<title>Advanced Programming in the UNIX
Environment</title>
<author>
<last>Stevens</last>
<first>W.</first>
</author>
<publisher>Addison-Wesley</publisher>
<price>65.95</price>
</book>
<book year="2000">a2000<title>Data on the Web</title>
<author>
<last>Abiteboul</last>
<first>Serge</first>
</author>
<author>
<last>Buneman</last>
<first>Peter</first>
</author>
<author>
<last>Suciu</last>
<first>Dan</first>
</author>
<publisher>Morgan Kaufmann Publishers</publisher>
<price>65.95</price>
</book>
<book year="1999">a1999<title>The Economics of Technology and Content
for Digital TV</title>
<editor>
<last>Gerbarg</last>
<first>Darcy</first>
<affiliation>CITI</affiliation>
</editor>
<publisher>Kluwer Academic Publishers</publisher>
<price>129.95</price>
</book>
</bib>
Jeff Kish