[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: push-pull
Hi,
At 05:16 AM 3/19/2008, Mike wrote: > > What is the best way for an xslt2 template declared like > this, for example: > <xsl:template name="pull" match="*" mode="push">... > to know or recognize when it is pulled or pushed. > (called by name or invoked by match and mode)? > You could, however, fake it: <xsl:template name="pull" match="*" mode="push"> <xsl:param name="pulled" select="false()"/> <xsl:if test="$pulled">...</xsl:if> ... and then pass in a value of true() whenever pulling. I've never been convinced it's a good idea to have such templates: it's hard to make sure that the entry conditions are the same whether it is invoked by apply or by call. In particular, when you are writing a match template it should be possible to assume that the context item matches the pattern, and allowing entry by name makes this assumption invalid. I agree that it is probably not such a great idea. I have had occasion to do it, but it's also been suggested to me that in such a case, an extra step of indirection to avoid it would make the traversal much clearer (as Mike also suggests) and maintenance easier. So I might have changed my mind. And in this case, the very fact that you need to test which way the template was entered suggests it's not such a great idea. Cheers, Wendell ====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
|
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
|