source: trunk/gsdl3/src/java/org/greenstone/gsdl3/util/XSLTUtil.java@ 4244

Last change on this file since 4244 was 4244, checked in by kjdon, 21 years ago

small change to getNumberedItem

  • Property svn:keywords set to Author Date Id Revision
File size: 827 bytes
Line 
1package org.greenstone.gsdl3.util;
2
3/** a class to contain static methods that are used by the xslt
4 * stylesheets
5 */
6public class XSLTUtil {
7
8 public static String toLower(String orig) {
9 return orig.toLowerCase();
10 }
11
12 public static byte[] toUTF8(String orig) {
13
14 try {
15 byte[] utf8 = orig.getBytes("UTF-8");
16 return utf8;
17 }
18 catch (Exception e){
19 System.err.println("XSLTUtil.toUTF8: unsupported encoding");
20 return orig.getBytes();
21 }
22 }
23
24 public static int getInt(String orig) {
25 return 20;
26 }
27
28 public static String getString(String orig) {
29 return orig;
30 }
31
32 public static String getNumberedItem(String list, int number) {
33 String [] items = list.split(",", -1);
34 if (items.length > number) {
35 return items[number];
36 }
37 return ""; // index out of bounds
38 }
39}
Note: See TracBrowser for help on using the repository browser.