mkwan 2002/11/07 09:10:12 Modified: java/src/org/apache/xalan/lib ExsltDatetime.java Log: For bugzilla 14324. Fix a few problems in datetime extension functions. Revision Changes Path 1.5 +8 -11 xml-xalan/java/src/org/apache/xalan/lib/ExsltDatetime.java Index: ExsltDatetime.java =================================================================== RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/lib/ExsltDatetime.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- ExsltDatetime.java 4 Nov 2002 19:50:13 -0000 1.4 +++ ExsltDatetime.java 7 Nov 2002 17:10:12 -0000 1.5 @@ -90,9 +90,9 @@ static final String d = "yyyy-MM-dd"; static final String gym = "yyyy-MM"; static final String gy = "yyyy"; - static final String gmd = "MM-dd"; - static final String gm = "MM"; - static final String gd = "dd"; + static final String gmd = "--MM-dd"; + static final String gm = "--MM--"; + static final String gd = "---dd"; static final String t = "HH:mm:ss"; /** @@ -306,7 +306,9 @@ * The permitted formats are as follows: * xs:dateTime (CCYY-MM-DDThh:mm:ss) * xs:date (CCYY-MM-DD) - * xs:gYearMonth (CCYY-MM) + * xs:gYearMonth (CCYY-MM) + * xs:gMonth (--MM--) + * xs:gMonthDay (--MM-DD) * If the date/time string is not in one of these formats, then NaN is returned. */ public static XNumber monthInYear(String datetimeIn) @@ -317,7 +319,7 @@ if (datetime == null) return new XNumber(Double.NaN); - String[] formats = {dt, d, gym}; + String[] formats = {dt, d, gym, gm, gmd}; return new XNumber(getNumber(datetime, formats, Calendar.MONTH)); } @@ -821,7 +823,7 @@ String leader = ""; String datetime = in; String zone = ""; - if (in.charAt(0)=='-') + if (in.charAt(0)=='-' && !in.startsWith("--")) { leader = "-"; // '+' is implicit , not allowed datetime = in.substring(1); @@ -931,11 +933,6 @@ } catch (ParseException pe) { - // If ParseException occurred during input string, input is invalid. - // If the ParseException occurred at the end of the input string, - // another format may work. - if (pe.getErrorOffset() < in.length()) - return ""; } } return "";
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]