I've written the below function in order to "Title Case" names that
comes from an HR system, but also to look out for special words which
must only be set to lower case.

--snip--

function nameCapitalise(name)
{
var splitName = new Array();
splitName = name.split(' ');
name = '';

var exceptions = new Array("van","der","du","de");

for (count = 0; count < splitName.length; count++)
{
exceptionFlag = 0;
splitName[count] = splitName[count].toLowerCase();

for (ecount = 0; ecount < exceptions.length; ecount++)
{
if (splitName[count] == exceptions[ecount])
{
exceptionFlag = 1;
}
}

if (exceptionFlag == 0)
{
splitName[count] = splitName[count].substr(0,1).toUpperCase() +
splitName[count].substr(1);
}
name = name + splitName[count] + " ";
}
name = name.substr(0,name.length - 1);
return name;
}

--snip--

In a browser it works perfectly.

I've implemented it into a driver set library, linked it to a driver
and used it in a policy which does the following action:

--snip--

do-reformat-op-attr("Given
Name",token-xpath("es:nameCapitalise($current-value)"))

--snip--

When evaluating the result of the function, however, the following
error shows in the trace.

--snip--

Message: Code(-9131) Error in
vnd.nds.stream://IDV-TREE/vault/services/Driver+Set/JDBC/Publisher/pub-pet-EventTransform#XmlData:34
: Error evaluating XPATH expression 'token-xpath("es:n
ameCapitalise($current-value)")' :
com.novell.xml.xpath.XPathEvaluationException: TypeError: split is not a
function.

--snip--

As far as I can tell from the 'ECMASCRIPT spec'
(http://wiki.ecmascript.org/doku.php?...bjects&s=split),
the 'split' function is part of the base spec for version 3 and for the
draft of version 4.

Am I doing something else wrong here?


--
preycor
------------------------------------------------------------------------
preycor's Profile: http://forums.novell.com/member.php?userid=7822
View this thread: http://forums.novell.com/showthread.php?t=389071