public Sequence eval(Sequence<? extends Item> contextSeq, ValueSequence argv, DynamicContext dynEnv) throws XQueryException {
assert (argv != null);
final int arglen = argv.size();
assert (arglen == 1 || arglen == 2);
Item firstItem = argv.getItem(0);
// If the value of $arg is the empty sequence, returns the zero-length string.
if(firstItem.isEmpty()) {
return XString.valueOf("");
}
String arg = firstItem.stringValue();
// If the $normalizationForm is absent, as in the first format above,
// it shall be assumed to be "NFC"
String nform = "NFC";
if(arglen == 2) {
Item secondItem = argv.getItem(1);
nform = secondItem.stringValue();
}
final String normed;
if("NFC".equalsIgnoreCase(nform)) {
normed = Normalizer.normalize(arg, Normalizer.NFC);
} else if("NFD".equalsIgnoreCase(nform)) {