Justin,
String operations can also be performed on result tree fragments,
which are implicitly cast to strings in such cases, so string($rtf)
will return the empty string "" if there is "nothing" in the RTF.
(By "nothing" I mean "something signified by the English word
'nothing'", not the literal word or string "nothing". These are the
hazards in talking about nulls. In point of fact string($rtf) will
also be "" if it contains only empty elements, which can complicate things.)
I don't run across NULL much in my work; for me, Boolean false(),
empty sequences or node-sets or strings generally suffice. So the
question I have for the OP is "what do you mean by 'NULL'?" Something
that tests as "null" (it has no stated value) and something that
represents nullity in the output might be two different things, as you imply.
In any case, it's sometimes useful even in XSLT 1.0 to do something like:
<xsl:variable name="result">
<xsl:apply-templates/>
</xsl:variable>
<xsl:if test="normalize-space($result)">...</xsl:if>
though unfortunately (and perhaps counter-intuitively), $result by
itself (that is, not cast explicitly by string() or coerced by
normalize-space()) will be cast to Boolean true() even if there is no
result from the apply-templates, by virtue of the RTF having a root.
Cheers,
Wendell
At 11:50 AM 7/26/2007, you wrote:
>> In XSLT 1.0 you have 4 datatypes: number, boolean, string and nodeset.
>
>actually there is another, and that is the type that will be returned in
>this case (with an xsl:variable with eleemnt content).
>result tree fragment.
>
Well, yes. Forgot about that in 1.0 but how would the OP test for a result
tree fragment
for the purposes of signifying "nil" or "null" without incurring a runtime
error, given that the operations
permitted on a result tree fragment are a subset of those permitted on a
node-set?
Justin Johansson
*** A horse with no name is called Lambda ***
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
======================================================================
Wendell Piez
mailto:wapiez(_at_)mulberrytech(_dot_)com
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
======================================================================
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--