Re: [xsl] Perpetuating xsl instructions

Subject: Re: [xsl] Perpetuating xsl instructions
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Tue, 13 May 2003 17:42:44 +0100
Hi Alan,

> The solution requires dynamically writing a web page by aggregating
> n number of XML docs without writing any code (a one off solution).
> Essentially a chain reaction is initiated where the first XSL
> document runs up a 'tree' of XML documents, merging XML into itself.
> The terminating transformation results in a pure XML document (minus
> the XSL) with all the content needed to build the web page.
> If you can think of another solution, we'd love to hear it.

I'll take a wild stab in the dark and guess that your documents look

  <bar />
  <include href="doc1.xml" />

and you want the content of doc1.xml to replace the <include> element
with, naturally, doc1.xml containing its own <include> elements that
need to be replaced and so on.

If that's the case, then you need a stylesheet based on an identity
transformation (one that just copies the content of the document,

<xsl:template match="node()|@*">
    <xsl:apply-templates select="@*|node()" />

where <include> elements are treated specially, by applying templates
to the referenced document (retrieved using the document() function):

<xsl:template match="include">
  <xsl:apply-templates select="document(@href, .)/*" />

Of course it might be that I'm way off the mark. If you want something
more helpful, I really recommend that you put together a short example
that shows what your documents look like and what the final result you
want looks like. Without that information, it is really hard for us to
give you any advice.



Jeni Tennison

 XSL-List info and archive:

Current Thread