1 package com.icl.saxon.exslt; 2 import com.icl.saxon.expr.*; 3 4 8 9 10 11 public abstract class Common { 12 13 16 17 public static NodeSetValue nodeSet(Value frag) throws XPathException { 18 if (frag instanceof SingletonNodeSet) { 19 ((SingletonNodeSet)frag).allowGeneralUse(); 20 } 21 if (frag instanceof NodeSetValue) { 22 return (NodeSetValue)frag; 23 } else { 24 throw new XPathException("exslt:node-set(): argument must be a node-set or tree"); 25 } 26 } 27 28 32 33 public static String objectType(Value value) { 34 if (value instanceof FragmentValue || value instanceof TextFragmentValue) { 35 return "RTF"; 36 } else if (value instanceof NodeSetValue) { 37 return "node-set"; 38 } else if (value instanceof StringValue) { 39 return "string"; 40 } else if (value instanceof NumericValue) { 41 return "number"; 42 } else if (value instanceof BooleanValue) { 43 return "boolean"; 44 } else { 45 return "external"; 46 } 47 } 48 49 50 } 51 52 53 54 55 56 | Popular Tags |