Community-Credit.com | NonProfitWays.com | SOAPitstop.com   Skin:   
      User: Not logged in 
Home
Newsletter Signup
XSLT Library
Latest XML Blogs
Featured Examples
Presentations
Featured Articles
Book Chapters
Training Courses
Events
NewsGroups
 
Discussions
Examples
Tutorials
Tools
Articles
Resources
Websites
 
Sign In
My Profile
My Articles
My Examples
My Favorites
My Resources
Add a Resource
Logout
 
About Me
My Blog
HeadGeek Articles
Talking Portfolio
Resume
Pictures
World Trip Pics

Reply: XPATH/XQUERY newbie: generating elements from attribute values, etc.

Date Posted:1/5/2007 6:59 PM
Posted by:
jerry jackall
I want to be capable of traversing and then generating XML from source XML similar to this:
<myxml:InternalID owner="MyCompany"> 
   <myxml:ID name="VisitID">ABC</myxml:ID> 
   <myxml:ID name="HisOrHerID">XYZ</myxml:ID>
</myxml:InternalID> 

For each element (root/parent/child, etc.) in the source XML, I want to generate new XML containing elements named after attribute "values" and to populate said elements with their corresponding values. For example:

<MyCompany> 
   <VisitID>ABC</VisitID> 
   <HisOrHerID>XYZ</HisOrHerID>
</MyCompany>

How can I leverage xpath/xquery to accomplish this?

 

Keep in mind that I must perform this transformation within an xslt file. I find xpath in particular confusing and unintuitive. 


Thank you in advance.





Fans of "The Office"
Dwight Bobbleheads are here!
  “It's me! I'm the bobblehead! Yes!”



Advertise on XMLPitstop

Advertise on XMLPitstop


EggHead Cafe
Web Servicee development
DotNetSlackers
Buy links on this site!
remote backup
designer sunglasses
Security Camera
UK Web Hosting
Color Laser Printer
Buy links on this site!

Interested in Text ads?
2,277 Total Members
42 members(last 30 days)
13 members(last 7 days)
3 members(today)

1,629 Total Discussions
17 Posts(last 30 days)
2 Posts(last 7 days)
1 Posts(today)

20,047 Total Blog Posts
2,133 Blogs(last 30 days)
573 Blogs(last 7 days)
56 Blogs(today)

8,699 Newsgroup Posts
0 Posts(last 30 days)
0 Posts(last 7 days)
0 Posts(today)

13,802 Total Resources
16 Resources(last 30 days)
1 Resources(last 7 days)
0 Resources(today)


 

David Silverlight's XMLPitstop.com| 2801 Florida Ave #225|Miami, FL 33133|Ph:305-447-1139