Problem:
We have a massive XML document. This document gets passed around a bit before eventually ending up being used in an XSLT2 transform which prepares it for use in a PDF rendering engine. The issue is that the percentage of the XML actually needed by the time we get to the PDF rendering engine is tiny compared to its original size. We still need the full XML for other processes, but in terms of the "flow" towards the rendering engine, we ideally would like to strip the XML down to its bare essentials as soon as possible so that the amount of data being passed around is smaller.
We cannot do the final XSLT2 transformation earlier in the process, as there is a little bit more XML manipulation that happens just prior to this.
What we would like to do therefore is create a new stylesheet which simply "keeps" the structure of the original XML document but only keeps the XML elements we're actually interested in for reporting purposes. We're quite happy to write the necessary XSLT document, but since the final XSLT2 document is a complicated beast, what we're hoping is that someone out there in the stackoverflow community has an easy way of doing the following:
Ideal solution:
A way of extracting a list of all referenced XML elements (i.e. their xPath) from an existing XSLT2 stylesheet. We'd like this to include referenced XML elements not only in selects/value-ofs/etc., but also in fors/conditions/etc.
I realise this may not have a simple answer, but just in case someone out there has either done this before, or can give me a starting point, I'd be very grateful for any assistance.
Thanks in advance!