[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Perpetuating xsl instructions

Subject: Re: Perpetuating xsl instructions
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Tue, 13 May 2003 17:42:44 +0100
Re:  Perpetuating xsl instructions
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
like:

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

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,
recursively):

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

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, .)/*" />
</xsl:template>

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.

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.