[XML-SIG] merging xml sources (again)

Nicolas Chauvat Nicolas.Chauvat@logilab.fr
Fri, 31 May 2002 10:24:49 +0200 (CEST)


> Here's a variant of a recently-asked question (with thanks again to
> those who responded):
> 
> 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.

If you are into this, here is a feature I've been wanting to implement
(and never got time to).

--- Document (doc.xml)

<?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>Nicolas</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>Nicolas</firstname>
</root>

don't you think ?

-- 
Nicolas Chauvat

http://www.logilab.com - "Mais oł est donc Ornicar ?" - LOGILAB, Paris (France)