[Home] [By Thread] [By Date] [Recent Entries]
Wendell and Ken,
Thanks for the added info about consequences of the different idioms and likely mistakes. Mark -----Original Message----- From: Wendell Piez Sent: Monday, October 03, 2011 2:30 PM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: Providing a value for the 'select' attribute Mark, On 10/3/2011 5:19 PM, Mark wrote: Hi, I have been using the following idiom when providing a value for bselectb in statements like <xsl:param>, <xsl:variable>, etc., when the value provided is not an xsl object. Is this correct or is some other form preferred?
In essence, absent a specification otherwise (using xsl:param/@as), you are declaring the paramater to be a temporary tree (or, in XSLT 1.0, a result tree fragment), in this case a root with a single text node child. If your intention is that $file-type be a string, you should say: <xsl:param name="file-type" select="'.htm'"/> or <xsl:param name="file-type" as="xs:string">.htm</xsl:param> (which is essentially the same as what you have with as="xs:string" added, since the effect of the xsl:text is cosmetic). Advantages to binding to a string instead of a temporary tree include that it will be faster when it is processed as a string (since it won't have to be cast to one); and that it will probably behave more as you expect it to when under stress ... for example, a string value of "" is cast to Boolean false(), while a temporary tree with a single text node will cast to Boolean true(), even if that text node has no string value. 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 ======================================================================
|

Cart



