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

Last change on this file since 3940 was 3602, checked in by kjdon, 22 years ago

added new method for getting a numbered item from a list

  • Property svn:keywords set to Author Date Id Revision
File size: 753 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.out.println("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 return items[items.length - number];
35 }
36}
Note: See TracBrowser for help on using the repository browser.