This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: conditional inclusions2


Ronald,

>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:choose>
        <xsl:when test="@include='1'">
          <xsl:apply-templates select="document('file1.xml')"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:apply-templates select="document('file2.xml')"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>

    <!-- 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" />
    </xsl:if>
  </xsl:template>

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?

Cheers,

Jeni

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




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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]