1 package net.sf.saxon.functions; 2 import net.sf.saxon.expr.XPathContext; 3 import net.sf.saxon.om.Item; 4 import net.sf.saxon.om.Name; 5 import net.sf.saxon.om.QNameException; 6 import net.sf.saxon.trans.XPathException; 7 import net.sf.saxon.value.AtomicValue; 8 import net.sf.saxon.value.QNameValue; 9 10 11 14 15 public class QNameFn extends SystemFunction { 16 17 20 21 public Item evaluateItem(XPathContext context) throws XPathException { 22 AtomicValue arg0 = (AtomicValue)argument[0].evaluateItem(context); 23 24 String uri; 25 if (arg0 == null) { 26 uri = null; 27 } else { 28 uri = arg0.getStringValue(); 29 } 30 31 try { 32 String lex = argument[1].evaluateItem(context).getStringValue(); 33 String [] parts = Name.getQNameParts(lex); 34 return new QNameValue(parts[0], uri, parts[1]); 35 } catch (QNameException e) { 36 dynamicError(e.getMessage(), "FOCA0002", context); 37 return null; 38 } 39 } 40 41 } 42 43 44 45 46 47 | Popular Tags |