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

RE: Best default value for a result tree fragment?

Subject: RE: Best default value for a result tree fragment?
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 28 Sep 2005 13:07:04 +0100
xsl param default value
> What do people think is the "best" way of specifying the 
> default value for
> the parameters:
> 
> <xsl:param name="contentRTF"></xsl:param>
> 
> which gives a RTF containing nothing

No: if there is no content and no select attribute, the value is a
zero-length string. You can get an RTF consisting of a document node with no
children by writing, for example

<xsl:param name="contentRTF"><xsl:fallback/></xsl:param>

> 
> <xsl:param name="contentRTF" select="" />
> 
> which gives an empty nodeset (or something),

No, that's an error: the select attribute must be an XPath expression, and
this isn't

or even
> 
> <xsl:param name="contentRTF select="''" />
> 
> which gives an empty string.
> 
> I appreciate that, for all practical purposes, I should get the same
> output from all of them, but was wondering which might be seen as the
> canonical way of doing it, given that any *passed* value will 
> always be a
> result tree fragment. Must have my strong-typing head on today :-)
> 

I agree that logically, a document node with no children makes the most
sense. In 2.0, the cleanest way of constructing this is

<xsl:param name="x" as="document-node()">
  <xsl:document/>
</xsl:param>

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.