|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] 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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








