[xsl] dynamically extending xslt

Subject: [xsl] dynamically extending xslt
From: "Marco Plum" <m.plum@xxxxxxxxxxxx>
Date: Mon, 10 Oct 2005 14:27:37 +0200
Hi,

we are developing a new correspondence-system based on XML.
Our DTD is very similar to XHTML with some additional structures like
selections, iterations and variableplaceholders.
The composition of these documents will be realized as a
XSLT-stylesheet. I wrote a stylesheet wich transforms a document into a
XSLT-stylesheet.
This (produced) stylesheet will be used on a XML-file containing the
variablevalues and the data needed to resolve the logical
structures (e.g. selections etc.).

My problem is, that the user will be allowed to add elements to a
document, wich can contain anything allowed by the dtd.

An example:

<document>
  <body>
    <topic>
      <selection variable="aVariable">
        <item value="1">
          <textblock>some text</textblock>
        </item>
      </selection>
     </topic>
  </body>
</document>

This would be transformed into:

<document>
  <body>
    <topic>
      <xsl:choose>
        <xsl:when test="//variable[@name='aVariable'] = 1">
          <textblock>some text</textblock>
        </xsl:when>
      </xsl:choose>
    </topic>
  </body>
</document>


After this transformation the user is able to add another "topic" to the
document, which could contain another selection. And I need this new
content executed, after it is transformed into xslt.

One possible solution is to produce the stylesheet again, after the user
made his changes. But it has to be possible to "map" between the
stylesheet and the original document. I thought about the possibility of
using <xsl:include> but I didnt come to solution.

So what Im looking for, is a way, to dynamically extend an
XSLT-stylesheet...

Could "template reference" be a way to solve my problem? Any other ideas
are appreaciated!

Best regards,
Marco Plum

P.S. We are using XSLT 1.0 with MSXML on windows. But if possible, the
xsl should also work on XALAN (JAVA and IBM HOST)

Current Thread