mmidy 99/12/14 15:01:14
Modified: src/org/apache/xalan/xpath FuncSystemProperty.java
src/org/apache/xalan/xpath/xml FormatterToHTML.java
Added: src/org/apache/xalan/xpath/xml XSLTInfo.properties
Log:
Use a property file for system-property information
Revision Changes Path
1.4 +32 -14
xml-xalan/src/org/apache/xalan/xpath/FuncSystemProperty.java
Index: FuncSystemProperty.java
===================================================================
RCS file:
/home/cvs/xml-xalan/src/org/apache/xalan/xpath/FuncSystemProperty.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- FuncSystemProperty.java 1999/11/28 10:26:16 1.3
+++ FuncSystemProperty.java 1999/12/14 23:01:14 1.4
@@ -58,6 +58,10 @@
import org.w3c.dom.*;
import java.util.Vector;
+import java.util.Properties;
+import java.io.BufferedInputStream;
+import java.io.InputStream;
+import java.lang.ClassLoader;
import org.apache.xalan.xpath.xml.PrefixResolver;
import org.apache.xalan.xpath.res.XPATHErrorResources;
@@ -66,6 +70,8 @@
*/
public class FuncSystemProperty extends Function
{
+ Properties xsltInfo = new Properties ();
+ static String XSLT_PROPERTIES =
"/org/apache/xalan/xpath/xml/XSLTInfo.properties";
/**
* Execute the function. The function must return
* a valid object.
@@ -81,6 +87,7 @@
String fullName = ((XObject)args.elementAt(0)).str();
int indexOfNSSep = fullName.indexOf(':');
String result;
+ loadPropertyFile(XSLT_PROPERTIES, xsltInfo);
if(indexOfNSSep > 0)
{
String prefix = (indexOfNSSep >= 0) ? fullName.substring(0,
indexOfNSSep) : "";
@@ -92,21 +99,10 @@
if(namespace.startsWith("http://www.w3.org/XSL/Transform") ||
namespace.equals("http://www.w3.org/1999/XSL/Transform"))
{
- if(propName.equals("version"))
+ result = xsltInfo.getProperty(propName);
+ if (null == result)
{
- result = "1.0";
- }
- else if(propName.equals("vendor"))
- {
- result = "xml.apache.org";
- }
- else if(propName.equals("vendor-url"))
- {
- result = "http://xml.apache.org/xslt";
- }
- else
- {
- path.warn(XPATHErrorResources.WARNING0002, new Object[]
{fullName}); //"XSL Property not supported: "+fullName);
+ path.warn(XPATHErrorResources.WARNING0002, new
Object[] {fullName}); //"XSL Property not supported: "+fullName);
result = "";
}
}
@@ -147,5 +143,27 @@
}
}
return new XString(result);
+ }
+
+/*
+ * Retrieve a propery bundle from a specified file
+ * @param file The string name of the property file. The file is loaded
from the workplace base directory
+ * @param target The target property bag the file will be placed into.
+ */
+ public void loadPropertyFile (String file, Properties target)
+ {
+ InputStream is;
+ try
+ {
+ is= getClass().getResourceAsStream(file);
+ // get a buffered
version
+ BufferedInputStream bis = new BufferedInputStream (is);
+ target.load (bis); // and load up
the property bag from this
+ bis.close (); // close out
after reading
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
}
}
1.14 +5 -19
xml-xalan/src/org/apache/xalan/xpath/xml/FormatterToHTML.java
Index: FormatterToHTML.java
===================================================================
RCS file:
/home/cvs/xml-xalan/src/org/apache/xalan/xpath/xml/FormatterToHTML.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- FormatterToHTML.java 1999/12/14 15:11:47 1.13
+++ FormatterToHTML.java 1999/12/14 23:01:14 1.14
@@ -435,23 +435,9 @@
accum("<!DOCTYPE HTML");
if(null != m_doctypePublic)
{
- if(null != m_doctypePublic)
- {
- accum(" PUBLIC \"");
- accum(m_doctypePublic);
- accum("\"");
- }
- if(null != m_doctypeSystem)
- {
- if(null == m_doctypePublic)
- accum(" SYSTEM \"");
- else
- accum(" \"");
- accum(m_doctypeSystem);
- accum("\"");
- }
- accum(">");
- accum(m_lineSep);
+ accum(" PUBLIC \"");
+ accum(m_doctypePublic);
+ accum("\"");
}
if(null != m_doctypeSystem)
{
@@ -463,8 +449,8 @@
accum("\"");
}
accum(">");
- outputLineSep();
- }
+ accum(m_lineSep);
+ }
}
m_needToOutputDocTypeDecl = false;
}
1.1
xml-xalan/src/org/apache/xalan/xpath/xml/XSLTInfo.properties
Index: XSLTInfo.properties
===================================================================
#
# XSLT Properties
#
version=1.0
vendor=xml.apache.org
vendor-url=http://xml.apache.org/xslt