Is it possible to insert elements into the stream being parsed by an xml.sax parser while it's parsing? I would like to be able to merge bits of xml into a document while it's being parsed. Merging is triggered by an element I'm calling 'include-xml' that indicates the location of an external xml document. Presently, I'm using what's essentially an identity transformation with xslt to produce a document
derived from multiple sources (all same namespace; no additional transformations necessary), and then parsing that document.
<?xml version="1.0"?>
<root>
<myns:transform-and-include src="otherdoc.xml" xsl="transfo.xslt"/>
</root>
--- Other document (otherdoc.xml)
<?xml version="1.0"?>
<name>mai</name>
--- transform (transfo.xslt)
...
<xsl:template match="name">
<firstname><xsl:value-of select="."/></firstname>
</xsl:template>
...
--- Result
Would be cool if reading in doc.xml would be equivalent to reading in
<?xml version="1.0"?>
<root>
<firstname>mai</firstname>
</root>