[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Writing an optional element
At 03:41 PM 7/5/2004, it was written:
Nestor> Is there a better way to do it than: Also, there are times when conditional logic can be handled by template matches: <xsl:template match="span[@display='i']"> <i> <xsl:apply-templates/> </i> </xsl:template> <xsl:template match="span"> <xsl:apply-templates/> </xsl:template> Because the first template has a higher priority than the second, it will fire in preference to the second when the condition in the predicate is true; the second template catches those cases for which the condition isn't true. Not every condition can be handled like this, due to restrictions on what may appear in patterns (e.g. no variable references are allowed). Nevertheless this is very useful, and certainly clean compared to those somewhat bloated choose/when/otherwise combinations. 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
|