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]
Other format: [Raw text]

RE: Tree Fragment - How do I test it AND output it?


> 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


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