We export “records” to an xml file; one of our customers has complained that the file is too big for their other system to process. Therefore I need to split up the file,
There's no general-purpose solution to this, because there's so many different possible ways that your source XML could be structured.
It's reasonably straightforward to build an XSLT transform that will output a slice of an XML document. For instance, given this XML:
you can output a copy of the file containing only data elements within a certain range with this XSLT:
(Note, by the way, that because this is based on the identity transform, it works even if header isn't the top-level element.)
You still need to count the data elements in the source XML, and run the transform repeatedly with the values of $startPosition and $endPosition that are appropriate for the situation.