<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#ffffff">
<o:p></o:p>
<blockquote cite="mid:020f01cbda8f$2009e910$601dbb30$@calldei.com"
type="cite">
<div class="WordSection1">
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I've used this test<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">declare function local:getname( $e ) as
xs:string<o:p></o:p></p>
<p class="MsoNormal">{<o:p></o:p></p>
<p class="MsoNormal"> let $name := $e/name/string()<o:p></o:p></p>
<p class="MsoNormal"> return <o:p></o:p></p>
<p class="MsoNormal" style="text-indent: 0.5in;">if( $name ne ''
) then $name else "<untitled>"<o:p></o:p></p>
<p class="MsoNormal">}<o:p></o:p></p>
<br>
</div>
</blockquote>
<br>
If you used string($e/name) instead of $e/name/string(), then the
result would be "" (zero-length string) both when name doesn't exist
and when name has the value "". <br>
<br>
You can then either do<br>
<br>
if ($name) then $name else "<untitled>"<br>
<br>
or the more idiomatic<br>
<br>
($name[.], "<untitled>")[1]<br>
<br>
Michael Kay<br>
Saxonica<br>
</body>
</html>