[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: push-pull

Subject: RE: push-pull
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Wed, 19 Mar 2008 12:44:28 -0400
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)?
>

I don't think you can.

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
======================================================================

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.