Subject: RE: Tree Fragment - How do I test it AND output it?
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Tue, 18 Dec 2001 09:35:20 -0000
|
> How do I both test the "return" value from a template, and
> output some of the result nodes?
>
You put the result in a variable (a "result tree fragment" or temporary
tree):
<xsl:variable name="tree">
<xsl:call-template name="make-tree"/>
</xsl:variable>
You can copy this tree to the result tree using copy-of:
<xsl:copy-of select="$tree"/>
You can access the string value of the tree tree directly (that is, the
concatenation of its text nodes):
<xsl:if test="string($tree)='tangerine'"/>
To access the detailed structure of the tree you need the xx:node-set
extension:
<xsl:variable name="root" select="xx:node-set($tree)"/>
You can then use path expressions or xsl:apply-templates to manipulate the
tree in the same way as a source tree:
<xsl:apply-templates select="$root" mode="temp-tree"/>
Mike Kay
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|