--- /dev/null
+package mir.misc;
+
+import java.io.IOException;
+
+import com.icl.saxon.PreparedStyleSheet;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import com.icl.saxon.trax.Transformer;
+
+import java.util.Hashtable;
+
+/**
+ * Title:
+ * Description:
+ * Copyright: Copyright (c) 2001
+ * Company:
+ * @author
+ * @version 1.0
+ */
+
+
+public class XslStyleCache {
+
+ private static Hashtable cache;
+ private static XslStyleCache single = new XslStyleCache();
+
+
+ /**
+ * XSLStyleCache constructor comment.
+ */
+ private XslStyleCache() {
+ cache = new Hashtable();
+ }
+
+ /**
+ * singleton constructor
+ */
+ private static synchronized XslStyleCache getInstance() {
+ return single;
+ }
+
+
+ /**
+ * Clear Cache
+ */
+ public static void clear() {
+ cache.clear();
+ }
+
+ /**
+ * This method was created in VisualAge.
+ * @return
+ * @param key java.lang.String
+ */
+ public static PreparedStyleSheet getPreparedStyleSheet( String key )
+ throws SAXException {
+
+ PreparedStyleSheet styleSheet = (PreparedStyleSheet)single.cache.get( key );
+ try {
+ if ( styleSheet == null ) {
+ styleSheet = new PreparedStyleSheet();
+ styleSheet.prepare( InputSourceResolver.resolve( key ) );
+ single.cache.put( key, styleSheet );
+ }
+ } catch ( IOException ex ) {
+ throw new SAXException( "tunneld IOExcpetion:" + ex.getMessage() );
+ }
+
+ return styleSheet;
+ }
+
+ /**
+ * This method was created in VisualAge.
+ * @return
+ * @param key java.lang.String
+ */
+ public static Transformer getTransformer( String key ){
+
+ PreparedStyleSheet styleSheet = (PreparedStyleSheet)single.cache.get( key );
+ try {
+ if ( styleSheet == null ) {
+ styleSheet = new PreparedStyleSheet();
+ styleSheet.prepare( InputSourceResolver.resolve( key ) );
+ single.cache.put( key, styleSheet );
+ }
+ } catch ( IOException ex ) {
+ //throw new SAXException( "tunneld IOExcpetion:" + ex.getMessage() );
+ } catch (SAXException ex) {}
+
+ return styleSheet.newTransformer();
+ }
+
+}
\ No newline at end of file