/** * See above */ public static String padding(double length) { return padding(length, " "); }
/** * See above */ public static String align(String targetStr, String paddingStr) { return align(targetStr, paddingStr, "left"); }
/** * See above. */ public static String dayAbbreviation() { String format = "EEE"; return getNameOrAbbrev(format); }
/** * The date:day-in-year function returns the day of a date in a year * as a number. If no argument is given, then the current local * date/time, as returned by date:date-time is used the default argument. * The date/time string specified as the argument is a right-truncated * string in the format defined as the lexical representation of xs:dateTime * in one of the formats defined in * <a href="http://www.w3.org/TR/xmlschema-2/">[XML Schema Part 2: Datatypes]</a>. * The permitted formats are as follows: * xs:dateTime (CCYY-MM-DDThh:mm:ss) * xs:date (CCYY-MM-DD) * If the date/time string is not in one of these formats, then NaN is returned. */ public static double dayInYear(String datetimeIn) throws ParseException { String[] edz = getEraDatetimeZone(datetimeIn); String datetime = edz[1]; if (datetime == null) return Double.NaN; String[] formats = {dt, d}; return getNumber(datetime, formats, Calendar.DAY_OF_YEAR); }
/** * See above. */ public static String date() { String datetime = dateTime(); String date = datetime.substring(0, datetime.indexOf("T")); String zone = datetime.substring(getZoneStart(datetime)); return (date + zone); }
/** * See above */ public static NodeList tokenize(String toTokenize) { return tokenize(toTokenize, " \t\n\r"); } /**
/** * See above */ public static NodeList split(String str) { return split(str, " "); }
/** * Returns the intersection of two node-sets. * * @param nl1 NodeList for first node-set * @param nl2 NodeList for second node-set * @return a NodeList containing the nodes in nl1 that are also in nl2 * * Note: The usage of this extension function in the xalan namespace * is deprecated. Please use the same function in the EXSLT sets extension * (http://exslt.org/sets). */ public static NodeList intersection(NodeList nl1, NodeList nl2) { return ExsltSets.intersection(nl1, nl2); }
/** * Returns the difference between two node-sets. * * @param nl1 NodeList for first node-set * @param nl2 NodeList for second node-set * @return a NodeList containing the nodes in nl1 that are not in nl2 * * Note: The usage of this extension function in the xalan namespace * is deprecated. Please use the same function in the EXSLT sets extension * (http://exslt.org/sets). */ public static NodeList difference(NodeList nl1, NodeList nl2) { return ExsltSets.difference(nl1, nl2); }
/** * Returns node-set containing distinct string values. * * @param nl NodeList for node-set * @return a NodeList with nodes from nl containing distinct string values. * In other words, if more than one node in nl contains the same string value, * only include the first such node found. * * Note: The usage of this extension function in the xalan namespace * is deprecated. Please use the same function in the EXSLT sets extension * (http://exslt.org/sets). */ public static NodeList distinct(NodeList nl) { return ExsltSets.distinct(nl); }
/** * Returns a NodeSet containing one text node for each token in the first argument. * Delimiters are whitespace. That is, the delimiters that are used are tab (	), * linefeed (
), return (
), and space ( ). * Tokens are determined by a call to <code>StringTokenizer</code>. * If the first argument is an empty string or contains only delimiters, the result * will be an empty NodeSet. * * Contributed to XalanJ1 by <a href="mailto:benoit.cerrina@writeme.com">Benoit Cerrina</a>. * * @param toTokenize The string to be split into text tokens. * @return a NodeSet as described above. */ public static NodeList tokenize(String toTokenize) { return tokenize(toTokenize, " \t\n\r"); }
/** * Returns the result of evaluating the argument as a string containing * an XPath expression. Used where the XPath expression is not known until * run-time. The expression is evaluated as if the run-time value of the * argument appeared in place of the evaluate function call at compile time. * * @param myContext an <code>ExpressionContext</code> passed in by the * extension mechanism. This must be an XPathContext. * @param xpathExpr The XPath expression to be evaluated. * @return the XObject resulting from evaluating the XPath * * @throws SAXNotSupportedException * * Note: The usage of this extension function in the xalan namespace * is deprecated. Please use the same function in the EXSLT dynamic extension * (http://exslt.org/dynamic). */ public static XObject evaluate(ExpressionContext myContext, String xpathExpr) throws SAXNotSupportedException { return ExsltDynamic.evaluate(myContext, xpathExpr); }
/** * Finds the implementation Class object in the specified order. The * specified order is the following: * <ol> * <li>query the system property using <code>System.getProperty</code> * <li>read <code>META-INF/services/<i>factoryId</i></code> file * <li>use fallback classname * </ol> * * @return instance of factory, never null * * @param factoryId Name of the factory to find, same as * a property name * @param fallbackClassName Implementation class name, if nothing else * is found. Use null to mean no fallback. * * @exception ObjectFactory.ConfigurationError */ static Object createObject(String factoryId, String fallbackClassName) throws ConfigurationError { return createObject(factoryId, null, fallbackClassName); } // createObject(String,String):Object
/** * The exsl:node-set function converts a result tree fragment (which is what you get * when you use the content of xsl:variable rather than its select attribute to give * a variable value) into a node set. This enables you to process the XML that you create * within a variable, and therefore do multi-step processing. * * You can also use this function to turn a string into a text node, which is helpful * if you want to pass a string to a function that only accepts a node set. * * The Xalan extensions MethodResolver converts 'node-set' to 'nodeSet'. * * @param myProcessor is passed in by the Xalan extension processor * @param rtf The result tree fragment to be converted to a node-set. * * @return node-set with the contents of the result tree fragment. * * Note: Already implemented in the xalan namespace as nodeset. * * @see <a href="http://www.exslt.org/">EXSLT</a> */ public static NodeSet nodeSet(ExpressionContext myProcessor, Object rtf) { return Extensions.nodeset(myProcessor, rtf); }
/** * See above. */ public static String time() { String datetime = dateTime(); String time = datetime.substring(datetime.indexOf("T")+1); // The datetime() function returns the zone on the datetime string. If we // append it, we get the zone substring duplicated. // Fix for JIRA 2013 // String zone = datetime.substring(getZoneStart(datetime)); // return (time + zone); return (time); }
/** * Parse the input string and return the corresponding calendar field * number. */ private static double getNumber(String in, String[] formats, int calField) throws ParseException { Calendar cal = Calendar.getInstance(); cal.setLenient(false); // Try the allowed formats, from longest to shortest. Date date = testFormats(in, formats); if (date == null) return Double.NaN; cal.setTime(date); return cal.get(calField); }
/** * The date:week-in-year function returns the week of the year as a number. If no argument * is given, then the current local date/time, as returned by date:date-time is used as the * default argument. For the purposes of numbering, counting follows ISO 8601: week 1 in a year * is the week containing the first Thursday of the year, with new weeks beginning on a Monday. * The date/time string specified as the argument is a right-truncated string in the format * defined as the lexical representation of xs:dateTime in one of the formats defined in * <a href="http://www.w3.org/TR/xmlschema-2/">[XML Schema Part 2: Datatypes]</a>. The * permitted formats are as follows: * xs:dateTime (CCYY-MM-DDThh:mm:ss) * xs:date (CCYY-MM-DD) * If the date/time string is not in one of these formats, then NaN is returned. */ public static double weekInYear(String datetimeIn) throws ParseException { String[] edz = getEraDatetimeZone(datetimeIn); String datetime = edz[1]; if (datetime == null) return Double.NaN; String[] formats = {dt, d}; return getNumber(datetime, formats, Calendar.WEEK_OF_YEAR); }
/** * See above. */ public static String monthName() { String format = "MMMM"; return getNameOrAbbrev(format); }
/** * See above. */ public static String dayName() { String format = "EEEE"; return getNameOrAbbrev(format); }
/** * See above. */ public static String monthAbbreviation() { String format = "MMM"; return getNameOrAbbrev(format); }