Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XSLT

Status
Not open for further replies.

gazzo

Programmer
Jun 7, 2001
5
GB
Hi can anybody help please?

An example of the xml I have is


<AAA>
<ab>
<BBB>
<CCC>Test1</CCC>
<CCC>Test2</CCC>
<CCC>Test3</CCC>
</BBB>
</ab>
<ac>
<BBB>
<CCC>Test4</CCC>
</BBB>
</ac>
</AAA>

What I want is

<XXX>
<ab/>
<CCC>Test1</CCC>
</XXX>
<XXX>
<ab/>
<CCC>Test2</CCC>
</XXX>
<XXX>
<ab/>
<CCC>Test3</CCC>
</XXX>
<XXX>
<ac/>
<CCC>Test4</CCC>
</XXX>

I have tried using for-each with ancestor::* etc but I have had no success, any help would be greatly appreciated.

Thanks,
Gazzo
 
Hi I got this one sorted. The way I done it was to got to the <CCC> element and then created a new element with the value from ../../ to navigate back up to the <ab> or <ac> level.

Cheers,
Gazzo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top