View Single Post
  #2 (permalink)  
Old October 30th, 2011, 04:36 PM
mhkay's Avatar
mhkay mhkay is offline
Wrox Author
Points: 17,731, Level: 57
Points: 17,731, Level: 57 Points: 17,731, Level: 57 Points: 17,731, Level: 57
Activity: 63%
Activity: 63% Activity: 63% Activity: 63%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,833
Thanks: 0
Thanked 266 Times in 261 Posts
Default

You haven't actually explained the format of the output you want back, so I can't give you detailed code. But I would tackle the problem by writing a stylesheet that takes the "RequiredElements" document as input, and generates an XSLT stylesheet as output; and then run this generated stylesheet against your original XML document. This kind of approach is very often the best way of dealing with problems where an XML document acts as a specification of required processing.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference