Re: conditional inclusions2

Subject: Re: conditional inclusions2
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Thu, 2 Nov 2000 17:23:29 -0400 (EST)

>Too bad you can't "sub-render" conditional xml entities before you insert 
>them in the actuall output tree.
>Or can you?

I'm not sure that I've interpreted 'sub-render' properly, but you can
certainly insert the result of transforming an imported document in a
variable, and then do a few things to check the content of that variable
(even more if you're happy to use the node-set extension).  For example:

  <xsl:template match="if">
    <xsl:variable name="imported-tree">
        <xsl:when test="@include='1'">
          <xsl:apply-templates select="document('file1.xml')"/>
          <xsl:apply-templates select="document('file2.xml')"/>

    <!-- test the content of the $imported-tree variable 
         and copy it into the output tree if it passes   -->
    <xsl:if test="...">
      <xsl:copy-of select="$imported-tree" />

I don't know what kind of things you want to do to the result of
transforming the imported document, but using the node-set extension
function you could even process *that* in order to get a refined version,
as many times as you want.

Is that kind of what you're after?



Jeni Tennison

 XSL-List info and archive:

Current Thread