Re: Wrapper for XSL for offline development

Subject: Re: Wrapper for XSL for offline development
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Tue, 7 Nov 2000 18:53:16 +0000
Alan,

> but how to take the root nodes from several of these document( )
> calls and put them under the root node of my original XML document?

I'd take it in two steps.  The first is the pre-processing, that
parses the PIs and copies your source XML, but with the PIs
substituted for the contents of the relevant documents.  For example:

<xsl:template match="*">
  <xsl:copy>
    <xsl:copy-of select="@*" />
    <xsl:apply-templates />
  </xsl:copy>
</xsl:template>

<xsl:template match="processing-instruction('fub-process')">
  <!-- identify the file from the content of the PI -->
  <xsl:variable name="file"
                select="substring-after(substring-after(., ':'), ':')"
                />
  <!-- copy the content of the file (the document element)
       into the output -->
  <xsl:copy-of select="document(concat($file, '.xml'))/*" />
</xsl:template>

The second step involves applying your production stylesheet to the
result of applying the pre-processing stylesheet.

> And then apply the XSL file that would normally be applied in the
> online environment?

There may be a processor-specific way of chaining stylesheets together
within Xalan, but I'm afraid I'm not familiar enough with it to be
able to tell you.  You could create a batch file that ran the two
transformations one after the other.  Alternatively, if you don't mind
using the node-set extension function, you could effectively chain the
two transformations together with that.

Let us know if you need any more guidance or a description of one of the
options above.

I hope that helps,

Jeni

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



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


Current Thread