|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] 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? I have written a recursive template that is intended to
"draw" some xml as svg. The template must do some calculations about the
depth of the input xml, and about its "width" (i.e. how many children a
particular node has. My problem is that I do not know how to both get a
"return" value from a template that I can test (i.e. treating the named
template like a kind of function), and also get output from it:
Roughly, I want to do this:
<xsl:template name="namedTemplate">
<svg> ... here is some stuff
I actually want to output, because I'm drawing svg.
</svg>
<!--
but I need to compute a value via a recursive call
to this same template:
-->
<xsl:variable name="resultFromTemplate">
<xsl:call-template name="namedTemplate">
</xsl:variable>
<!-- and use the "returned" value: -->
<xsl:if test="$resultFromTemplate != 0"> ...</xsl:if>
<!--
Here I'll "return" a value computed in this
named template, to control processing in the calling
template (i.e. the earlier instance of this same one):
-->
<xsl:value-of select="$somethingCalculatedHere"/>
</xsl:template>
Is there a way to do this? I suppose, to get at the results, I shall have
to convert to a nodelist. But I don't really see how to both use the tree
as a return value, and also to output it.
Does this make sense?
- Dave Penton -
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








