Project

Profile

Help

Skip unnecessary tags in source XML

Added by Anonymous about 16 years ago

Legacy ID: #5400084 Legacy Poster: Zsolt Paroczi (zsolt_paroczi)

I would like to transform an xml file to another by an XSL. The source xml can be 1MB to 1GB, I know that this is fairly large, but the source XML contains unnecessary tags for the transformation and this tags holds the bigest part of the data. I suppose there is a way to skip the unnecessary tags during the source tree building. Thanks forward your help, Zsolt


Replies (1)

RE: Skip unnecessary tags in source XML - Added by Anonymous about 16 years ago

Legacy ID: #5400178 Legacy Poster: Michael Kay (mhkay)

There are two facilities that may help you here (both are in Saxon-SA only). The first is document projection: http://www.saxonica.com/documentation/sourcedocs/projection.html This does pretty-well exactly what you describe. It analyses a query to see which parts of the source document are required to evaluate the query, and then while building the source document, leaves out those parts of the source tree that aren't needed. This only works in an automated way for XQuery, not for XSLT, because XSLT is too dynamic to allow this kind of analysis. However, it's possible to use document projection with a manually-created filter, using the technique described on the page cited above. The second facility is streaming. This is even better, because it doesn't build a tree representation of the document at all - it's all processed on the fly. If necessary you can use a streaming transformation to construct a smaller intermediate document as the first phase of your processing, and then you can run a conventional transformation on this smaller document. The various facilities for streaming are described at http://www.saxonica.com/documentation/sourcedocs/serial.html In this case XSLT is currently rather better served than XQuery.

    (1-1/1)

    Please register to reply