comment on 'mode' and also Re: Processing modes
>>> Lars Marius Garshol <larsga@xxxxxxxxxx> 04/15 8:19 am >>> > My understanding of processing modes is that > <xsl:apply-templates modes="by-number"/> > should only apply template rules that have the by-number mode and > ignore all template rules that have no mode. That should be 'mode', not 'modes'. The match sequence will be a template that HAS the required 'mode' and, if that fails a template with NO mode. *HOWEVER* 'mode's are NOT sticky, so given this: ----- <doc> <foo> <bar>wibble</bar> </foo> </doc> ----- and ----- <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl" result-ns=""> <xsl:template match="doc"> <xsl:apply-templates mode="test" /> </xsl:template> <xsl:template match="bar" mode="test"> Found bar in test, value: <xsl:value-of select="text()" /> </xsl:template> <xsl:template match="bar"> Found bar **NO MODE**, value: <xsl:value-of select="text()" /> </xsl:template> </xsl:stylesheet> ----- The result is: ----- Found bar **NO MODE**, value: Wibble ----- Why ? Because, as I said, modes aren't sticky and have to be *EXPLICITLY* passed on. However, <foo> was matched by the IMPLICIT rule, which didn't explicitly pass on the mode. This, compined with the fact that there is no way of find the *XSL* parameters to the triggering <xsl:apply-templates ... /> means that 'mode' is *almost* useless. (It *DOES* have uses, but trying to use it effectively means implementing lots of "do-nothing" templates which just call apply-templates with the same mode as they had!) There is no reason why 'mode' should not be sticky, since it could easily be cancelled ('mode=""') and, if no mode is matched it defaults to the empty mode. Alistair 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