At 2009-12-08 09:39 -0500, Tony Mariella wrote:
I understand, I'm adding multiple attributes to the same element.
Here's what I want to do: I want to return the value of the id attribute
and put that value in a new tag.
<results>
<item>
<id>{$docs/results/interface/@id}</id>
<descr>{$docs/results/interface/desciption}<descr>
</item>
</results>
Excellent ... that is how questions should be asked in the first
place. An example of the data and an example of the desired result.
You need to set the focus to each of the input items and built your
result item from each one.
I hope the answer below helps.
. . . . . . . Ken
T:\ftemp>type tony.xml
<results>
<interface id="345">
<description>Test Interface A</description>
</interface>
<interface id="678">
<description>Test Interface A</description>
</interface>
</results>
T:\ftemp>xquery tony.xq
<?xml version="1.0" encoding="UTF-8"?>
<results>
<item>
<id>345</id>
<desc>Test Interface A</desc>
</item>
<item>
<id>678</id>
<desc>Test Interface A</desc>
</item>
</results>
T:\ftemp>type tony.xq
for $docs in doc('tony.xml') return
<results>
{
for $i in $docs/results/interface
return
<item>
<id>{string($i/@id)}</id>
<desc>{string($i/description)}</desc>
</item>
}
</results>
T:\ftemp>
--
XSLT/XQuery/XPath training after http://XMLPrague.cz 2010-03-15/19
Vote for your XML training: http://www.CraneSoftwrights.com/q/i/
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/q/
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:[email protected]
Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/q/bc
Legal business disclaimers: http://www.CraneSoftwrights.com/legal
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general