This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: conditional inclusions2
- To: Ronald <ronald at salience dot nl>
- Subject: Re: conditional inclusions2
- From: Jeni Tennison <mail at jenitennison dot com>
- Date: Thu, 2 Nov 2000 17:23:29 -0400 (EST)
- Cc: xsl-list at mulberrytech dot com
- References: <8BD71A154EA6D211873E00105A125CDF481AD8@TSSMX1>
- Reply-To: xsl-list at mulberrytech dot com
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