Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old June 19th, 2007, 12:34 PM
Registered User
 
Join Date: Jun 2007
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Replacing tags within xml using xslt

Hi,

I want to convert xml in one format into another xml format shown below

Input xml :

<Name>
   <Name1>
       <Name11>Name11</Name11>
       <Name12>Name12</Name12>
   </Name1>
   <Name1>
       <Name11>Name21</Name11>
       <Name12>Name22</Name12>
   </Name1>
   <Name2>
       <Name1>
           <Name11>Name11</Name11>
           <Name12>Name12overRide</Name12>
      </Name1>
      <Name3>
           <Name31>Name3Override</Name31>
       </Name3>
   </Name2>
 <Name3>
       <Name31>Name3Origional</Name31>
 </Name3>
 <Name3>
       <Name32>Name3Origional</Name32>
 </Name3>
</Name>

Output xml


<Name>
   <Name1>
       <Name11>Name11</Name11>
       <Name12>Name12overRide</Name12>
   </Name1>
   <Name1>
       <Name11>Name21</Name11>
       <Name12>Name22</Name12>
   </Name1>
   <Name2>
   </Name2>
 <Name3>
           <Name31>Name3Override</Name31>
 </Name3>
 <Name3>
       <Name32>Name3Origional</Name32>
 </Name3>
</Name>

Basically, Name2 tags stores Overriden information for the tag which are already present inside Name root tag.
i want generic template which does this replacing node based on pre - comparision.
i just know like Name2 is the only tag which stores overRiding information for Node's child tag.
Scenario :
1. While replacing \\Name\Name1 tag, i just know like i have to compare \\Name\Name2\Name1\Name11 with \\Name\Name1\Name11,
 If this value matches, i need to replace \\Name\Name1 tag with \\Name\Name2\Name1 tag.
 Also only \\Name\Name1 tag which satisfies this condition will replace, all other \\Name\Name1 tags remain same.
2. While replacing \\Name\Name3 , i just know like i have to compare \\Name\Name2\Name3\Name31 with \\Name\Name3\Name31,
 If this value matches, i just have to replace that \\Name\Name3 node with \\Name\Name2\Name3.
3. This replacing this should be cut paste kind of thing, not copy paste.

Please help me to find its solution,

Please Reply.

Thanks,



Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
strip html tags with xslt smiter XSLT 4 June 19th, 2012 08:34 AM
xslt for tags dnandhak XSLT 4 May 23rd, 2008 05:57 AM
add HTML tags via XSLT chopswil2 XSLT 3 November 5th, 2007 08:30 AM
XSLT output with tags trinkets XSLT 22 November 14th, 2006 10:22 AM
XSLT help : Interpretting HTML tags from XML kunal_kishan XSLT 1 June 26th, 2006 05:37 AM



All times are GMT -4. The time now is 02:25 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.