View Single Post
  #1 (permalink)  
Old October 30th, 2011, 05:44 AM
iidev iidev is offline
Registered User
Points: 5, Level: 1
Points: 5, Level: 1 Points: 5, Level: 1 Points: 5, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Getting xml info from another xml stracture via xslt

I'm using XSLT 1.0 and I'm tring to make the follwing thing :

I've got a 1.xml file :

<root>
<elem1>value1</elem1>
<elem2>
<elem3>
<param1>value2</param1>
<param2>value3</param2>
</elem3>
</elem2>
<elem4>
<param3>value4</param3>
</elem4>
</root>

Now a client passes me another xml file that tells me what elements he wants me to give him back (could change between clients), i.e. :

<root>
<RequiredElements>
<elementName>elem1</elementName>
<elementName>elem2/elem3/param1</elementName>
</RequiredElements>
</root>

Which means that in this case, I should make another xml file, with this stracture:

<root>
<elem1>value1</elem1>
<elem2>
<elem3>
<param1>value2</param1>
</elem3>
</elem2>
</root>

I've tried to come up with something in xslt (no programing languages other than that) to get the stracture that I need, but couldn't make it.

Any ideas or pointers of what should I do?

Thanks for the help.