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

RE: push-pull

Subject: RE: push-pull
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 19 Mar 2008 09:21:30 -0000
RE:  push-pull
> Why error "The context item is not set", when the context is 
> not set, on something like this:
> <xsl:value-of select="if (.) then 'a' else 'b'"/> How else 
> does one check if the context item is set?
> 

There's no way to test whether the context item is currently set. I think
the only case where you can't tell statically is probably within a named
template. I think it's probably good practice for a named template to
declare a parameter:

<xsl:param name="target" select="."/>

and within the body of the template to refer to $target rather than ".". The
caller must then either pass over a context item, or set the value of
$target explicitly.

Michael Kay
http://www.saxonica.com/

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.