|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Infinite Loop when param empty
Hi Karl,
At 01:00 PM 7/22/2004, you wrote: I have a param which is populated with an XML source. It is normal behavior, since when your parameter is set to the root, selecting it and applying templates applies the template matching the root ... etc. ad infinitum. But it's easy enough to set the parameter's default to something else. A node set containing no nodes will do nicely ... you could select="/parent::*" (or select="/.." if you prefer), which selects the parent of the root -- which doesn't exist. Accordingly in such cases templates will be applied to nothing, thereby avoiding the problem of the template selecting its own current node to apply itself to (thus selecting its own current node). A more robust solution could actually trap the troublesome case by testing whether the parameter identifies the root: <xsl:when test="generate-id(/) = generate-id($ENTRY_TEMPLATE)"> <xsl:message>Sorry, can't process the root as entry template</xsl:message> </xsl:when> <xsl:otherwise> <xsl:apply-templates select="$ENTRY_TEMPLATE"/> </xsl:otherwise> Cheers, Wendell
|
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








