troubleshooting Question

xml transformation using xslt

Avatar of saad220
saad220Flag for Germany asked on
Web Languages and StandardsXMLAdobe Dreamweaver
13 Comments1 Solution1663 ViewsLast Modified:
i have some xml file and i need to modify abit using xslt..here is the xml file


<tree>
<lists>
<parent_d>AAAA</parent_d>
<child_d>AAAA1</child_d>
<arName>1</arName>
<arName>2</arName>
<arName>3</arName>
<child_d>AAAA2</child_d>
<arName>2</arName>
<arName>4</arName>
<arName>5</arName>
<child_d>AAA3</child_d>
<arName>4P</arName>
</lists>
<lists>
<parent_d>BBBB</parent_d>
<child_d>BB1</child_d>
<arName>1</arName>
<arName>2</arName>
<arName>3</arName>
<child_d>BBS2</child_d>
<arName>2</arName>
<arName>5</arName>
<child_d>BBZ3</child_d>
<arName>8</arName>
</lists>
</tree>


what i want to do is add <plist> before every <child_d></child_d> tag and to add <clist> before <arName></arName> tag... like the following exaple....

some one help please.....

<tree>
<lists>
<parent_d>AAAA</parent_d>
<plist>
<child_d>AAAA1</child_d>
<clist>
<arName>1</arName>
</clist>
<clist>
<arName>2</arName>
</clist>
<clist>
<arName>3</arName>
</clist>
</plist>
<plist>
<child_d>AAAA2</child_d>
<clist>
<arName>2</arName>
</clist>
<clist>
<arName>4</arName>
</clist>
<clist>
<arName>5</arName>
</clist>
</plist>
<plist>
<child_d>AAA3</child_d>
<clist>
<arName>4P</arName>
</clist>
</plist>
</lists>

<lists>
<parent_d>BBBB</parent_d>
<plist>
<child_d>BB1</child_d>
<clist>
<arName>1</arName>
</clist>
<clist>
<arName>2</arName>
</clist>
<clist>
<arName>3</arName>
</clist>
</plist>
<plist>
<child_d>BBS2</child_d>
<clist>
<arName>2</arName>
</clist>
<clist>
<arName>4</arName>
</clist>
<clist>
<arName>5</arName>
</clist>
</plist>
<plist>
<child_d>BBZ3</child_d>
<clist>
<arName>8</arName>
</clist>
</plist>
</lists>
</tree>




what i have now...
<tree>
<lists>
<parent_d>AAAA</parent_d>
<child_d>AAAA1</child_d>
<arName>1</arName>
<arName>2</arName>
<arName>3</arName>
<child_d>AAAA2</child_d>
<arName>2</arName>
<arName>4</arName>
<arName>5</arName>
<child_d>AAA3</child_d>
<arName>4P</arName>
</lists>
<lists>
<parent_d>BBBB</parent_d>
<child_d>BB1</child_d>
<arName>1</arName>
<arName>2</arName>
<arName>3</arName>
<child_d>BBS2</child_d>
<arName>2</arName>
<arName>5</arName>
<child_d>BBZ3</child_d>
<arName>8</arName>
</lists>
</tree>
 
 
what i want to out put after modify using xsl or xslt...
 
<tree>
<lists>
<parent_d>AAAA</parent_d>
<plist>
<child_d>AAAA1</child_d>
<clist>
<arName>1</arName>
</clist>
<clist>
<arName>2</arName>
</clist>
<clist>
<arName>3</arName>
</clist>
</plist>
<plist>
<child_d>AAAA2</child_d>
<clist>
<arName>2</arName>
</clist>
<clist>
<arName>4</arName>
</clist>
<clist>
<arName>5</arName>
</clist>
</plist>
<plist>
<child_d>AAA3</child_d>
<clist>
<arName>4P</arName>
</clist>
</plist>
</lists>
 
<lists>
<parent_d>BBBB</parent_d>
<plist>
<child_d>BB1</child_d>
<clist>
<arName>1</arName>
</clist>
<clist>
<arName>2</arName>
</clist>
<clist>
<arName>3</arName>
</clist>
</plist>
<plist>
<child_d>BBS2</child_d>
<clist>
<arName>2</arName>
</clist>
<clist>
<arName>4</arName>
</clist>
<clist>
<arName>5</arName>
</clist>
</plist>
<plist>
<child_d>BBZ3</child_d>
<clist>
<arName>8</arName>
</clist>
</plist>
</lists>
</tree>
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 13 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 13 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros