sboag 00/10/30 10:50:48
Modified: java/src/org/apache/xalan/templates AVT.java AVTPart.java
AVTPartSimple.java AVTPartXPath.java Constants.java
DecimalFormatProperties.java ElemApplyImport.java
ElemApplyTemplates.java ElemAttribute.java
ElemAttributeSet.java ElemCallTemplate.java
ElemChoose.java ElemComment.java ElemCopy.java
ElemCopyOf.java ElemElement.java ElemEmpty.java
ElemExtensionCall.java ElemExtensionDecl.java
ElemExtensionScript.java ElemFallback.java
ElemForEach.java ElemIf.java ElemLiteralResult.java
ElemMessage.java ElemNumber.java ElemOtherwise.java
ElemPI.java ElemParam.java ElemSort.java
ElemTemplate.java ElemTemplateElement.java
ElemText.java ElemTextLiteral.java ElemUnknown.java
ElemUse.java ElemValueOf.java ElemVariable.java
ElemWhen.java ElemWithParam.java FuncDocument.java
FuncFormatNumb.java FuncKey.java
KeyDeclaration.java NamespaceAlias.java
OutputFormatExtended.java Stylesheet.java
StylesheetComposed.java StylesheetRoot.java
TemplateList.java
TemplateSubPatternAssociation.java
WhiteSpaceInfo.java WhitespaceList.java
XMLNSDecl.java
Log:
In addition to JIndent formatting:
Brought the central loop code for itterating over selections and applying
templates to a function in ElemForEach, transformSelectedNodes. Spent a fair
amount of time optimizing this loop and making it as clean as possible.
transformSelectedNodes calls the dispatchSaxEvent directly when encountering
a character node that doesn't have a template defined (and thus uses the
default text template). dispatchSaxEvent can be used in other places in the
code, but right now it's only used in transformSelectedNodes.
various other finer grained optimizations, based on measurements from
Rational Visual Quantify.
Revision Changes Path
1.7 +243 -156 xml-xalan/java/src/org/apache/xalan/templates/AVT.java
Index: AVT.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/templates/AVT.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- AVT.java 2000/10/18 04:36:42 1.6
+++ AVT.java 2000/10/30 18:49:32 1.7
@@ -57,12 +57,16 @@
package org.apache.xalan.templates;
import org.w3c.dom.Node;
+
import java.util.Vector;
import java.util.StringTokenizer;
+
import org.apache.xalan.utils.StringBufferPool;
import org.apache.xalan.utils.FastStringBuffer;
+
import org.xml.sax.SAXException;
import org.xml.sax.ErrorHandler;
+
import org.apache.xpath.XPathContext;
import org.apache.xpath.XPath;
import org.apache.xalan.res.XSLTErrorResources;
@@ -76,38 +80,43 @@
*/
public class AVT implements java.io.Serializable
{
+
/**
* If the AVT is not complex, just hold the simple string.
*/
private String m_simpleString = null;
-
+
/**
* If the AVT is complex, hold a Vector of AVTParts.
*/
private Vector m_parts = null;
-
+
/**
* The name of the attribute.
*/
private String m_rawName;
-
+
/**
* Get the raw name of the attribute, with the prefix unprocessed.
* MADE PUBLIC 9/5/2000 to support compilation experiment
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public String getRawName()
{
return m_rawName;
}
-
+
/**
* The name of the attribute.
*/
private String m_name;
-
+
/**
* Get the local name of the attribute.
* MADE PUBLIC 9/5/2000 to support compilation experiment
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public String getName()
{
@@ -118,10 +127,12 @@
* The name of the attribute.
*/
private String m_uri;
-
+
/**
* Get the namespace URI of the attribute.
* MADE PUBLIC 9/5/2000 to support compilation experiment
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public String getURI()
{
@@ -129,185 +140,238 @@
}
/**
- * Construct an AVT by parsing the string, and either
- * constructing a vector of AVTParts, or simply hold
+ * Construct an AVT by parsing the string, and either
+ * constructing a vector of AVTParts, or simply hold
* on to the string if the AVT is simple.
+ *
+ * NEEDSDOC @param handler
+ * NEEDSDOC @param uri
+ * NEEDSDOC @param name
+ * NEEDSDOC @param rawName
+ * NEEDSDOC @param stringedValue
+ *
+ * @throws org.xml.sax.SAXException
*/
- public AVT(StylesheetHandler handler,
- String uri,
- String name,
- String rawName,
- String stringedValue)
- throws org.xml.sax.SAXException
+ public AVT(StylesheetHandler handler, String uri, String name, String
rawName, String stringedValue)
+ throws org.xml.sax.SAXException
{
+
m_uri = uri;
m_name = name;
m_rawName = rawName;
- StringTokenizer tokenizer = new StringTokenizer(stringedValue, "{}\"\'",
true);
+
+ StringTokenizer tokenizer = new StringTokenizer(stringedValue, "{}\"\'",
+ true);
int nTokens = tokenizer.countTokens();
- if(nTokens < 2)
+
+ if (nTokens < 2)
{
- m_simpleString = stringedValue; // then do the simple thing
+ m_simpleString = stringedValue; // then do the simple thing
}
else
{
FastStringBuffer buffer = StringBufferPool.get();
FastStringBuffer exprBuffer = StringBufferPool.get();
+
try
{
- m_parts = new Vector(nTokens+1);
- String t = null; // base token
- String lookahead= null; // next token
- String error = null; // if non-null, break from loop
- while(tokenizer.hasMoreTokens())
+ m_parts = new Vector(nTokens + 1);
+
+ String t = null; // base token
+ String lookahead = null; // next token
+ String error = null; // if non-null, break from loop
+
+ while (tokenizer.hasMoreTokens())
{
- if( lookahead != null )
+ if (lookahead != null)
{
t = lookahead;
lookahead = null;
}
- else t = tokenizer.nextToken();
-
- if(t.length() == 1)
+ else
+ t = tokenizer.nextToken();
+
+ if (t.length() == 1)
{
- switch(t.charAt(0))
+ switch (t.charAt(0))
+ {
+ case ('\"') :
+ case ('\'') :
{
- case('\"'):
- case('\''):
+
+ // just keep on going, since we're not in an attribute template
+ buffer.append(t);
+
+ break;
+ }
+ case ('{') :
+ {
+
+ // Attribute Value Template start
+ lookahead = tokenizer.nextToken();
+
+ if (lookahead.equals("{"))
+ {
+
+ // Double curlys mean escape to show curly
+ buffer.append(lookahead);
+
+ lookahead = null;
+
+ break; // from switch
+ }
+
+ /*
+ else if(lookahead.equals("\"") || lookahead.equals("\'"))
{
- // just keep on going, since we're not in an attribute
template
- buffer.append(t);
- break;
+ // Error. Expressions can not begin with quotes.
+ error = "Expressions can not begin with quotes.";
+ break; // from switch
}
- case('{'):
+ */
+ else
{
- // Attribute Value Template start
- lookahead = tokenizer.nextToken();
- if(lookahead.equals("{"))
+ if (buffer.length() > 0)
{
- // Double curlys mean escape to show curly
- buffer.append(lookahead);
- lookahead = null;
- break; // from switch
+ m_parts.addElement(new AVTPartSimple(buffer.toString()));
+ buffer.setLength(0);
}
- /*
- else if(lookahead.equals("\"") || lookahead.equals("\'"))
- {
- // Error. Expressions can not begin with quotes.
- error = "Expressions can not begin with quotes.";
- break; // from switch
- }
- */
- else
- {
- if(buffer.length() > 0)
- {
- m_parts.addElement(new AVTPartSimple(buffer.toString()));
- buffer.setLength(0);
- }
- exprBuffer.setLength(0);
- while(null != lookahead)
+ exprBuffer.setLength(0);
+
+ while (null != lookahead)
+ {
+ if (lookahead.length() == 1)
{
- if(lookahead.length() == 1)
+ switch (lookahead.charAt(0))
{
- switch(lookahead.charAt(0))
+ case '\'' :
+ case '\"' :
+ {
+
+ // String start
+ exprBuffer.append(lookahead);
+
+ String quote = lookahead;
+
+ // Consume stuff 'till next quote
+ lookahead = tokenizer.nextToken();
+
+ while (!lookahead.equals(quote))
{
- case '\'':
- case '\"':
- {
- // String start
- exprBuffer.append(lookahead);
- String quote = lookahead;
- // Consume stuff 'till next quote
- lookahead = tokenizer.nextToken();
- while(!lookahead.equals(quote))
- {
- exprBuffer.append(lookahead);
- lookahead = tokenizer.nextToken();
- }
- exprBuffer.append(lookahead);
- lookahead = tokenizer.nextToken();
- break;
- }
- case '{':
- {
- // What's another curly doing here?
- error =
XSLMessages.createMessage(XSLTErrorResources.ER_NO_CURLYBRACE, null); //"Error:
Can not have \"{\" within expression.";
- break;
- }
- case '}':
- {
- // Proper close of attribute template.
- // Evaluate the expression.
- buffer.setLength(0);
-
- XPath xpath =
handler.createXPath(exprBuffer.toString());
- m_parts.addElement(new AVTPartXPath(xpath));
-
- lookahead = null; // breaks out of inner while loop
- break;
- }
- default:
- {
- // part of the template stuff, just add it.
- exprBuffer.append(lookahead);
- lookahead = tokenizer.nextToken();
- }
- } // end inner switch
- } // end if lookahead length == 1
- else
+ exprBuffer.append(lookahead);
+
+ lookahead = tokenizer.nextToken();
+ }
+
+ exprBuffer.append(lookahead);
+
+ lookahead = tokenizer.nextToken();
+
+ break;
+ }
+ case '{' :
{
+
+ // What's another curly doing here?
+ error = XSLMessages.createMessage(
+ XSLTErrorResources.ER_NO_CURLYBRACE, null);
//"Error: Can not have \"{\" within expression.";
+
+ break;
+ }
+ case '}' :
+ {
+
+ // Proper close of attribute template.
+ // Evaluate the expression.
+ buffer.setLength(0);
+
+ XPath xpath =
+ handler.createXPath(exprBuffer.toString());
+
+ m_parts.addElement(new AVTPartXPath(xpath));
+
+ lookahead = null; // breaks out of inner while loop
+
+ break;
+ }
+ default :
+ {
+
// part of the template stuff, just add it.
exprBuffer.append(lookahead);
+
lookahead = tokenizer.nextToken();
}
- } // end while(!lookahead.equals("}"))
- if(error != null)
+ } // end inner switch
+ } // end if lookahead length == 1
+ else
{
- break; // from inner while loop
+
+ // part of the template stuff, just add it.
+ exprBuffer.append(lookahead);
+
+ lookahead = tokenizer.nextToken();
}
+ } // end while(!lookahead.equals("}"))
+
+ if (error != null)
+ {
+ break; // from inner while loop
}
- break;
}
- case('}'):
+
+ break;
+ }
+ case ('}') :
+ {
+ lookahead = tokenizer.nextToken();
+
+ if (lookahead.equals("}"))
{
- lookahead = tokenizer.nextToken();
- if(lookahead.equals("}"))
- {
- // Double curlys mean escape to show curly
- buffer.append(lookahead);
- lookahead = null; // swallow
- }
- else
- {
- // Illegal, I think...
- handler.warn(XSLTErrorResources.WG_FOUND_CURLYBRACE,
null); //"Found \"}\" but no attribute template open!");
- buffer.append("}");
- // leave the lookahead to be processed by the next round.
- }
- break;
+
+ // Double curlys mean escape to show curly
+ buffer.append(lookahead);
+
+ lookahead = null; // swallow
}
- default:
+ else
{
- // Anything else just add to string.
- buffer.append(t);
+
+ // Illegal, I think...
+ handler.warn(XSLTErrorResources.WG_FOUND_CURLYBRACE, null);
//"Found \"}\" but no attribute template open!");
+ buffer.append("}");
+
+ // leave the lookahead to be processed by the next round.
}
- } // end switch t
- } // end if length == 1
+
+ break;
+ }
+ default :
+ {
+
+ // Anything else just add to string.
+ buffer.append(t);
+ }
+ } // end switch t
+ } // end if length == 1
else
{
+
// Anything else just add to string.
buffer.append(t);
}
- if(null != error)
+
+ if (null != error)
{
- handler.warn(XSLTErrorResources.WG_ATTR_TEMPLATE, new Object[]
{error}); //"Attr Template, "+error);
+ handler.warn(XSLTErrorResources.WG_ATTR_TEMPLATE,
+ new Object[]{ error }); //"Attr Template, "+error);
+
break;
}
- } // end while(tokenizer.hasMoreTokens())
-
- if(buffer.length() > 0)
+ } // end while(tokenizer.hasMoreTokens())
+
+ if (buffer.length() > 0)
{
m_parts.addElement(new AVTPartSimple(buffer.toString()));
buffer.setLength(0);
@@ -318,44 +382,53 @@
StringBufferPool.free(buffer);
StringBufferPool.free(exprBuffer);
}
-
- } // end else nTokens > 1
-
- if(null == m_parts && (null == m_simpleString))
+ } // end else nTokens > 1
+
+ if (null == m_parts && (null == m_simpleString))
{
+
// Error?
m_simpleString = "";
}
}
-
+
/**
* Get the AVT as the original string.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public String getSimpleString()
{
- if(null != m_simpleString)
+
+ if (null != m_simpleString)
{
return m_simpleString;
}
- else if(null != m_parts)
+ else if (null != m_parts)
{
FastStringBuffer buf = StringBufferPool.get();
String s;
+
try
{
buf.setLength(0);
+
int n = m_parts.size();
- for(int i = 0; i < n; i++)
+
+ for (int i = 0; i < n; i++)
{
- AVTPart part = (AVTPart)m_parts.elementAt(i);
+ AVTPart part = (AVTPart) m_parts.elementAt(i);
+
buf.append(part.getSimpleString());
}
+
s = buf.toString();
}
finally
{
StringBufferPool.free(buf);
}
+
return s;
}
else
@@ -363,33 +436,45 @@
return "";
}
}
-
+
/**
* Evaluate the AVT and return a String.
+ *
+ * NEEDSDOC @param xctxt
* @param context The current source tree context.
* @param nsNode The current namespace context (stylesheet tree context).
* @param NodeList The current Context Node List.
- */
- public String evaluate(XPathContext xctxt, Node context,
- org.apache.xalan.utils.PrefixResolver nsNode)
- throws org.xml.sax.SAXException
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws org.xml.sax.SAXException
+ */
+ public String evaluate(
+ XPathContext xctxt, Node context,
org.apache.xalan.utils.PrefixResolver nsNode)
+ throws org.xml.sax.SAXException
{
+
FastStringBuffer buf = StringBufferPool.get();
+
try
{
- if(null != m_simpleString)
+ if (null != m_simpleString)
{
return m_simpleString;
}
- else if(null != m_parts)
+ else if (null != m_parts)
{
buf.setLength(0);
+
int n = m_parts.size();
- for(int i = 0; i < n; i++)
+
+ for (int i = 0; i < n; i++)
{
- AVTPart part = (AVTPart)m_parts.elementAt(i);
+ AVTPart part = (AVTPart) m_parts.elementAt(i);
+
part.evaluate(xctxt, buf, context, nsNode);
}
+
return buf.toString();
}
else
@@ -403,17 +488,19 @@
}
}
- /** Test whether the AVT is insensitive to the context in which
- * it is being evaluated. This is intended to facilitate
- * compilation of templates, by allowing simple AVTs to be
+ /**
+ * Test whether the AVT is insensitive to the context in which
+ * it is being evaluated. This is intended to facilitate
+ * compilation of templates, by allowing simple AVTs to be
* converted back into strings.
- *
+ *
* Currently the only case we recognize is simple strings.
* ADDED 9/5/2000 to support compilation experiment
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public boolean isContextInsensitive()
{
return null != m_simpleString;
}
-
}
1.5 +21 -14
xml-xalan/java/src/org/apache/xalan/templates/AVTPart.java
Index: AVTPart.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/AVTPart.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- AVTPart.java 2000/10/18 04:36:42 1.4
+++ AVTPart.java 2000/10/30 18:49:33 1.5
@@ -57,44 +57,51 @@
package org.apache.xalan.templates;
import org.w3c.dom.*;
+
import org.apache.xpath.XPathContext;
import org.apache.xalan.utils.FastStringBuffer;
/**
* <meta name="usage" content="internal"/>
- * Class to hold a part, either a string or XPath,
+ * Class to hold a part, either a string or XPath,
* of an Attribute Value Template.
*/
public abstract class AVTPart implements java.io.Serializable
{
+
/**
* Construct a part.
*/
- public AVTPart()
- {
- }
-
+ public AVTPart(){}
+
/**
* Get the AVT part as the original string.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public abstract String getSimpleString();
-
+
/**
- * Write the evaluated value into the given
+ * Write the evaluated value into the given
* string buffer.
+ *
+ * NEEDSDOC @param xctxt
* @param buf Buffer to write into.
* @param context The current source tree context.
* @param nsNode The current namespace context (stylesheet tree context).
* @param NodeList The current Context Node List.
+ *
+ * @throws org.xml.sax.SAXException
*/
- public abstract void evaluate(XPathContext xctxt, FastStringBuffer buf,
Node context,
- org.apache.xalan.utils.PrefixResolver nsNode)
- throws org.xml.sax.SAXException;
-
+ public abstract void evaluate(
+ XPathContext xctxt, FastStringBuffer buf, Node context,
+ org.apache.xalan.utils.PrefixResolver nsNode)
+ throws org.xml.sax.SAXException;
+
/**
* Set the XPath support.
+ *
+ * NEEDSDOC @param support
*/
- public void setXPathSupport(XPathContext support)
- {
- }
+ public void setXPathSupport(XPathContext support){}
}
1.5 +12 -5
xml-xalan/java/src/org/apache/xalan/templates/AVTPartSimple.java
Index: AVTPartSimple.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/AVTPartSimple.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- AVTPartSimple.java 2000/10/18 04:36:43 1.4
+++ AVTPartSimple.java 2000/10/30 18:49:33 1.5
@@ -57,6 +57,7 @@
package org.apache.xalan.templates;
import org.w3c.dom.*;
+
import org.apache.xpath.XPathContext;
import org.apache.xalan.utils.FastStringBuffer;
@@ -66,11 +67,12 @@
*/
public class AVTPartSimple extends AVTPart
{
+
/**
* Simple string value;
*/
private String m_val;
-
+
/**
* Construct a simple AVT part.
* @param val A pure string section of an AVT.
@@ -79,24 +81,29 @@
{
m_val = val;
}
-
+
/**
* Get the AVT part as the original string.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public String getSimpleString()
{
return m_val;
}
-
+
/**
* Write the value into the buffer.
+ *
+ * NEEDSDOC @param xctxt
* @param buf Buffer to write into.
* @param context The current source tree context.
* @param nsNode The current namespace context (stylesheet tree context).
* @param NodeList The current Context Node List.
*/
- public void evaluate(XPathContext xctxt, FastStringBuffer buf, Node
context,
- org.apache.xalan.utils.PrefixResolver nsNode)
+ public void evaluate(XPathContext xctxt, FastStringBuffer buf,
+ Node context,
+ org.apache.xalan.utils.PrefixResolver nsNode)
{
buf.append(m_val);
}
1.5 +30 -13
xml-xalan/java/src/org/apache/xalan/templates/AVTPartXPath.java
Index: AVTPartXPath.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/AVTPartXPath.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- AVTPartXPath.java 2000/10/18 04:36:43 1.4
+++ AVTPartXPath.java 2000/10/30 18:49:34 1.5
@@ -61,6 +61,7 @@
import org.apache.xpath.XPathContext;
import org.apache.xpath.compiler.XPathParser;
import org.apache.xalan.utils.FastStringBuffer;
+
import org.w3c.dom.*;
/**
@@ -69,53 +70,69 @@
*/
public class AVTPartXPath extends AVTPart
{
+
/**
* Simple string value;
*/
private XPath m_xpath;
-
+
/**
* Construct a simple AVT part.
* @param val A pure string section of an AVT.
+ *
+ * NEEDSDOC @param xpath
*/
public AVTPartXPath(XPath xpath)
{
m_xpath = xpath;
}
-
+
/**
* Construct a simple AVT part.
* @param val A pure string section of an AVT.
+ * NEEDSDOC @param nsNode
+ * NEEDSDOC @param xpathProcessor
+ * NEEDSDOC @param factory
+ * NEEDSDOC @param liaison
+ *
+ * @throws org.xml.sax.SAXException
*/
- public AVTPartXPath(String val, org.apache.xalan.utils.PrefixResolver
nsNode,
- XPathParser xpathProcessor,
- XPathFactory factory, XPathContext liaison)
- throws org.xml.sax.SAXException
+ public AVTPartXPath(
+ String val, org.apache.xalan.utils.PrefixResolver nsNode,
XPathParser xpathProcessor, XPathFactory factory, XPathContext liaison)
+ throws org.xml.sax.SAXException
{
m_xpath = new XPath(val, null, nsNode, XPath.SELECT);
}
-
+
/**
* Get the AVT part as the original string.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public String getSimpleString()
{
- return "{"+m_xpath.getPatternString()+"}";
+ return "{" + m_xpath.getPatternString() + "}";
}
-
+
/**
* Write the value into the buffer.
+ *
+ * NEEDSDOC @param xctxt
* @param buf Buffer to write into.
* @param context The current source tree context.
* @param nsNode The current namespace context (stylesheet tree context).
* @param NodeList The current Context Node List.
+ *
+ * @throws org.xml.sax.SAXException
*/
- public void evaluate(XPathContext xctxt, FastStringBuffer buf, Node
context,
- org.apache.xalan.utils.PrefixResolver nsNode)
- throws org.xml.sax.SAXException
+ public void evaluate(
+ XPathContext xctxt, FastStringBuffer buf, Node context,
org.apache.xalan.utils.PrefixResolver nsNode)
+ throws org.xml.sax.SAXException
{
+
XObject xobj = m_xpath.execute(xctxt, context, nsNode);
- if(null != xobj)
+
+ if (null != xobj)
{
buf.append(xobj.str());
}
1.5 +338 -405
xml-xalan/java/src/org/apache/xalan/templates/Constants.java
Index: Constants.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/Constants.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Constants.java 2000/10/04 23:21:44 1.4
+++ Constants.java 2000/10/30 18:49:34 1.5
@@ -55,446 +55,379 @@
* <http://www.apache.org/>.
*/
package org.apache.xalan.templates;
-
+
/**
* <meta name="usage" content="advanced"/>
* Primary constants used in the TransformerImpl classes.
*/
public class Constants
{
- public static final String
- S_XMLNAMESPACEURI = "http://www.w3.org/XML/1998/namespace",
- S_XSLNAMESPACEURL = "http://www.w3.org/1999/XSL/Transform",
- S_OLDXSLNAMESPACEURL = "http://www.w3.org/XSL/Transform/1.0",
- S_XPATHNAMESPACEURL = "http://www.w3.org/XSL/Transform",
- S_XPATHNAMESPACEVERSION = "1.0",
- S_VENDOR = "Apache Software Foundation",
- S_VENDORURL = "http://xml.apache.org",
-
- /*
- * Special apache namespace for built-in extensions.
- */
- S_BUILTIN_EXTENSIONS_URL = "http://xml.apache.org/xslt",
-
- PARSER_PATH = "com/ibm/xml/parser/Parser",
- // LIAISON_CLASS = "org.apache.xpath.DOM2Helper";
- LIAISON_CLASS = "org.apache.xalan.dtm.DTMLiaison";
-
+
+ /** NEEDSDOC Field S_XMLNAMESPACEURI, S_XSLNAMESPACEURL,
S_OLDXSLNAMESPACEURL, S_XPATHNAMESPACEURL, S_XPATHNAMESPACEVERSION, S_VENDOR,
S_VENDORURL, S_BUILTIN_EXTENSIONS_URL, PARSER_PATH, LIAISON_CLASS */
+ public static final String S_XMLNAMESPACEURI =
+ "http://www.w3.org/XML/1998/namespace", S_XSLNAMESPACEURL =
+ "http://www.w3.org/1999/XSL/Transform", S_OLDXSLNAMESPACEURL =
+ "http://www.w3.org/XSL/Transform/1.0", S_XPATHNAMESPACEURL =
+ "http://www.w3.org/XSL/Transform", S_XPATHNAMESPACEVERSION =
+ "1.0", S_VENDOR = "Apache Software Foundation", S_VENDORURL =
+ "http://xml.apache.org",
+
+ /*
+ * Special apache namespace for built-in extensions.
+ */
+ S_BUILTIN_EXTENSIONS_URL = "http://xml.apache.org/xslt", PARSER_PATH =
+ "com/ibm/xml/parser/Parser",
+
+ // LIAISON_CLASS = "org.apache.xpath.DOM2Helper";
+ LIAISON_CLASS = "org.apache.xalan.dtm.DTMLiaison";
+
/**
* The minimum version of XSLT supported.
*/
public static final double XSLTVERSUPPORTED = 1.0;
/**
- * IDs for XSL element types. These are associated
+ * IDs for XSL element types. These are associated
* with the string literals in the TransformerImpl class.
* Don't change the numbers.
*/
- public static final int
- ELEMNAME_UNDEFINED = -1,
- ELEMNAME_WITHPARAM = 2,
- ELEMNAME_ADDATTRIBUTE = 4,
- ELEMNAME_ANCHOR = 22,
- // ELEMNAME_ANCHOR_PATTERN = 23,
- ELEMNAME_APPLY_TEMPLATES = 50,
- ELEMNAME_USE = 34,
- ELEMNAME_CHILDREN = 6,
- ELEMNAME_CHOOSE = 37,
- ELEMNAME_COMMENT = 59, // my own
- ELEMNAME_CONSTRUCT = 7, // my own
- ELEMNAME_CONTENTS = 8,
- ELEMNAME_COPY = 9,
- ELEMNAME_COPY_OF = 74,
- ELEMNAME_DECIMALFORMAT = 83,
- ELEMNAME_DEFINEATTRIBUTESET = 40,
- // ELEMNAME_DEFINECONSTANT = 29,
- // ELEMNAME_DEFINEMACRO = 10,
- ELEMNAME_DEFINESCRIPT = 11,
- ELEMNAME_DISPLAYIF = 12, // my own
- ELEMNAME_EMPTY = 14,
- ELEMNAME_EVAL = 15,
- ELEMNAME_EXPECTEDCHILDREN = 16,
- ELEMNAME_EXTENSION = 54,
- ELEMNAME_EXTENSIONHANDLER = 63,
- ELEMNAME_FOREACH = 28,
- ELEMNAME_KEY = 31,
- ELEMNAME_IF = 36,
- ELEMNAME_IMPORT = 26,
- ELEMNAME_INCLUDE = 27,
- ELEMNAME_CALLTEMPLATE = 17,
- ELEMNAME_PARAMVARIABLE = 41,
- ELEMNAME_NUMBER = 35,
- ELEMNAME_NSALIAS = 84,
- ELEMNAME_OTHERWISE = 39,
- ELEMNAME_PI = 58,
- ELEMNAME_PRESERVESPACE = 33,
- ELEMNAME_REMOVEATTRIBUTE = 5,
- ELEMNAME_TEMPLATE = 19,
- ELEMNAME_SORT = 64,
- ELEMNAME_STRIPSPACE = 32,
- ELEMNAME_STYLESHEET = 25,
- ELEMNAME_TEXT = 42,
- ELEMNAME_VALUEOF = 30,
- ELEMNAME_WHEN = 38,
-
- // Pattern by example support
- ELEMNAME_ROOT = 44,
- ELEMNAME_ANY = 45,
- ELEMNAME_ELEMENT = 46,
- ELEMNAME_TARGETELEMENT = 47,
- ELEMNAME_ATTRIBUTE = 48,
- ELEMNAME_TARGETATTRIBUTE = 49,
- ELEMNAME_URL = 52, // my own
-
- ELEMNAME_CALL = 55, // my own
- // ELEMNAME_WITHPARAM = 56,
- ELEMNAME_FALLBACK = 57, // my own
-
- ELEMNAME_TARGETPI = 60, // my own
- ELEMNAME_TARGETCOMMENT = 61, // my own
- ELEMNAME_TARGETTEXT = 62, // my own
-
- ELEMNAME_CSSSTYLECONVERSION = 65, // my own
-
- ELEMNAME_COUNTER = 66,
- ELEMNAME_COUNTERS = 67,
- ELEMNAME_COUNTERINCREMENT = 68,
- ELEMNAME_COUNTERRESET = 69,
- ELEMNAME_COUNTERSCOPE = 71,
- ELEMNAME_APPLY_IMPORTS = 72,
-
- ELEMNAME_VARIABLE = 73,
- ELEMNAME_MESSAGE = 75,
- ELEMNAME_LOCALE = 76,
-
- ELEMNAME_LITERALRESULT = 77,
- ELEMNAME_TEXTLITERALRESULT = 78,
-
- ELEMNAME_EXTENSIONCALL = 79,
- ELEMNAME_EXTENSIONDECL = 85,
- ELEMNAME_EXTENSIONSCRIPT = 86,
+ public static final int ELEMNAME_UNDEFINED = -1, ELEMNAME_WITHPARAM = 2,
+ ELEMNAME_ADDATTRIBUTE = 4, ELEMNAME_ANCHOR = 22,
- ELEMNAME_OUTPUT = 80,
+ // ELEMNAME_ANCHOR_PATTERN = 23,
+ ELEMNAME_APPLY_TEMPLATES = 50, ELEMNAME_USE = 34, ELEMNAME_CHILDREN = 6,
+ ELEMNAME_CHOOSE = 37, ELEMNAME_COMMENT =
59, // my own
+ ELEMNAME_CONSTRUCT = 7, // my own
+ ELEMNAME_CONTENTS = 8, ELEMNAME_COPY = 9,
+ ELEMNAME_COPY_OF = 74,
+ ELEMNAME_DECIMALFORMAT = 83,
+ ELEMNAME_DEFINEATTRIBUTESET = 40,
+
+ // ELEMNAME_DEFINECONSTANT = 29,
+ // ELEMNAME_DEFINEMACRO = 10,
+ ELEMNAME_DEFINESCRIPT = 11, ELEMNAME_DISPLAYIF = 12, // my own
+ ELEMNAME_EMPTY = 14, ELEMNAME_EVAL = 15,
+ ELEMNAME_EXPECTEDCHILDREN = 16,
+ ELEMNAME_EXTENSION = 54,
+ ELEMNAME_EXTENSIONHANDLER = 63,
+ ELEMNAME_FOREACH = 28, ELEMNAME_KEY = 31,
+ ELEMNAME_IF = 36, ELEMNAME_IMPORT = 26,
+ ELEMNAME_INCLUDE = 27,
+ ELEMNAME_CALLTEMPLATE = 17,
+ ELEMNAME_PARAMVARIABLE = 41,
+ ELEMNAME_NUMBER = 35, ELEMNAME_NSALIAS = 84,
+ ELEMNAME_OTHERWISE = 39, ELEMNAME_PI = 58,
+ ELEMNAME_PRESERVESPACE = 33,
+ ELEMNAME_REMOVEATTRIBUTE = 5,
+ ELEMNAME_TEMPLATE = 19, ELEMNAME_SORT = 64,
+ ELEMNAME_STRIPSPACE = 32,
+ ELEMNAME_STYLESHEET = 25, ELEMNAME_TEXT = 42,
+ ELEMNAME_VALUEOF = 30, ELEMNAME_WHEN = 38,
+
+ // Pattern by example support
+ ELEMNAME_ROOT = 44, ELEMNAME_ANY = 45, ELEMNAME_ELEMENT = 46,
+ ELEMNAME_TARGETELEMENT = 47, ELEMNAME_ATTRIBUTE = 48,
+ ELEMNAME_TARGETATTRIBUTE = 49, ELEMNAME_URL = 52, //
my own
+ ELEMNAME_CALL = 55, // my own
+
+ // ELEMNAME_WITHPARAM = 56,
+ ELEMNAME_FALLBACK = 57, // my own
+ ELEMNAME_TARGETPI = 60, // my own
+ ELEMNAME_TARGETCOMMENT = 61, // my own
+ ELEMNAME_TARGETTEXT = 62, // my own
+ ELEMNAME_CSSSTYLECONVERSION = 65, // my own
+ ELEMNAME_COUNTER = 66, ELEMNAME_COUNTERS = 67,
+ ELEMNAME_COUNTERINCREMENT = 68, ELEMNAME_COUNTERRESET = 69,
+ ELEMNAME_COUNTERSCOPE = 71, ELEMNAME_APPLY_IMPORTS = 72,
+ ELEMNAME_VARIABLE = 73, ELEMNAME_MESSAGE = 75, ELEMNAME_LOCALE = 76,
+ ELEMNAME_LITERALRESULT = 77, ELEMNAME_TEXTLITERALRESULT = 78,
+ ELEMNAME_EXTENSIONCALL = 79, ELEMNAME_EXTENSIONDECL = 85,
+ ELEMNAME_EXTENSIONSCRIPT = 86, ELEMNAME_OUTPUT = 80,
+ ELEMNAME_COMPONENT = 81, ELEMNAME_SCRIPT = 82;
- ELEMNAME_COMPONENT = 81,
- ELEMNAME_SCRIPT = 82;
-
// Next free number: 87
-
+
/**
* Literals for XSL element names. Note that there are more
* names than IDs, because some names map to the same ID.
*/
- public static final String
- ELEMNAME_COMPONENT_STRING = "component",
- ELEMNAME_SCRIPT_STRING = "script",
- ELEMNAME_ARG_STRING = "arg",
- ELEMNAME_ANCHOR_STRING = "anchor",
- ELEMNAME_ANY_STRING = "any", // pattern-by-example support
- ELEMNAME_APPLY_IMPORTS_STRING = "apply-imports",
- ELEMNAME_APPLY_TEMPLATES_STRING = "apply-templates",
- ELEMNAME_ATTRIBUTESET_STRING = "attribute-set",
- ELEMNAME_ATTRIBUTE_STRING = "attribute", // pattern-by-example support
- ELEMNAME_CALLTEMPLATEARG_STRING = "invoke-arg",
- ELEMNAME_CALLTEMPLATE_STRING = "call-template",
- ELEMNAME_CALL_STRING = "call",
- ELEMNAME_CHILDREN_STRING = "children",
- ELEMNAME_CHOOSE_STRING = "choose",
- ELEMNAME_COMMENT_STRING = "comment",
- ELEMNAME_CONSTRUCT_STRING = "construct", // my own
- ELEMNAME_CONTENTS_STRING = "contents",
- ELEMNAME_COPY_OF_STRING = "copy-of",
- ELEMNAME_COPY_STRING = "copy",
- ELEMNAME_DECIMALFORMAT_STRING = "decimal-format",
-
- ELEMNAME_COUNTERINCREMENT_STRING = "counter-increment",
- ELEMNAME_COUNTERRESET_STRING = "counter-reset",
- ELEMNAME_COUNTERSCOPE_STRING = "counter-scope",
- ELEMNAME_COUNTERS_STRING = "counters",
- ELEMNAME_COUNTER_STRING = "counter",
- ELEMNAME_CSSSTYLECONVERSION_STRING = "css-style-conversion",
- ELEMNAME_DISPLAYIF_STRING = "display-if", // my own
- ELEMNAME_ELEMENT_STRING = "element", // pattern-by-example support
- ELEMNAME_EMPTY_STRING = "empty",
- ELEMNAME_EVAL_STRING = "eval",
- ELEMNAME_EXPECTEDCHILDREN_STRING = "expectedchildren",
- ELEMNAME_EXTENSIONHANDLER_STRING = "code-dispatcher",
- ELEMNAME_EXTENSION_STRING = "functions",
- ELEMNAME_FALLBACK_STRING = "fallback",
- ELEMNAME_FOREACH_STRING = "for-each",
- ELEMNAME_IF_STRING = "if",
- ELEMNAME_IMPORT_STRING = "import",
- ELEMNAME_INCLUDE_STRING = "include",
- ELEMNAME_KEY_STRING = "key",
- ELEMNAME_LOCALE_STRING = "locale",
- ELEMNAME_MESSAGE_STRING = "message",
- ELEMNAME_NUMBER_STRING = "number",
- ELEMNAME_NSALIAS_STRING = "namespace-alias",
- ELEMNAME_OTHERWISE_STRING = "otherwise",
- ELEMNAME_OUTPUT_STRING = "output",
- ELEMNAME_PARAMVARIABLE_STRING = "param",
- ELEMNAME_PI_OLD_STRING = "pi",
- ELEMNAME_PI_STRING = "processing-instruction",
- ELEMNAME_PRESERVESPACE_STRING = "preserve-space",
- ELEMNAME_ROOT_STRING = "root", // pattern-by-example support
- ELEMNAME_SORT_STRING = "sort",
- ELEMNAME_STRIPSPACE_STRING = "strip-space",
- ELEMNAME_STYLESHEET_STRING = "stylesheet",
- ELEMNAME_TARGETATTRIBUTE_STRING = "target-attribute", //
pattern-by-example support
- ELEMNAME_TARGETCOMMENT_STRING = "target-comment",
- ELEMNAME_TARGETELEMENT_STRING = "target-element", // pattern-by-example
support
- ELEMNAME_TARGETPI_STRING = "target-pi",
- ELEMNAME_TARGETTEXT_STRING = "target-text",
- ELEMNAME_TEMPLATE_STRING = "template",
- ELEMNAME_TEXT_STRING = "text",
- ELEMNAME_TRANSFORM_STRING = "transform",
- ELEMNAME_URL_STRING = "uri", // pattern-by-example support
- ELEMNAME_USE_STRING = "use",
- ELEMNAME_VALUEOF_STRING = "value-of",
- ELEMNAME_VARIABLE_STRING = "variable",
- ELEMNAME_WHEN_STRING = "when",
- ELEMNAME_WITHPARAM_STRING = "with-param";
-
- public static final String
- ATTRNAME_OUTPUT_METHOD = "method", // qname,
- ATTRNAME_AMOUNT = "amount",
- ATTRNAME_ANCESTOR = "ancestor",
- ATTRNAME_ARCHIVE = "archive",
- ATTRNAME_ATTRIBUTE = "attribute",
- ATTRNAME_ATTRIBUTE_SET = "attribute-set",
- ATTRNAME_CASEORDER = "case-order",
- ATTRNAME_CLASS = "class",
- ATTRNAME_CLASSID = "classid",
- ATTRNAME_CODEBASE = "codebase",
- ATTRNAME_CODETYPE = "type",
- ATTRNAME_CONDITION = "condition",
- ATTRNAME_COPYTYPE = "copy-type",
- ATTRNAME_COUNT = "count",
- ATTRNAME_DATATYPE = "data-type",
- ATTRNAME_DECIMALSEPARATOR = "decimal-separator",
- ATTRNAME_DEFAULT = "default",
- ATTRNAME_DEFAULTSPACE = "default-space",
- ATTRNAME_DEPTH = "with-children",
- ATTRNAME_DIGIT = "digit",
- ATTRNAME_DIGITGROUPSEP = "digit-group-sep",
- ATTRNAME_DISABLE_OUTPUT_ESCAPING = "disable-output-escaping",
- ATTRNAME_ELEMENT = "element",
- ATTRNAME_ELEMENTS = "elements",
- ATTRNAME_EXPR = "expr",
- ATTRNAME_EXTENSIONELEMENTPREFIXES = "extension-element-prefixes",
- ATTRNAME_FORMAT = "format",
- ATTRNAME_FROM = "from",
- ATTRNAME_GROUPINGSEPARATOR = "grouping-separator",
- ATTRNAME_GROUPINGSIZE = "grouping-size",
- ATTRNAME_HREF = "href",
- ATTRNAME_ID = "id",
- ATTRNAME_IMPORTANCE = "importance",
- ATTRNAME_INDENTRESULT = "indent-result",
- ATTRNAME_INFINITY = "infinity",
- ATTRNAME_LANG = "lang",
- ATTRNAME_LETTERVALUE = "letter-value",
- ATTRNAME_LEVEL = "level",
- ATTRNAME_MATCH = "match",
- ATTRNAME_METHOD = "calls",
- ATTRNAME_MINUSSIGN = "minus-sign",
- ATTRNAME_MODE = "mode",
- ATTRNAME_NAME = "name",
- ATTRNAME_NAMESPACE = "namespace",
- ATTRNAME_NAN = "NaN",
- ATTRNAME_NDIGITSPERGROUP = "n-digits-per-group",
- ATTRNAME_NS = "ns",
- ATTRNAME_ONLY = "only",
- ATTRNAME_ORDER = "order",
- ATTRNAME_OUTPUT_CDATA_SECTION_ELEMENTS = "cdata-section-elements",
- ATTRNAME_OUTPUT_DOCTYPE_PUBLIC = "doctype-public",
- ATTRNAME_OUTPUT_DOCTYPE_SYSTEM = "doctype-system",
- ATTRNAME_OUTPUT_ENCODING = "encoding",
- ATTRNAME_OUTPUT_INDENT = "indent",
- ATTRNAME_OUTPUT_MEDIATYPE = "media-type",
- ATTRNAME_OUTPUT_STANDALONE = "standalone",
- ATTRNAME_OUTPUT_VERSION = "version",
- ATTRNAME_OUTPUT_OMITXMLDECL = "omit-xml-declaration",
- ATTRNAME_PATTERNSEPARATOR = "pattern-separator",
- ATTRNAME_PERCENT = "percent",
- ATTRNAME_PERMILLE = "per-mille",
- ATTRNAME_PRIORITY = "priority",
- ATTRNAME_REFID = "refID",
- ATTRNAME_RESULTNS = "result-ns",
- ATTRNAME_RESULT_PREFIX = "result-prefix",
- ATTRNAME_SELECT = "select",
- ATTRNAME_SEQUENCESRC = "sequence-src",
- ATTRNAME_STYLE = "style",
- ATTRNAME_STYLESHEET_PREFIX = "stylesheet-prefix",
- ATTRNAME_TERMINATE = "terminate",
- ATTRNAME_TEST = "test",
- ATTRNAME_TOSTRING = "to-string",
- ATTRNAME_TYPE = "type",
- ATTRNAME_USE = "use",
- ATTRNAME_USEATTRIBUTESETS = "use-attribute-sets",
- ATTRNAME_VALUE = "value",
- ATTRNAME_VERSION = "version",
- ATTRNAME_XMLNSDEF = "xmlns",
- ATTRNAME_XMLNS = "xmlns:",
- ATTRNAME_XMLSPACE = "xml:space",
- ATTRNAME_ZERODIGIT = "zero-digit",
- ATTRNAME_EXCLUDE_RESULT_PREFIXES = "exclude-result-prefixes";
-
- public static final int
- TATTRNAME_OUTPUT_METHOD = 1,
- TATTRNAME_AMOUNT = 2,
- TATTRNAME_ANCESTOR = 3,
- TATTRNAME_ARCHIVE = 4,
- TATTRNAME_ATTRIBUTE = 5,
- TATTRNAME_ATTRIBUTE_SET = 6,
- TATTRNAME_CASEORDER = 7,
- TATTRNAME_CLASS = 8,
- TATTRNAME_CLASSID = 9,
- TATTRNAME_CODEBASE = 10,
- TATTRNAME_CODETYPE = 11,
- TATTRNAME_CONDITION = 12,
- TATTRNAME_COPYTYPE = 13,
- TATTRNAME_COUNT = 14,
- TATTRNAME_DATATYPE = 15,
- TATTRNAME_DEFAULT = 16,
- TATTRNAME_DEFAULTSPACE = 17,
- TATTRNAME_DEPTH = 18,
- TATTRNAME_DIGITGROUPSEP = 19,
- TATTRNAME_DISABLE_OUTPUT_ESCAPING = 20,
- TATTRNAME_ELEMENT = 21,
- TATTRNAME_ELEMENTS = 22,
- TATTRNAME_EXPR = 23,
- TATTRNAME_EXTENSIONELEMENTPREFIXES = 24,
- TATTRNAME_FORMAT = 25,
- TATTRNAME_FROM = 26,
- TATTRNAME_GROUPINGSEPARATOR = 27,
- TATTRNAME_GROUPINGSIZE = 28,
- TATTRNAME_HREF = 29,
- TATTRNAME_ID = 30,
- TATTRNAME_IMPORTANCE = 31,
- TATTRNAME_INDENTRESULT = 32,
- TATTRNAME_LANG = 33,
- TATTRNAME_LETTERVALUE = 34,
- TATTRNAME_LEVEL = 35,
- TATTRNAME_MATCH = 36,
- TATTRNAME_METHOD = 37,
- TATTRNAME_MODE = 38,
- TATTRNAME_NAME = 39,
- TATTRNAME_NAMESPACE = 40,
- TATTRNAME_NDIGITSPERGROUP = 41,
- TATTRNAME_NS = 42,
- TATTRNAME_ONLY = 43,
- TATTRNAME_ORDER = 44,
- TATTRNAME_OUTPUT_CDATA_SECTION_ELEMENTS = 45,
- TATTRNAME_OUTPUT_DOCTYPE_PUBLIC = 46,
- TATTRNAME_OUTPUT_DOCTYPE_SYSTEM = 47,
- TATTRNAME_OUTPUT_ENCODING = 48,
- TATTRNAME_OUTPUT_INDENT = 49,
- TATTRNAME_OUTPUT_MEDIATYPE = 50,
- TATTRNAME_OUTPUT_STANDALONE = 51,
- TATTRNAME_OUTPUT_VERSION = 52,
- TATTRNAME_OUTPUT_OMITXMLDECL = 53,
- TATTRNAME_PRIORITY = 54,
- TATTRNAME_REFID = 55,
- TATTRNAME_RESULTNS = 56,
- TATTRNAME_SELECT = 57,
- TATTRNAME_SEQUENCESRC = 58,
- TATTRNAME_STYLE = 59,
- TATTRNAME_TEST = 60,
- TATTRNAME_TOSTRING = 61,
- TATTRNAME_TYPE = 62,
- TATTRNAME_USE = 63,
- TATTRNAME_USEATTRIBUTESETS = 64,
- TATTRNAME_VALUE = 65,
- TATTRNAME_XMLNSDEF = 66,
- TATTRNAME_XMLNS = 67,
- TATTRNAME_XMLSPACE = 68,
- TATTRNAME_EXCLUDE_RESULT_PREFIXES = 69
- ;
-
- public static final String
- ATTRVAL_OUTPUT_METHOD_HTML = "html",
- ATTRVAL_OUTPUT_METHOD_XML = "xml",
- ATTRVAL_OUTPUT_METHOD_TEXT = "text";
-
+ public static final String ELEMNAME_COMPONENT_STRING = "component",
+ ELEMNAME_SCRIPT_STRING = "script",
+ ELEMNAME_ARG_STRING = "arg",
+ ELEMNAME_ANCHOR_STRING = "anchor",
+ ELEMNAME_ANY_STRING = "any", //
pattern-by-example support
+ ELEMNAME_APPLY_IMPORTS_STRING = "apply-imports",
+ ELEMNAME_APPLY_TEMPLATES_STRING =
"apply-templates",
+ ELEMNAME_ATTRIBUTESET_STRING = "attribute-set",
+ ELEMNAME_ATTRIBUTE_STRING = "attribute", //
pattern-by-example support
+ ELEMNAME_CALLTEMPLATEARG_STRING = "invoke-arg",
+ ELEMNAME_CALLTEMPLATE_STRING = "call-template",
+ ELEMNAME_CALL_STRING = "call",
+ ELEMNAME_CHILDREN_STRING = "children",
+ ELEMNAME_CHOOSE_STRING = "choose",
+ ELEMNAME_COMMENT_STRING = "comment",
+ ELEMNAME_CONSTRUCT_STRING = "construct", // my
own
+ ELEMNAME_CONTENTS_STRING =
+ "contents", ELEMNAME_COPY_OF_STRING =
+ "copy-of", ELEMNAME_COPY_STRING =
+ "copy", ELEMNAME_DECIMALFORMAT_STRING =
+ "decimal-format",
ELEMNAME_COUNTERINCREMENT_STRING =
+ "counter-increment",
ELEMNAME_COUNTERRESET_STRING =
+ "counter-reset", ELEMNAME_COUNTERSCOPE_STRING
=
+ "counter-scope", ELEMNAME_COUNTERS_STRING =
+ "counters", ELEMNAME_COUNTER_STRING =
+ "counter", ELEMNAME_CSSSTYLECONVERSION_STRING
=
+ "css-style-conversion",
ELEMNAME_DISPLAYIF_STRING =
+ "display-if", // my own
+ ELEMNAME_ELEMENT_STRING = "element", //
pattern-by-example support
+ ELEMNAME_EMPTY_STRING = "empty",
+ ELEMNAME_EVAL_STRING = "eval",
+ ELEMNAME_EXPECTEDCHILDREN_STRING =
"expectedchildren",
+ ELEMNAME_EXTENSIONHANDLER_STRING =
"code-dispatcher",
+ ELEMNAME_EXTENSION_STRING = "functions",
+ ELEMNAME_FALLBACK_STRING = "fallback",
+ ELEMNAME_FOREACH_STRING = "for-each",
+ ELEMNAME_IF_STRING = "if",
+ ELEMNAME_IMPORT_STRING = "import",
+ ELEMNAME_INCLUDE_STRING = "include",
+ ELEMNAME_KEY_STRING = "key",
+ ELEMNAME_LOCALE_STRING = "locale",
+ ELEMNAME_MESSAGE_STRING = "message",
+ ELEMNAME_NUMBER_STRING = "number",
+ ELEMNAME_NSALIAS_STRING = "namespace-alias",
+ ELEMNAME_OTHERWISE_STRING = "otherwise",
+ ELEMNAME_OUTPUT_STRING = "output",
+ ELEMNAME_PARAMVARIABLE_STRING = "param",
+ ELEMNAME_PI_OLD_STRING = "pi",
+ ELEMNAME_PI_STRING = "processing-instruction",
+ ELEMNAME_PRESERVESPACE_STRING =
"preserve-space",
+ ELEMNAME_ROOT_STRING = "root", //
pattern-by-example support
+ ELEMNAME_SORT_STRING = "sort",
+ ELEMNAME_STRIPSPACE_STRING = "strip-space",
+ ELEMNAME_STYLESHEET_STRING = "stylesheet",
+ ELEMNAME_TARGETATTRIBUTE_STRING =
+ "target-attribute", // pattern-by-example
support
+ ELEMNAME_TARGETCOMMENT_STRING =
"target-comment",
+ ELEMNAME_TARGETELEMENT_STRING =
"target-element", // pattern-by-example support
+ ELEMNAME_TARGETPI_STRING = "target-pi",
+ ELEMNAME_TARGETTEXT_STRING = "target-text",
+ ELEMNAME_TEMPLATE_STRING = "template",
+ ELEMNAME_TEXT_STRING = "text",
+ ELEMNAME_TRANSFORM_STRING = "transform",
+ ELEMNAME_URL_STRING = "uri", //
pattern-by-example support
+ ELEMNAME_USE_STRING = "use",
+ ELEMNAME_VALUEOF_STRING = "value-of",
+ ELEMNAME_VARIABLE_STRING = "variable",
+ ELEMNAME_WHEN_STRING = "when",
+ ELEMNAME_WITHPARAM_STRING = "with-param";
+
+ /** NEEDSDOC Field ATTRNAME_OUTPUT_METHOD, ATTRNAME_AMOUNT,
ATTRNAME_ANCESTOR, ATTRNAME_ARCHIVE, ATTRNAME_ATTRIBUTE,
ATTRNAME_ATTRIBUTE_SET, ATTRNAME_CASEORDER, ATTRNAME_CLASS, ATTRNAME_CLASSID,
ATTRNAME_CODEBASE, ATTRNAME_CODETYPE, ATTRNAME_CONDITION, ATTRNAME_COPYTYPE,
ATTRNAME_COUNT, ATTRNAME_DATATYPE, ATTRNAME_DECIMALSEPARATOR, ATTRNAME_DEFAULT,
ATTRNAME_DEFAULTSPACE, ATTRNAME_DEPTH, ATTRNAME_DIGIT, ATTRNAME_DIGITGROUPSEP,
ATTRNAME_DISABLE_OUTPUT_ESCAPING, ATTRNAME_ELEMENT, ATTRNAME_ELEMENTS,
ATTRNAME_EXPR, ATTRNAME_EXTENSIONELEMENTPREFIXES, ATTRNAME_FORMAT,
ATTRNAME_FROM, ATTRNAME_GROUPINGSEPARATOR, ATTRNAME_GROUPINGSIZE,
ATTRNAME_HREF, ATTRNAME_ID, ATTRNAME_IMPORTANCE, ATTRNAME_INDENTRESULT,
ATTRNAME_INFINITY, ATTRNAME_LANG, ATTRNAME_LETTERVALUE, ATTRNAME_LEVEL,
ATTRNAME_MATCH, ATTRNAME_METHOD, ATTRNAME_MINUSSIGN, ATTRNAME_MODE,
ATTRNAME_NAME, ATTRNAME_NAMESPACE, ATTRNAME_NAN, ATTRNAME_NDIGITSPERGROUP,
ATTRNAME_NS, ATTRNAME_ONLY, ATTRNAME_ORDER,
ATTRNAME_OUTPUT_CDATA_SECTION_ELEMENTS, ATTRNAME_OUT
PUT_DOCTYPE_PUBLIC, ATTRNAME_OUTPUT_DOCTYPE_SYSTEM, ATTRNAME_OUTPUT_ENCODING,
ATTRNAME_OUTPUT_INDENT, ATTRNAME_OUTPUT_MEDIATYPE, ATTRNAME_OUTPUT_STANDALONE,
ATTRNAME_OUTPUT_VERSION, ATTRNAME_OUTPUT_OMITXMLDECL,
ATTRNAME_PATTERNSEPARATOR, ATTRNAME_PERCENT, ATTRNAME_PERMILLE,
ATTRNAME_PRIORITY, ATTRNAME_REFID, ATTRNAME_RESULTNS, ATTRNAME_RESULT_PREFIX,
ATTRNAME_SELECT, ATTRNAME_SEQUENCESRC, ATTRNAME_STYLE,
ATTRNAME_STYLESHEET_PREFIX, ATTRNAME_TERMINATE, ATTRNAME_TEST,
ATTRNAME_TOSTRING, ATTRNAME_TYPE, ATTRNAME_USE, ATTRNAME_USEATTRIBUTESETS,
ATTRNAME_VALUE, ATTRNAME_VERSION, ATTRNAME_XMLNSDEF, ATTRNAME_XMLNS,
ATTRNAME_XMLSPACE, ATTRNAME_ZERODIGIT, ATTRNAME_EXCLUDE_RESULT_PREFIXES
*/
+ public static final String ATTRNAME_OUTPUT_METHOD = "method", // qname,
+ ATTRNAME_AMOUNT = "amount", ATTRNAME_ANCESTOR =
+ "ancestor", ATTRNAME_ARCHIVE =
+ "archive", ATTRNAME_ATTRIBUTE =
+ "attribute", ATTRNAME_ATTRIBUTE_SET =
+ "attribute-set", ATTRNAME_CASEORDER =
+ "case-order", ATTRNAME_CLASS =
+ "class", ATTRNAME_CLASSID =
+ "classid", ATTRNAME_CODEBASE =
+ "codebase", ATTRNAME_CODETYPE =
+ "type", ATTRNAME_CONDITION =
+ "condition", ATTRNAME_COPYTYPE =
+ "copy-type", ATTRNAME_COUNT =
+ "count", ATTRNAME_DATATYPE =
+ "data-type", ATTRNAME_DECIMALSEPARATOR =
+ "decimal-separator", ATTRNAME_DEFAULT =
+ "default", ATTRNAME_DEFAULTSPACE =
+ "default-space", ATTRNAME_DEPTH =
+ "with-children", ATTRNAME_DIGIT =
+ "digit", ATTRNAME_DIGITGROUPSEP =
+ "digit-group-sep",
ATTRNAME_DISABLE_OUTPUT_ESCAPING =
+ "disable-output-escaping", ATTRNAME_ELEMENT =
+ "element", ATTRNAME_ELEMENTS =
+ "elements", ATTRNAME_EXPR =
+ "expr", ATTRNAME_EXTENSIONELEMENTPREFIXES =
+ "extension-element-prefixes", ATTRNAME_FORMAT
=
+ "format", ATTRNAME_FROM =
+ "from", ATTRNAME_GROUPINGSEPARATOR =
+ "grouping-separator", ATTRNAME_GROUPINGSIZE =
+ "grouping-size", ATTRNAME_HREF =
+ "href", ATTRNAME_ID =
+ "id", ATTRNAME_IMPORTANCE =
+ "importance", ATTRNAME_INDENTRESULT =
+ "indent-result", ATTRNAME_INFINITY =
+ "infinity", ATTRNAME_LANG =
+ "lang", ATTRNAME_LETTERVALUE =
+ "letter-value", ATTRNAME_LEVEL =
+ "level", ATTRNAME_MATCH =
+ "match", ATTRNAME_METHOD =
+ "calls", ATTRNAME_MINUSSIGN =
+ "minus-sign", ATTRNAME_MODE =
+ "mode", ATTRNAME_NAME =
+ "name", ATTRNAME_NAMESPACE =
+ "namespace", ATTRNAME_NAN =
+ "NaN", ATTRNAME_NDIGITSPERGROUP =
+ "n-digits-per-group", ATTRNAME_NS =
+ "ns", ATTRNAME_ONLY = "only", ATTRNAME_ORDER =
+ "order",
ATTRNAME_OUTPUT_CDATA_SECTION_ELEMENTS =
+ "cdata-section-elements",
ATTRNAME_OUTPUT_DOCTYPE_PUBLIC =
+ "doctype-public",
ATTRNAME_OUTPUT_DOCTYPE_SYSTEM =
+ "doctype-system", ATTRNAME_OUTPUT_ENCODING =
+ "encoding", ATTRNAME_OUTPUT_INDENT =
+ "indent", ATTRNAME_OUTPUT_MEDIATYPE =
+ "media-type", ATTRNAME_OUTPUT_STANDALONE =
+ "standalone", ATTRNAME_OUTPUT_VERSION =
+ "version", ATTRNAME_OUTPUT_OMITXMLDECL =
+ "omit-xml-declaration",
ATTRNAME_PATTERNSEPARATOR =
+ "pattern-separator", ATTRNAME_PERCENT =
+ "percent", ATTRNAME_PERMILLE =
+ "per-mille", ATTRNAME_PRIORITY =
+ "priority", ATTRNAME_REFID =
+ "refID", ATTRNAME_RESULTNS =
+ "result-ns", ATTRNAME_RESULT_PREFIX =
+ "result-prefix", ATTRNAME_SELECT =
+ "select", ATTRNAME_SEQUENCESRC =
+ "sequence-src", ATTRNAME_STYLE =
+ "style", ATTRNAME_STYLESHEET_PREFIX =
+ "stylesheet-prefix", ATTRNAME_TERMINATE =
+ "terminate", ATTRNAME_TEST =
+ "test", ATTRNAME_TOSTRING =
+ "to-string", ATTRNAME_TYPE =
+ "type", ATTRNAME_USE =
+ "use", ATTRNAME_USEATTRIBUTESETS =
+ "use-attribute-sets", ATTRNAME_VALUE =
+ "value", ATTRNAME_VERSION =
+ "version", ATTRNAME_XMLNSDEF =
+ "xmlns", ATTRNAME_XMLNS =
+ "xmlns:", ATTRNAME_XMLSPACE =
+ "xml:space", ATTRNAME_ZERODIGIT =
+ "zero-digit",
ATTRNAME_EXCLUDE_RESULT_PREFIXES =
+ "exclude-result-prefixes";
+
+ /** NEEDSDOC Field TATTRNAME_OUTPUT_METHOD, TATTRNAME_AMOUNT,
TATTRNAME_ANCESTOR, TATTRNAME_ARCHIVE, TATTRNAME_ATTRIBUTE,
TATTRNAME_ATTRIBUTE_SET, TATTRNAME_CASEORDER, TATTRNAME_CLASS,
TATTRNAME_CLASSID, TATTRNAME_CODEBASE, TATTRNAME_CODETYPE, TATTRNAME_CONDITION,
TATTRNAME_COPYTYPE, TATTRNAME_COUNT, TATTRNAME_DATATYPE, TATTRNAME_DEFAULT,
TATTRNAME_DEFAULTSPACE, TATTRNAME_DEPTH, TATTRNAME_DIGITGROUPSEP,
TATTRNAME_DISABLE_OUTPUT_ESCAPING, TATTRNAME_ELEMENT, TATTRNAME_ELEMENTS,
TATTRNAME_EXPR, TATTRNAME_EXTENSIONELEMENTPREFIXES, TATTRNAME_FORMAT,
TATTRNAME_FROM, TATTRNAME_GROUPINGSEPARATOR, TATTRNAME_GROUPINGSIZE,
TATTRNAME_HREF, TATTRNAME_ID, TATTRNAME_IMPORTANCE, TATTRNAME_INDENTRESULT,
TATTRNAME_LANG, TATTRNAME_LETTERVALUE, TATTRNAME_LEVEL, TATTRNAME_MATCH,
TATTRNAME_METHOD, TATTRNAME_MODE, TATTRNAME_NAME, TATTRNAME_NAMESPACE,
TATTRNAME_NDIGITSPERGROUP, TATTRNAME_NS, TATTRNAME_ONLY, TATTRNAME_ORDER,
TATTRNAME_OUTPUT_CDATA_SECTION_ELEMENTS, TATTRNAME_OUTPUT_DOCTYPE_PUBLIC,
TATTRNAME_OUTPUT_DOCTYPE_SYSTE
M, TATTRNAME_OUTPUT_ENCODING, TATTRNAME_OUTPUT_INDENT,
TATTRNAME_OUTPUT_MEDIATYPE, TATTRNAME_OUTPUT_STANDALONE,
TATTRNAME_OUTPUT_VERSION, TATTRNAME_OUTPUT_OMITXMLDECL, TATTRNAME_PRIORITY,
TATTRNAME_REFID, TATTRNAME_RESULTNS, TATTRNAME_SELECT, TATTRNAME_SEQUENCESRC,
TATTRNAME_STYLE, TATTRNAME_TEST, TATTRNAME_TOSTRING, TATTRNAME_TYPE,
TATTRNAME_USE, TATTRNAME_USEATTRIBUTESETS, TATTRNAME_VALUE, TATTRNAME_XMLNSDEF,
TATTRNAME_XMLNS, TATTRNAME_XMLSPACE, TATTRNAME_EXCLUDE_RESULT_PREFIXES
*/
+ public static final int TATTRNAME_OUTPUT_METHOD = 1, TATTRNAME_AMOUNT = 2,
+ TATTRNAME_ANCESTOR = 3, TATTRNAME_ARCHIVE = 4,
+ TATTRNAME_ATTRIBUTE = 5,
+ TATTRNAME_ATTRIBUTE_SET = 6,
+ TATTRNAME_CASEORDER = 7, TATTRNAME_CLASS = 8,
+ TATTRNAME_CLASSID = 9, TATTRNAME_CODEBASE = 10,
+ TATTRNAME_CODETYPE = 11, TATTRNAME_CONDITION = 12,
+ TATTRNAME_COPYTYPE = 13, TATTRNAME_COUNT = 14,
+ TATTRNAME_DATATYPE = 15, TATTRNAME_DEFAULT = 16,
+ TATTRNAME_DEFAULTSPACE = 17, TATTRNAME_DEPTH = 18,
+ TATTRNAME_DIGITGROUPSEP = 19,
+ TATTRNAME_DISABLE_OUTPUT_ESCAPING = 20,
+ TATTRNAME_ELEMENT = 21, TATTRNAME_ELEMENTS = 22,
+ TATTRNAME_EXPR = 23,
+ TATTRNAME_EXTENSIONELEMENTPREFIXES = 24,
+ TATTRNAME_FORMAT = 25, TATTRNAME_FROM = 26,
+ TATTRNAME_GROUPINGSEPARATOR = 27,
+ TATTRNAME_GROUPINGSIZE = 28, TATTRNAME_HREF = 29,
+ TATTRNAME_ID = 30, TATTRNAME_IMPORTANCE = 31,
+ TATTRNAME_INDENTRESULT = 32, TATTRNAME_LANG = 33,
+ TATTRNAME_LETTERVALUE = 34, TATTRNAME_LEVEL = 35,
+ TATTRNAME_MATCH = 36, TATTRNAME_METHOD = 37,
+ TATTRNAME_MODE = 38, TATTRNAME_NAME = 39,
+ TATTRNAME_NAMESPACE = 40,
+ TATTRNAME_NDIGITSPERGROUP = 41, TATTRNAME_NS = 42,
+ TATTRNAME_ONLY = 43, TATTRNAME_ORDER = 44,
+ TATTRNAME_OUTPUT_CDATA_SECTION_ELEMENTS = 45,
+ TATTRNAME_OUTPUT_DOCTYPE_PUBLIC = 46,
+ TATTRNAME_OUTPUT_DOCTYPE_SYSTEM = 47,
+ TATTRNAME_OUTPUT_ENCODING = 48,
+ TATTRNAME_OUTPUT_INDENT = 49,
+ TATTRNAME_OUTPUT_MEDIATYPE = 50,
+ TATTRNAME_OUTPUT_STANDALONE = 51,
+ TATTRNAME_OUTPUT_VERSION = 52,
+ TATTRNAME_OUTPUT_OMITXMLDECL = 53,
+ TATTRNAME_PRIORITY = 54, TATTRNAME_REFID = 55,
+ TATTRNAME_RESULTNS = 56, TATTRNAME_SELECT = 57,
+ TATTRNAME_SEQUENCESRC = 58, TATTRNAME_STYLE = 59,
+ TATTRNAME_TEST = 60, TATTRNAME_TOSTRING = 61,
+ TATTRNAME_TYPE = 62, TATTRNAME_USE = 63,
+ TATTRNAME_USEATTRIBUTESETS = 64,
+ TATTRNAME_VALUE = 65, TATTRNAME_XMLNSDEF = 66,
+ TATTRNAME_XMLNS = 67, TATTRNAME_XMLSPACE = 68,
+ TATTRNAME_EXCLUDE_RESULT_PREFIXES = 69;
+
+ /** NEEDSDOC Field ATTRVAL_OUTPUT_METHOD_HTML, ATTRVAL_OUTPUT_METHOD_XML,
ATTRVAL_OUTPUT_METHOD_TEXT */
+ public static final String ATTRVAL_OUTPUT_METHOD_HTML = "html",
+ ATTRVAL_OUTPUT_METHOD_XML = "xml",
+ ATTRVAL_OUTPUT_METHOD_TEXT = "text";
+
// For space-att
- public static final int
- ATTRVAL_PRESERVE = 1,
- ATTRVAL_STRIP = 2;
-
+
+ /** NEEDSDOC Field ATTRVAL_PRESERVE, ATTRVAL_STRIP */
+ public static final int ATTRVAL_PRESERVE = 1, ATTRVAL_STRIP = 2;
+
// For indent-result
- public static final boolean
- ATTRVAL_YES = true,
- ATTRVAL_NO = false;
-
+
+ /** NEEDSDOC Field ATTRVAL_YES, ATTRVAL_NO */
+ public static final boolean ATTRVAL_YES = true, ATTRVAL_NO = false;
+
// For letter-value attribute (part of conversion attributes).
- public static final String
- ATTRVAL_ALPHABETIC = "alphabetic",
- ATTRVAL_OTHER = "other",
- ATTRVAL_TRADITIONAL = "traditional";
-
+
+ /** NEEDSDOC Field ATTRVAL_ALPHABETIC, ATTRVAL_OTHER, ATTRVAL_TRADITIONAL
*/
+ public static final String ATTRVAL_ALPHABETIC = "alphabetic",
+ ATTRVAL_OTHER = "other",
+ ATTRVAL_TRADITIONAL = "traditional";
+
// For level attribute in xsl:number.
- public static final String
- ATTRVAL_SINGLE = "single",
- ATTRVAL_MULTI = "multiple",
- ATTRVAL_ANY = "any";
-
+
+ /** NEEDSDOC Field ATTRVAL_SINGLE, ATTRVAL_MULTI, ATTRVAL_ANY */
+ public static final String ATTRVAL_SINGLE = "single",
+ ATTRVAL_MULTI = "multiple", ATTRVAL_ANY = "any";
+
// For Stylesheet-prefix and result-prefix in xsl:namespace-alias
+
+ /** NEEDSDOC Field ATTRVAL_DEFAULT_PREFIX */
public static final String ATTRVAL_DEFAULT_PREFIX = "#default";
-
+
// Integer equivelents for above
- public static final int
- NUMBERLEVEL_SINGLE = 1,
- NUMBERLEVEL_MULTI = 2,
- NUMBERLEVEL_ANY = 3,
- MAX_MULTI_COUNTING_DEPTH = 32;
-
+ /** NEEDSDOC Field NUMBERLEVEL_SINGLE, NUMBERLEVEL_MULTI, NUMBERLEVEL_ANY,
MAX_MULTI_COUNTING_DEPTH */
+ public static final int NUMBERLEVEL_SINGLE = 1, NUMBERLEVEL_MULTI = 2,
+ NUMBERLEVEL_ANY = 3, MAX_MULTI_COUNTING_DEPTH = 32;
+
// some stuff for my patterns-by-example
- public static final String
- ATTRVAL_THIS = ".",
- ATTRVAL_PARENT = "..",
- ATTRVAL_ANCESTOR = "ancestor",
- ATTRVAL_ID = "id";
-
+
+ /** NEEDSDOC Field ATTRVAL_THIS, ATTRVAL_PARENT, ATTRVAL_ANCESTOR,
ATTRVAL_ID */
+ public static final String ATTRVAL_THIS = ".", ATTRVAL_PARENT = "..",
+ ATTRVAL_ANCESTOR = "ancestor", ATTRVAL_ID =
"id";
+
// Stuff for sorting
- public static final String
- ATTRVAL_DATATYPE_TEXT = "text",
- ATTRVAL_DATATYPE_NUMBER = "number",
-
- ATTRVAL_ORDER_ASCENDING = "ascending",
- ATTRVAL_ORDER_DESCENDING = "descending",
-
- ATTRVAL_CASEORDER_UPPER = "upper-first",
- ATTRVAL_CASEORDER_LOWER = "lower-first";
-
+
+ /** NEEDSDOC Field ATTRVAL_DATATYPE_TEXT, ATTRVAL_DATATYPE_NUMBER,
ATTRVAL_ORDER_ASCENDING, ATTRVAL_ORDER_DESCENDING, ATTRVAL_CASEORDER_UPPER,
ATTRVAL_CASEORDER_LOWER */
+ public static final String ATTRVAL_DATATYPE_TEXT = "text",
+ ATTRVAL_DATATYPE_NUMBER = "number",
+ ATTRVAL_ORDER_ASCENDING = "ascending",
+ ATTRVAL_ORDER_DESCENDING = "descending",
+ ATTRVAL_CASEORDER_UPPER = "upper-first",
+ ATTRVAL_CASEORDER_LOWER = "lower-first";
+
// some stuff for Decimal-format
- public static final String
- ATTRVAL_INFINITY = "Infinity",
- ATTRVAL_NAN = "NaN",
- DEFAULT_DECIMAL_FORMAT = "#default";
+
+ /** NEEDSDOC Field ATTRVAL_INFINITY, ATTRVAL_NAN, DEFAULT_DECIMAL_FORMAT
*/
+ public static final String ATTRVAL_INFINITY = "Infinity",
+ ATTRVAL_NAN = "NaN",
+ DEFAULT_DECIMAL_FORMAT = "#default";
// temp dummy
- public static final String ATTRNAME_XXXX = "XXXX";
- public static final String
- ERROR_RESOURCES = "org.apache.xalan.res.XSLTErrorResources",
- XSLT_RESOURCE = "org.apache.xalan.res.XSLTResourceBundle",
- LANG_BUNDLE_NAME = "org.apache.xalan.res.XSLTResources",
- MULT_ORDER = "multiplierOrder",
- MULT_PRECEDES = "precedes",
- MULT_FOLLOWS = "follows",
- LANG_ORIENTATION = "orientation",
- LANG_RIGHTTOLEFT = "rightToLeft",
- LANG_LEFTTORIGHT = "leftToRight",
- LANG_NUMBERING = "numbering",
- LANG_ADDITIVE = "additive",
- LANG_MULT_ADD = "multiplicative-additive",
- LANG_MULTIPLIER = "multiplier",
- LANG_MULTIPLIER_CHAR = "multiplierChar",
- LANG_NUMBERGROUPS = "numberGroups",
- LANG_NUM_TABLES = "tables",
- LANG_ALPHABET = "alphabet",
- LANG_TRAD_ALPHABET = "tradAlphabet";
+ /** NEEDSDOC Field ATTRNAME_XXXX */
+ public static final String ATTRNAME_XXXX = "XXXX";
+ /** NEEDSDOC Field ERROR_RESOURCES, XSLT_RESOURCE, LANG_BUNDLE_NAME,
MULT_ORDER, MULT_PRECEDES, MULT_FOLLOWS, LANG_ORIENTATION, LANG_RIGHTTOLEFT,
LANG_LEFTTORIGHT, LANG_NUMBERING, LANG_ADDITIVE, LANG_MULT_ADD,
LANG_MULTIPLIER, LANG_MULTIPLIER_CHAR, LANG_NUMBERGROUPS, LANG_NUM_TABLES,
LANG_ALPHABET, LANG_TRAD_ALPHABET */
+ public static final String ERROR_RESOURCES =
+ "org.apache.xalan.res.XSLTErrorResources", XSLT_RESOURCE =
+ "org.apache.xalan.res.XSLTResourceBundle", LANG_BUNDLE_NAME =
+ "org.apache.xalan.res.XSLTResources", MULT_ORDER =
+ "multiplierOrder", MULT_PRECEDES = "precedes", MULT_FOLLOWS =
+ "follows", LANG_ORIENTATION = "orientation", LANG_RIGHTTOLEFT =
+ "rightToLeft", LANG_LEFTTORIGHT = "leftToRight", LANG_NUMBERING =
+ "numbering", LANG_ADDITIVE = "additive", LANG_MULT_ADD =
+ "multiplicative-additive", LANG_MULTIPLIER =
+ "multiplier", LANG_MULTIPLIER_CHAR =
+ "multiplierChar", LANG_NUMBERGROUPS = "numberGroups", LANG_NUM_TABLES =
+ "tables", LANG_ALPHABET = "alphabet", LANG_TRAD_ALPHABET =
"tradAlphabet";
}
-
1.5 +143 -84
xml-xalan/java/src/org/apache/xalan/templates/DecimalFormatProperties.java
Index: DecimalFormatProperties.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/DecimalFormatProperties.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- DecimalFormatProperties.java 2000/08/28 18:43:09 1.4
+++ DecimalFormatProperties.java 2000/10/30 18:49:34 1.5
@@ -2,7 +2,7 @@
* The Apache Software License, Version 1.1
*
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -10,7 +10,7 @@
* are met:
*
* 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
+ * notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
@@ -18,7 +18,7 @@
* distribution.
*
* 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
+ * if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
@@ -26,7 +26,7 @@
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
- * software without prior written permission. For written
+ * software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
@@ -57,12 +57,17 @@
package org.apache.xalan.templates;
import org.w3c.dom.*;
+
import org.xml.sax.*;
+
import org.apache.xpath.*;
+
import java.util.*;
+
import java.text.NumberFormat;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
+
import org.apache.xalan.utils.QName;
import org.apache.xalan.res.*;
import org.apache.xalan.transformer.TransformerImpl;
@@ -89,33 +94,43 @@
* @see <a href="http://www.w3.org/TR/xslt#format-number">format-number in
XSLT Specification</a>
*/
public class DecimalFormatProperties
-{
- DecimalFormatSymbols m_dfs;
-
+{
+
+ /** NEEDSDOC Field m_dfs */
+ DecimalFormatSymbols m_dfs;
+
+ /**
+ * Constructor DecimalFormatProperties
+ *
+ */
public DecimalFormatProperties()
{
+
m_dfs = new java.text.DecimalFormatSymbols();
+
// Set default values, they can be overiden if necessary.
m_dfs.setInfinity(Constants.ATTRVAL_INFINITY);
m_dfs.setNaN(Constants.ATTRVAL_NAN);
- }
-
+ }
+
/**
* Return the decimal format Symbols for this element.
- * <p>The xsl:decimal-format element declares a decimal-format,
- * which controls the interpretation of a format pattern used by
- * the format-number function. If there is a name attribute, then
- * the element declares a named decimal-format; otherwise, it
- * declares the default decimal-format. The value of the name
- * attribute is a QName, which is expanded as described in [2.4 Qualified
Names].
- * It is an error to declare either the default decimal-format or a
- * decimal-format with a given name more than once (even with different
- * import precedence), unless it is declared every time with the same
+ * <p>The xsl:decimal-format element declares a decimal-format,
+ * which controls the interpretation of a format pattern used by
+ * the format-number function. If there is a name attribute, then
+ * the element declares a named decimal-format; otherwise, it
+ * declares the default decimal-format. The value of the name
+ * attribute is a QName, which is expanded as described in [2.4 Qualified
Names].
+ * It is an error to declare either the default decimal-format or a
+ * decimal-format with a given name more than once (even with different
+ * import precedence), unless it is declared every time with the same
* value for all attributes (taking into account any default values).</p>
- * <p>The other attributes on xsl:decimal-format correspond to the
- * methods on the JDK 1.1 DecimalFormatSymbols class. For each get/set
- * method pair there is an attribute defined for the xsl:decimal-format
+ * <p>The other attributes on xsl:decimal-format correspond to the
+ * methods on the JDK 1.1 DecimalFormatSymbols class. For each get/set
+ * method pair there is an attribute defined for the xsl:decimal-format
* element.</p>
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public DecimalFormatSymbols getDecimalFormatSymbols()
{
@@ -123,15 +138,17 @@
}
/**
- * If there is a name attribute, then the element declares a named
- * decimal-format; otherwise, it declares the default decimal-format.
+ * If there is a name attribute, then the element declares a named
+ * decimal-format; otherwise, it declares the default decimal-format.
*/
private QName m_qname = null;
-
+
/**
- * Set the "name" attribute.
- * If there is a name attribute, then the element declares a named
- * decimal-format; otherwise, it declares the default decimal-format.
+ * Set the "name" attribute.
+ * If there is a name attribute, then the element declares a named
+ * decimal-format; otherwise, it declares the default decimal-format.
+ *
+ * NEEDSDOC @param qname
*/
public void setName(QName qname)
{
@@ -139,22 +156,27 @@
}
/**
- * Get the "name" attribute.
- * If there is a name attribute, then the element declares a named
- * decimal-format; otherwise, it declares the default decimal-format.
+ * Get the "name" attribute.
+ * If there is a name attribute, then the element declares a named
+ * decimal-format; otherwise, it declares the default decimal-format.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public QName getName()
{
- if (m_qname== null)
+
+ if (m_qname == null)
return new QName("");
else
return m_qname;
}
-
+
/**
- * Set the "decimal-separator" attribute.
- * decimal-separator specifies the character used for the decimal sign;
+ * Set the "decimal-separator" attribute.
+ * decimal-separator specifies the character used for the decimal sign;
* the default value is the period character (.).
+ *
+ * NEEDSDOC @param ds
*/
public void setDecimalSeparator(char ds)
{
@@ -162,19 +184,23 @@
}
/**
- * Get the "decimal-separator" attribute.
- * decimal-separator specifies the character used for the decimal sign;
+ * Get the "decimal-separator" attribute.
+ * decimal-separator specifies the character used for the decimal sign;
* the default value is the period character (.).
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public char getDecimalSeparator()
{
return m_dfs.getDecimalSeparator();
}
-
+
/**
- * Set the "grouping-separator" attribute.
- * grouping-separator specifies the character used as a grouping
+ * Set the "grouping-separator" attribute.
+ * grouping-separator specifies the character used as a grouping
* (e.g. thousands) separator; the default value is the comma character
(,).
+ *
+ * NEEDSDOC @param gs
*/
public void setGroupingSeparator(char gs)
{
@@ -182,19 +208,23 @@
}
/**
- * Get the "grouping-separator" attribute.
- * grouping-separator specifies the character used as a grouping
+ * Get the "grouping-separator" attribute.
+ * grouping-separator specifies the character used as a grouping
* (e.g. thousands) separator; the default value is the comma character
(,).
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public char getGroupingSeparator()
{
return m_dfs.getGroupingSeparator();
}
-
+
/**
- * Set the "infinity" attribute.
- * infinity specifies the string used to represent infinity;
+ * Set the "infinity" attribute.
+ * infinity specifies the string used to represent infinity;
* the default value is the string Infinity.
+ *
+ * NEEDSDOC @param inf
*/
public void setInfinity(String inf)
{
@@ -202,19 +232,23 @@
}
/**
- * Get the "infinity" attribute.
- * infinity specifies the string used to represent infinity;
+ * Get the "infinity" attribute.
+ * infinity specifies the string used to represent infinity;
* the default value is the string Infinity.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public String getInfinity()
{
return m_dfs.getInfinity();
}
-
+
/**
- * Set the "minus-sign" attribute.
- * minus-sign specifies the character used as the default minus sign; the
+ * Set the "minus-sign" attribute.
+ * minus-sign specifies the character used as the default minus sign; the
* default value is the hyphen-minus character (-, #x2D).
+ *
+ * NEEDSDOC @param v
*/
public void setMinusSign(char v)
{
@@ -222,19 +256,23 @@
}
/**
- * Get the "minus-sign" attribute.
- * minus-sign specifies the character used as the default minus sign; the
+ * Get the "minus-sign" attribute.
+ * minus-sign specifies the character used as the default minus sign; the
* default value is the hyphen-minus character (-, #x2D).
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public char getMinusSign()
{
return m_dfs.getMinusSign();
}
-
+
/**
- * Set the "NaN" attribute.
- * NaN specifies the string used to represent the NaN value;
+ * Set the "NaN" attribute.
+ * NaN specifies the string used to represent the NaN value;
* the default value is the string NaN.
+ *
+ * NEEDSDOC @param v
*/
public void setNaN(String v)
{
@@ -242,19 +280,23 @@
}
/**
- * Get the "NaN" attribute.
- * NaN specifies the string used to represent the NaN value;
+ * Get the "NaN" attribute.
+ * NaN specifies the string used to represent the NaN value;
* the default value is the string NaN.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public String getNaN()
{
return m_dfs.getNaN();
}
-
+
/**
- * Set the "percent" attribute.
- * percent specifies the character used as a percent sign; the default
+ * Set the "percent" attribute.
+ * percent specifies the character used as a percent sign; the default
* value is the percent character (%).
+ *
+ * NEEDSDOC @param v
*/
public void setPercent(char v)
{
@@ -262,19 +304,23 @@
}
/**
- * Get the "percent" attribute.
- * percent specifies the character used as a percent sign; the default
+ * Get the "percent" attribute.
+ * percent specifies the character used as a percent sign; the default
* value is the percent character (%).
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public char getPercent()
{
return m_dfs.getPercent();
}
-
+
/**
- * Set the "per-mille" attribute.
- * per-mille specifies the character used as a per mille sign; the default
+ * Set the "per-mille" attribute.
+ * per-mille specifies the character used as a per mille sign; the default
* value is the Unicode per-mille character (#x2030).
+ *
+ * NEEDSDOC @param v
*/
public void setPerMille(char v)
{
@@ -282,19 +328,23 @@
}
/**
- * Get the "per-mille" attribute.
- * per-mille specifies the character used as a per mille sign; the default
+ * Get the "per-mille" attribute.
+ * per-mille specifies the character used as a per mille sign; the default
* value is the Unicode per-mille character (#x2030).
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public char getPerMille()
{
return m_dfs.getPerMill();
}
-
+
/**
- * Set the "zero-digit" attribute.
- * zero-digit specifies the character used as the digit zero; the default
+ * Set the "zero-digit" attribute.
+ * zero-digit specifies the character used as the digit zero; the default
* value is the digit zero (0).
+ *
+ * NEEDSDOC @param v
*/
public void setZeroDigit(char v)
{
@@ -302,19 +352,23 @@
}
/**
- * Get the "zero-digit" attribute.
- * zero-digit specifies the character used as the digit zero; the default
+ * Get the "zero-digit" attribute.
+ * zero-digit specifies the character used as the digit zero; the default
* value is the digit zero (0).
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public char getZeroDigit()
{
return m_dfs.getZeroDigit();
}
-
+
/**
- * Set the "digit" attribute.
- * digit specifies the character used for a digit in the format pattern;
+ * Set the "digit" attribute.
+ * digit specifies the character used for a digit in the format pattern;
* the default value is the number sign character (#).
+ *
+ * NEEDSDOC @param v
*/
public void setDigit(char v)
{
@@ -322,20 +376,24 @@
}
/**
- * Get the "digit" attribute.
- * digit specifies the character used for a digit in the format pattern;
+ * Get the "digit" attribute.
+ * digit specifies the character used for a digit in the format pattern;
* the default value is the number sign character (#).
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public char getDigit()
{
return m_dfs.getDigit();
}
-
+
/**
- * Set the "pattern-separator" attribute.
- * pattern-separator specifies the character used to separate positive
- * and negative sub patterns in a pattern; the default value is the
+ * Set the "pattern-separator" attribute.
+ * pattern-separator specifies the character used to separate positive
+ * and negative sub patterns in a pattern; the default value is the
* semi-colon character (;).
+ *
+ * NEEDSDOC @param v
*/
public void setPatternSeparator(char v)
{
@@ -343,14 +401,15 @@
}
/**
- * Get the "pattern-separator" attribute.
- * pattern-separator specifies the character used to separate positive
- * and negative sub patterns in a pattern; the default value is the
+ * Get the "pattern-separator" attribute.
+ * pattern-separator specifies the character used to separate positive
+ * and negative sub patterns in a pattern; the default value is the
* semi-colon character (;).
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public char getPatternSeparator()
{
return m_dfs.getPatternSeparator();
}
-
}
1.3 +43 -20
xml-xalan/java/src/org/apache/xalan/templates/ElemApplyImport.java
Index: ElemApplyImport.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemApplyImport.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ElemApplyImport.java 2000/08/10 23:30:47 1.2
+++ ElemApplyImport.java 2000/10/30 18:49:35 1.3
@@ -58,7 +58,9 @@
import org.w3c.dom.Node;
import org.w3c.dom.DOMException;
+
import org.xml.sax.SAXException;
+
import org.apache.xalan.res.XSLTErrorResources;
import org.apache.xalan.transformer.TransformerImpl;
import org.apache.xalan.utils.QName;
@@ -73,62 +75,83 @@
*/
public class ElemApplyImport extends ElemTemplateElement
{
+
/**
* Get an int constant identifying the type of element.
* @see org.apache.xalan.templates.Constants
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public int getXSLToken()
{
return Constants.ELEMNAME_APPLY_IMPORTS;
}
-
- /**
+
+ /**
* Return the node name.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public String getNodeName()
{
return Constants.ELEMNAME_APPLY_IMPORTS_STRING;
}
-
+
/**
* Execute the xsl:apply-imports transformation.
+ *
+ * NEEDSDOC @param transformer
+ * NEEDSDOC @param sourceNode
+ * NEEDSDOC @param mode
+ *
+ * @throws SAXException
*/
- public void execute(TransformerImpl transformer,
- Node sourceNode,
- QName mode)
- throws SAXException
+ public void execute(
+ TransformerImpl transformer, Node sourceNode, QName mode)
+ throws SAXException
{
+
if (transformer.currentTemplateRuleIsNull())
{
-
transformer.getMsgMgr().error(XSLTErrorResources.ER_NO_APPLY_IMPORT_IN_FOR_EACH);
//"xsl:apply-imports not allowed in a xsl:for-each");
+ transformer.getMsgMgr().error(
+ XSLTErrorResources.ER_NO_APPLY_IMPORT_IN_FOR_EACH);
//"xsl:apply-imports not allowed in a xsl:for-each");
}
- if(TransformerImpl.S_DEBUG)
+ if (TransformerImpl.S_DEBUG)
transformer.getTraceManager().fireTraceEvent(sourceNode, mode, this);
-
- if(null != sourceNode)
+
+ if (null != sourceNode)
{
+
// This will have to change to current template, (which will have
// to be the top of a current template stack).
-
- transformer.transformNode(this, null, sourceNode, mode);
+ transformer.applyTemplateToNode(this, null, sourceNode, mode);
}
- else // if(null == sourceNode)
+ else // if(null == sourceNode)
{
-
transformer.getMsgMgr().error(XSLTErrorResources.ER_NULL_SOURCENODE_APPLYIMPORTS);
//"sourceNode is null in xsl:apply-imports!");
+ transformer.getMsgMgr().error(
+ XSLTErrorResources.ER_NULL_SOURCENODE_APPLYIMPORTS); //"sourceNode
is null in xsl:apply-imports!");
}
}
-
+
/**
* Add a child to the child list.
* <!ELEMENT xsl:apply-imports EMPTY>
+ *
+ * NEEDSDOC @param newChild
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws DOMException
*/
- public Node appendChild(Node newChild)
- throws DOMException
+ public Node appendChild(Node newChild) throws DOMException
{
- error(XSLTErrorResources.ER_CANNOT_ADD, new Object[]
{newChild.getNodeName(), this.getNodeName()}); //"Can not add "
+((ElemTemplateElement)newChild).m_elemName +
+
+ error(XSLTErrorResources.ER_CANNOT_ADD,
+ new Object[]{ newChild.getNodeName(),
+ this.getNodeName() }); //"Can not add "
+((ElemTemplateElement)newChild).m_elemName +
+
//" to " + this.m_elemName);
return null;
}
-
}
1.4 +96 -50
xml-xalan/java/src/org/apache/xalan/templates/ElemApplyTemplates.java
Index: ElemApplyTemplates.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemApplyTemplates.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ElemApplyTemplates.java 2000/10/06 20:22:54 1.3
+++ ElemApplyTemplates.java 2000/10/30 18:49:35 1.4
@@ -57,14 +57,21 @@
package org.apache.xalan.templates;
import org.w3c.dom.*;
+
import org.xml.sax.*;
+
import org.apache.xpath.*;
+import org.apache.xpath.objects.XObject;
+
import java.util.Vector;
+
import org.apache.xalan.trace.TracerEvent;
import org.apache.xalan.utils.QName;
import org.apache.xalan.res.XSLTErrorResources;
import org.apache.xpath.VariableStack;
import org.apache.xalan.transformer.TransformerImpl;
+import org.apache.xalan.transformer.ResultTreeHandler;
+import org.apache.xalan.transformer.ClonerToResultTree;
/**
* <meta name="usage" content="advanced"/>
@@ -75,18 +82,21 @@
* select %expr; "node()"
* mode %qname; #IMPLIED
* &
- * </pre>
+ * </pre>
* @see <a
href="http://www.w3.org/TR/xslt#section-Applying-Template-Rules">section-Applying-Template-Rules
in XSLT Specification</a>
*/
-public class ElemApplyTemplates extends ElemForEach
+public class ElemApplyTemplates extends ElemCallTemplate
{
+
/**
* mode %qname; #IMPLIED
*/
private QName m_mode = null;
-
+
/**
* Set the mode attribute for this element.
+ *
+ * NEEDSDOC @param mode
*/
public void setMode(QName mode)
{
@@ -95,6 +105,8 @@
/**
* Get the mode attribute for this element.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public QName getMode()
{
@@ -102,18 +114,20 @@
}
/**
- * Tells if this belongs to a default template,
- * in which case it will act different with
+ * Tells if this belongs to a default template,
+ * in which case it will act different with
* regard to processing modes.
* @see <a href="http://www.w3.org/TR/xslt#built-in-rule">built-in-rule in
XSLT Specification</a>
*/
private boolean m_isDefaultTemplate = false;
-
+
/**
- * Set if this belongs to a default template,
- * in which case it will act different with
+ * Set if this belongs to a default template,
+ * in which case it will act different with
* regard to processing modes.
* @see <a href="http://www.w3.org/TR/xslt#built-in-rule">built-in-rule in
XSLT Specification</a>
+ *
+ * NEEDSDOC @param b
*/
public void setIsDefaultTemplate(boolean b)
{
@@ -123,14 +137,18 @@
/**
* Get an int constant identifying the type of element.
* @see org.apache.xalan.templates.Constants
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public int getXSLToken()
{
return Constants.ELEMNAME_APPLY_TEMPLATES;
}
-
- /**
+
+ /**
* Return the node name.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public String getNodeName()
{
@@ -140,63 +158,91 @@
/**
* Apply the context node to the matching templates.
* @see <a
href="http://www.w3.org/TR/xslt#section-Applying-Template-Rules">section-Applying-Template-Rules
in XSLT Specification</a>
- */
- public void execute(TransformerImpl transformer,
- Node sourceNode,
- QName mode)
- throws SAXException
- {
+ *
+ * NEEDSDOC @param transformer
+ * NEEDSDOC @param sourceNode
+ * NEEDSDOC @param mode
+ *
+ * @throws SAXException
+ */
+ public void execute(
+ TransformerImpl transformer, Node sourceNode, QName mode)
+ throws SAXException
+ {
+
transformer.pushCurrentTemplateRuleIsNull(false);
try
{
- if(TransformerImpl.S_DEBUG)
+ if (TransformerImpl.S_DEBUG)
transformer.getTraceManager().fireTraceEvent(sourceNode, mode, this);
-
- if(null != sourceNode)
- {
+
+ if (null != sourceNode)
+ {
+
// boolean needToTurnOffInfiniteLoopCheck = false;
-
- if(!m_isDefaultTemplate)
+ if (!m_isDefaultTemplate)
{
mode = m_mode;
}
- VariableStack vars = transformer.getXPathContext().getVarStack();
- int selectStackFrameIndex = vars.getCurrentStackFrameIndex();
-
- // This call will cause a context marker to be pushed into the stack
- transformer.pushParams(getStylesheet(),
- this,
- sourceNode, mode);
- vars.setCurrentStackFrameIndex(vars.size());
-
- try
- {
- XPath xpath = getSelect();
- transformer.transformSelectedNodes(getStylesheetComposed(),
- this,
- null,
- sourceNode, mode,
- getSelect(),
- selectStackFrameIndex);
- }
- finally
- {
- vars.popCurrentContext();
- vars.setCurrentStackFrameIndex(selectStackFrameIndex);
- }
+ transformSelectedNodes(transformer, sourceNode, null, mode);
}
- else // if(null == sourceNode)
+ else // if(null == sourceNode)
{
-
transformer.getMsgMgr().error(XSLTErrorResources.ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES);//"sourceNode
is null in handleApplyTemplatesInstruction!");
+ transformer.getMsgMgr().error(
+ XSLTErrorResources.ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES);
//"sourceNode is null in handleApplyTemplatesInstruction!");
}
}
-
finally
{
transformer.popCurrentTemplateRuleIsNull();
}
+ }
+
+ /**
+ * NEEDSDOC Method needToPushParams
+ *
+ *
+ * NEEDSDOC (needToPushParams) @return
+ */
+ boolean needToPushParams()
+ {
+ return true;
+ }
+
+ /**
+ * NEEDSDOC Method pushParams
+ *
+ *
+ * NEEDSDOC @param transformer
+ * NEEDSDOC @param xctxt
+ * NEEDSDOC @param sourceNode
+ * NEEDSDOC @param mode
+ *
+ * @throws SAXException
+ */
+ void pushParams(
+ TransformerImpl transformer, XPathContext xctxt, Node sourceNode,
QName mode)
+ throws SAXException
+ {
+
+ VariableStack vars = xctxt.getVarStack();
+
+ if (null != m_paramElems)
+ transformer.pushParams(xctxt, this, sourceNode, mode);
+ else
+ vars.pushContextMarker();
+ }
- }
+ /**
+ * NEEDSDOC Method popParams
+ *
+ *
+ * NEEDSDOC @param xctxt
+ */
+ void popParams(XPathContext xctxt)
+ {
+ xctxt.getVarStack().popCurrentContext();
+ }
}
1.6 +122 -68
xml-xalan/java/src/org/apache/xalan/templates/ElemAttribute.java
Index: ElemAttribute.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemAttribute.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ElemAttribute.java 2000/10/17 19:02:02 1.5
+++ ElemAttribute.java 2000/10/30 18:49:35 1.6
@@ -58,7 +58,9 @@
import org.w3c.dom.Node;
import org.w3c.dom.DOMException;
+
import org.xml.sax.SAXException;
+
import org.apache.xalan.utils.QName;
import org.apache.xalan.res.XSLTErrorResources;
import org.apache.xalan.res.XSLMessages;
@@ -71,28 +73,31 @@
* Implement xsl:attribute.
* <pre>
* &!ELEMENT xsl:attribute %char-template;>
- * &!ATTLIST xsl:attribute
+ * &!ATTLIST xsl:attribute
* name %avt; #REQUIRED
* namespace %avt; #IMPLIED
* %space-att;
* &
* </pre>
- * @see <a
href="http://www.w3.org/TR/xslt#creating-attributes">creating-attributes in
XSLT Specification</a>
+ * @see <a
href="http://www.w3.org/TR/xslt#creating-attributes">creating-attributes in
XSLT Specification</a>
*/
public class ElemAttribute extends ElemTemplateElement
{
+
/**
* The local name which should be used.
*/
public AVT m_name_avt = null;
-
+
/**
* The namespace which should be used.
*/
public AVT m_namespace_avt = null;
-
+
/**
* Set the "name" attribute.
+ *
+ * NEEDSDOC @param name
*/
public void setName(AVT name)
{
@@ -101,6 +106,8 @@
/**
* Get the "name" attribute.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public AVT getName()
{
@@ -109,6 +116,8 @@
/**
* Set the "namespace" attribute.
+ *
+ * NEEDSDOC @param name
*/
public void setNamespace(AVT name)
{
@@ -117,6 +126,8 @@
/**
* Get the "namespace" attribute.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public AVT getNamespace()
{
@@ -126,165 +137,208 @@
/**
* Get an int constant identifying the type of element.
* @see org.apache.xalan.templates.Constants
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public int getXSLToken()
{
return Constants.ELEMNAME_ATTRIBUTE;
}
-
- /**
+
+ /**
* Return the node name.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public String getNodeName()
{
return Constants.ELEMNAME_ATTRIBUTE_STRING;
}
-
+
/**
* Create an attribute in the result tree.
* @see <a
href="http://www.w3.org/TR/xslt#creating-attributes">creating-attributes in
XSLT Specification</a>
+ *
+ * NEEDSDOC @param transformer
+ * NEEDSDOC @param sourceNode
+ * NEEDSDOC @param mode
+ *
+ * @throws SAXException
*/
- public void execute(TransformerImpl transformer,
- Node sourceNode,
- QName mode)
- throws SAXException
+ public void execute(
+ TransformerImpl transformer, Node sourceNode, QName mode)
+ throws SAXException
{
- if(TransformerImpl.S_DEBUG)
+
+ if (TransformerImpl.S_DEBUG)
transformer.getTraceManager().fireTraceEvent(sourceNode, mode, this);
-
+
ResultTreeHandler rhandler = transformer.getResultTreeHandler();
XPathContext xctxt = transformer.getXPathContext();
-
+
// The attribute name has to be evaluated as an AVT.
String attrName = m_name_avt.evaluate(xctxt, sourceNode, this);
- String origAttrName = attrName; // save original attribute name
-
+ String origAttrName = attrName; // save original attribute name
+
// Get the children of the xsl:attribute element as the string value.
String val = transformer.transformToString(this, sourceNode, mode);
// If they are trying to add an attribute when there isn't an
// element pending, it is an error.
- if(!rhandler.isElementPending())
+ if (!rhandler.isElementPending())
{
-
transformer.getMsgMgr().warn(XSLTErrorResources.WG_ILLEGAL_ATTRIBUTE_NAME, new
Object[]{origAttrName});
+ transformer.getMsgMgr().warn(
+ XSLTErrorResources.WG_ILLEGAL_ATTRIBUTE_NAME,
+ new Object[]{ origAttrName });
+
return;
+
// warn(templateChild, sourceNode, "Trying to add attribute after
element child has been added, ignoring...");
}
+
+ if (null == attrName)
+ return;
+
+ String attrNameSpace = null; // by default
- if(null == attrName)
- return;
-
- String attrNameSpace = null; // by default
-
// Did they declare a namespace attribute?
- if(null != m_namespace_avt)
+ if (null != m_namespace_avt)
{
+
// The namespace attribute is an AVT also.
attrNameSpace = m_namespace_avt.evaluate(xctxt, sourceNode, this);
- if(null != attrNameSpace && attrNameSpace.length()>0)
+
+ if (null != attrNameSpace && attrNameSpace.length() > 0)
{
+
// Get the prefix for that attribute in the result namespace.
String prefix = rhandler.getPrefix(attrNameSpace);
-
+
// If we didn't find the prefix mapping, make up a prefix
// and have it declared in the result tree.
- if(null == prefix)
+ if (null == prefix)
{
prefix = rhandler.getNewUniqueNSPrefix();
+
rhandler.startPrefixMapping(prefix, attrNameSpace, false);
}
+
// add the prefix to the attribute name.
- attrName = (prefix + ":"+QName.getLocalPart(attrName));
+ attrName = (prefix + ":" + QName.getLocalPart(attrName));
}
}
+
// Is the attribute xmlns type?
- else if(QName.isXMLNSDecl(origAttrName))
+ else if (QName.isXMLNSDecl(origAttrName))
{
+
// Then just declare the namespace prefix and get out.
String prefix = QName.getPrefixFromXMLNSDecl(origAttrName);
String ns = rhandler.getURI(prefix);
- if(null == ns)
+
+ if (null == ns)
rhandler.startPrefixMapping(prefix, val, false);
+
return;
}
+
// Note we are using original attribute name for these tests.
else
{
+
// Does the attribute name have a prefix?
String nsprefix = QName.getPrefixPart(origAttrName);
- if(null == nsprefix)
+
+ if (null == nsprefix)
nsprefix = "";
-
+
// We're going to claim that this must be resolved in
// the result tree namespace.
try
{
attrNameSpace = getNamespaceForPrefix(nsprefix);
- if((null == attrNameSpace) && (nsprefix.length() > 0))
+
+ if ((null == attrNameSpace) && (nsprefix.length() > 0))
{
-
transformer.getMsgMgr().warn(XSLTErrorResources.WG_COULD_NOT_RESOLVE_PREFIX,
new Object[]{nsprefix});
+ transformer.getMsgMgr().warn(
+ XSLTErrorResources.WG_COULD_NOT_RESOLVE_PREFIX,
+ new Object[]{ nsprefix });
+
return;
}
}
- catch(Exception ex)
+ catch (Exception ex)
{
+
// Could not resolve prefix
attrNameSpace = null;
-
transformer.getMsgMgr().warn(XSLTErrorResources.WG_COULD_NOT_RESOLVE_PREFIX,
new Object[]{nsprefix});
+
+ transformer.getMsgMgr().warn(
+ XSLTErrorResources.WG_COULD_NOT_RESOLVE_PREFIX,
+ new Object[]{ nsprefix });
+
return;
}
}
-
+
String localName = QName.getLocalPart(attrName);
- rhandler.addAttribute(attrNameSpace, localName,
- attrName, "CDATA", val);
-
+
+ rhandler.addAttribute(attrNameSpace, localName, attrName, "CDATA", val);
}
-
+
/**
* Add a child to the child list.
* <!ELEMENT xsl:attribute %char-template;>
- * <!ATTLIST xsl:attribute
+ * <!ATTLIST xsl:attribute
* name %avt; #REQUIRED
* namespace %avt; #IMPLIED
* %space-att;
* >
+ *
+ * NEEDSDOC @param newChild
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws DOMException
*/
- public Node appendChild(Node newChild)
- throws DOMException
+ public Node appendChild(Node newChild) throws DOMException
{
- int type = ((ElemTemplateElement)newChild).getXSLToken();
- switch(type)
+
+ int type = ((ElemTemplateElement) newChild).getXSLToken();
+
+ switch (type)
{
- // char-instructions
- case Constants.ELEMNAME_TEXTLITERALRESULT:
- case Constants.ELEMNAME_APPLY_TEMPLATES:
- case Constants.ELEMNAME_APPLY_IMPORTS:
- case Constants.ELEMNAME_CALLTEMPLATE:
- case Constants.ELEMNAME_FOREACH:
- case Constants.ELEMNAME_VALUEOF:
- case Constants.ELEMNAME_COPY_OF:
- case Constants.ELEMNAME_NUMBER:
- case Constants.ELEMNAME_CHOOSE:
- case Constants.ELEMNAME_IF:
- case Constants.ELEMNAME_TEXT:
- case Constants.ELEMNAME_COPY:
- case Constants.ELEMNAME_VARIABLE:
- case Constants.ELEMNAME_MESSAGE:
-
+
+ // char-instructions
+ case Constants.ELEMNAME_TEXTLITERALRESULT :
+ case Constants.ELEMNAME_APPLY_TEMPLATES :
+ case Constants.ELEMNAME_APPLY_IMPORTS :
+ case Constants.ELEMNAME_CALLTEMPLATE :
+ case Constants.ELEMNAME_FOREACH :
+ case Constants.ELEMNAME_VALUEOF :
+ case Constants.ELEMNAME_COPY_OF :
+ case Constants.ELEMNAME_NUMBER :
+ case Constants.ELEMNAME_CHOOSE :
+ case Constants.ELEMNAME_IF :
+ case Constants.ELEMNAME_TEXT :
+ case Constants.ELEMNAME_COPY :
+ case Constants.ELEMNAME_VARIABLE :
+ case Constants.ELEMNAME_MESSAGE :
+
// instructions
// case Constants.ELEMNAME_PI:
// case Constants.ELEMNAME_COMMENT:
// case Constants.ELEMNAME_ELEMENT:
// case Constants.ELEMNAME_ATTRIBUTE:
-
break;
-
- default:
- error(XSLTErrorResources.ER_CANNOT_ADD, new Object[]
{newChild.getNodeName(), this.getNodeName()}); //"Can not add "
+((ElemTemplateElement)newChild).m_elemName +
- //" to " + this.m_elemName);
+ default :
+ error(XSLTErrorResources.ER_CANNOT_ADD,
+ new Object[]{ newChild.getNodeName(),
+ this.getNodeName() }); //"Can not add "
+((ElemTemplateElement)newChild).m_elemName +
+
+ //" to " + this.m_elemName);
}
+
return super.appendChild(newChild);
}
-
}
1.2 +64 -31
xml-xalan/java/src/org/apache/xalan/templates/ElemAttributeSet.java
Index: ElemAttributeSet.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemAttributeSet.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ElemAttributeSet.java 2000/06/19 16:52:48 1.1
+++ ElemAttributeSet.java 2000/10/30 18:49:39 1.2
@@ -58,11 +58,15 @@
import org.w3c.dom.Node;
import org.w3c.dom.DOMException;
+
import org.xml.sax.SAXException;
+
import org.apache.xalan.utils.QName;
import org.apache.xalan.res.XSLTErrorResources;
import org.apache.xalan.res.XSLMessages;
+
import java.util.Stack;
+
import org.apache.xalan.transformer.TransformerImpl;
/**
@@ -79,14 +83,17 @@
*/
public class ElemAttributeSet extends ElemUse
{
+
/**
- * The name attribute specifies the name of the attribute set.
+ * The name attribute specifies the name of the attribute set.
*/
public QName m_qname = null;
-
+
/**
- * Set the "name" attribute.
- * The name attribute specifies the name of the attribute set.
+ * Set the "name" attribute.
+ * The name attribute specifies the name of the attribute set.
+ *
+ * NEEDSDOC @param name
*/
public void setName(QName name)
{
@@ -95,7 +102,9 @@
/**
* Get the "name" attribute.
- * The name attribute specifies the name of the attribute set.
+ * The name attribute specifies the name of the attribute set.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public QName getName()
{
@@ -105,46 +114,61 @@
/**
* Get an int constant identifying the type of element.
* @see org.apache.xalan.templates.Constants
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public int getXSLToken()
{
return Constants.ELEMNAME_DEFINEATTRIBUTESET;
}
-
- /**
+
+ /**
* Return the node name.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public String getNodeName()
{
return Constants.ELEMNAME_ATTRIBUTESET_STRING;
}
-
/**
* Apply a set of attributes to the element.
- */
- public void execute(TransformerImpl transformer,
- Node sourceNode,
- QName mode)
- throws SAXException
+ *
+ * NEEDSDOC @param transformer
+ * NEEDSDOC @param sourceNode
+ * NEEDSDOC @param mode
+ *
+ * @throws SAXException
+ */
+ public void execute(
+ TransformerImpl transformer, Node sourceNode, QName mode)
+ throws SAXException
{
- if(transformer.isRecursiveAttrSet(this))
+
+ if (transformer.isRecursiveAttrSet(this))
{
- throw new
SAXException(XSLMessages.createMessage(XSLTErrorResources.ER_XSLATTRSET_USED_ITSELF,
new Object[]{m_qname.getLocalPart()})); //"xsl:attribute-set
'"+m_qname.m_localpart+
+ throw new SAXException(
+ XSLMessages.createMessage(
+ XSLTErrorResources.ER_XSLATTRSET_USED_ITSELF,
+ new Object[]{ m_qname.getLocalPart() })); //"xsl:attribute-set
'"+m_qname.m_localpart+
}
-
+
transformer.pushElemAttributeSet(this);
-
super.execute(transformer, sourceNode, mode);
- ElemAttribute attr = (ElemAttribute)getFirstChild();
- while(null != attr)
+
+ ElemAttribute attr = (ElemAttribute) getFirstChild();
+
+ while (null != attr)
{
attr.execute(transformer, sourceNode, mode);
- attr = (ElemAttribute)attr.getNextSibling();
+
+ attr = (ElemAttribute) attr.getNextSibling();
}
+
transformer.popElemAttributeSet();
}
-
+
/**
* Add a child to the child list.
* <!ELEMENT xsl:attribute-set (xsl:attribute)*>
@@ -152,21 +176,30 @@
* name %qname; #REQUIRED
* use-attribute-sets %qnames; #IMPLIED
* >
+ *
+ * NEEDSDOC @param newChild
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws DOMException
*/
- public Node appendChild(Node newChild)
- throws DOMException
+ public Node appendChild(Node newChild) throws DOMException
{
- int type = ((ElemTemplateElement)newChild).getXSLToken();
- switch(type)
+
+ int type = ((ElemTemplateElement) newChild).getXSLToken();
+
+ switch (type)
{
- case Constants.ELEMNAME_ATTRIBUTE:
+ case Constants.ELEMNAME_ATTRIBUTE :
break;
-
- default:
- error(XSLTErrorResources.ER_CANNOT_ADD, new Object[]
{newChild.getNodeName(), this.getNodeName()}); //"Can not add "
+((ElemTemplateElement)newChild).m_elemName +
- //" to " + this.m_elemName);
+ default :
+ error(XSLTErrorResources.ER_CANNOT_ADD,
+ new Object[]{ newChild.getNodeName(),
+ this.getNodeName() }); //"Can not add "
+((ElemTemplateElement)newChild).m_elemName +
+
+ //" to " + this.m_elemName);
}
+
return super.appendChild(newChild);
}
-
}
1.5 +114 -46
xml-xalan/java/src/org/apache/xalan/templates/ElemCallTemplate.java
Index: ElemCallTemplate.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemCallTemplate.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ElemCallTemplate.java 2000/10/06 20:22:55 1.4
+++ ElemCallTemplate.java 2000/10/30 18:49:40 1.5
@@ -56,8 +56,12 @@
*/
package org.apache.xalan.templates;
+import java.util.Vector;
+
import org.w3c.dom.*;
+
import org.xml.sax.*;
+
import org.apache.xpath.*;
import org.apache.xalan.utils.QName;
import org.apache.xalan.res.XSLTErrorResources;
@@ -75,18 +79,21 @@
* </pre>
* @see <a href="http://www.w3.org/TR/xslt#named-templates">named-templates
in XSLT Specification</a>
*/
-public class ElemCallTemplate extends ElemTemplateElement
+public class ElemCallTemplate extends ElemForEach
{
+
/**
- * An xsl:call-template element invokes a template by name;
- * it has a required name attribute that identifies the template to be
invoked.
+ * An xsl:call-template element invokes a template by name;
+ * it has a required name attribute that identifies the template to be
invoked.
*/
public QName m_templateName = null;
-
+
/**
- * Set the "name" attribute.
- * An xsl:call-template element invokes a template by name;
- * it has a required name attribute that identifies the template to be
invoked.
+ * Set the "name" attribute.
+ * An xsl:call-template element invokes a template by name;
+ * it has a required name attribute that identifies the template to be
invoked.
+ *
+ * NEEDSDOC @param name
*/
public void setName(QName name)
{
@@ -95,8 +102,10 @@
/**
* Get the "name" attribute.
- * An xsl:call-template element invokes a template by name;
- * it has a required name attribute that identifies the template to be
invoked.
+ * An xsl:call-template element invokes a template by name;
+ * it has a required name attribute that identifies the template to be
invoked.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public QName getName()
{
@@ -107,18 +116,22 @@
* The template which is named by QName.
*/
private ElemTemplateElement m_template = null;
-
+
/**
* Get an int constant identifying the type of element.
* @see org.apache.xalan.templates.Constants
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public int getXSLToken()
{
return Constants.ELEMNAME_CALLTEMPLATE;
}
-
- /**
+
+ /**
* Return the node name.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public String getNodeName()
{
@@ -128,37 +141,45 @@
/**
* Invoke a named template.
* @see <a
href="http://www.w3.org/TR/xslt#named-templates">named-templates in XSLT
Specification</a>
- */
- public void execute(TransformerImpl transformer,
- Node sourceNode,
- QName mode)
- throws SAXException
+ *
+ * NEEDSDOC @param transformer
+ * NEEDSDOC @param sourceNode
+ * NEEDSDOC @param mode
+ *
+ * @throws SAXException
+ */
+ public void execute(
+ TransformerImpl transformer, Node sourceNode, QName mode)
+ throws SAXException
{
- if(TransformerImpl.S_DEBUG)
+
+ if (TransformerImpl.S_DEBUG)
transformer.getTraceManager().fireTraceEvent(sourceNode, mode, this);
-
- // XPathContext xctxt = transformer.getXPathContext();
- if(null == m_template)
+
+ if (null == m_template)
{
- m_template
- = this.getStylesheetRoot().getTemplateComposed(m_templateName);
+ m_template =
+ this.getStylesheetRoot().getTemplateComposed(m_templateName);
}
-
- if(null != m_template)
+
+ if (null != m_template)
{
XPathContext xctxt = transformer.getXPathContext();
VariableStack vars = xctxt.getVarStack();
- // int selectStackFrameIndex = vars.getCurrentStackFrameIndex();
-
- transformer.pushParams(getStylesheet(),
- this, sourceNode, mode);
- vars.setCurrentStackFrameIndex(vars.size());
+
+ if (null != m_paramElems)
+ transformer.pushParams(xctxt, this, sourceNode, mode);
+ else
+ vars.pushContextMarker();
+
Locator savedLocator = xctxt.getSAXLocator();
+
try
- {
+ {
xctxt.setSAXLocator(m_template);
+
// template.executeChildTemplates(transformer, sourceNode, mode);
- transformer.pushElemTemplateElement(m_template, sourceNode);
+ transformer.pushElemTemplateElement(m_template);
m_template.execute(transformer, sourceNode, mode);
}
finally
@@ -166,32 +187,79 @@
transformer.popElemTemplateElement();
xctxt.setSAXLocator(savedLocator);
vars.popCurrentContext();
- // vars.setCurrentStackFrameIndex(selectStackFrameIndex);
}
}
else
{
-
transformer.getMsgMgr().error(XSLTErrorResources.ER_TEMPLATE_NOT_FOUND, new
Object[] {m_templateName}); //"Could not find template named:
'"+templateName+"'");
+ transformer.getMsgMgr().error(XSLTErrorResources.ER_TEMPLATE_NOT_FOUND,
+ new Object[]{ m_templateName });
//"Could not find template named: '"+templateName+"'");
}
+ }
+
+ /** NEEDSDOC Field m_paramElems */
+ protected Vector m_paramElems = null;
+
+ /**
+ * Get the count xsl:sort elements associated with this element.
+ * @return The number of xsl:sort elements.
+ */
+ public int getParamElemCount()
+ {
+ return (m_paramElems == null) ? 0 : m_paramElems.size();
+ }
+
+ /**
+ * Get a xsl:sort element associated with this element.
+ *
+ * NEEDSDOC @param i
+ *
+ * NEEDSDOC ($objectName$) @return
+ */
+ public ElemWithParam getParamElem(int i)
+ {
+ return (ElemWithParam) m_paramElems.elementAt(i);
+ }
+
+ /**
+ * Set a xsl:sort element associated with this element.
+ *
+ * NEEDSDOC @param ParamElem
+ */
+ public void setParamElem(ElemWithParam ParamElem)
+ {
+
+ if (null == m_paramElems)
+ m_paramElems = new Vector();
+
+ m_paramElems.addElement(ParamElem);
}
-
+
/**
* Add a child to the child list.
+ * <!ELEMENT xsl:apply-templates (xsl:sort|xsl:with-param)*>
+ * <!ATTLIST xsl:apply-templates
+ * select %expr; "node()"
+ * mode %qname; #IMPLIED
+ * >
+ *
+ * NEEDSDOC @param newChild
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws DOMException
*/
- public Node appendChild(Node newChild)
- throws DOMException
+ public Node appendChild(Node newChild) throws DOMException
{
- int type = ((ElemTemplateElement)newChild).getXSLToken();
- switch(type)
+
+ int type = ((ElemTemplateElement) newChild).getXSLToken();
+
+ if (Constants.ELEMNAME_WITHPARAM == type)
{
- case Constants.ELEMNAME_WITHPARAM:
- break;
-
- default:
- error(XSLTErrorResources.ER_CANNOT_ADD, new Object[]
{newChild.getNodeName(), this.getNodeName()}); //"Can not add "
+((ElemTemplateElement)newChild).m_elemName +
- //" to " + this.m_elemName);
+ setParamElem((ElemWithParam) newChild);
}
+
+ // You still have to append, because this element can
+ // contain a for-each, and other elements.
return super.appendChild(newChild);
}
-
}
1.3 +79 -42
xml-xalan/java/src/org/apache/xalan/templates/ElemChoose.java
Index: ElemChoose.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemChoose.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ElemChoose.java 2000/07/05 14:39:58 1.2
+++ ElemChoose.java 2000/10/30 18:49:40 1.3
@@ -57,7 +57,9 @@
package org.apache.xalan.templates;
import org.w3c.dom.*;
+
import org.xml.sax.*;
+
import org.apache.xpath.*;
import org.apache.xpath.objects.XObject;
import org.apache.xalan.trace.SelectionEvent;
@@ -75,91 +77,126 @@
* @see <a
href="http://www.w3.org/TR/xslt#section-Conditional-Processing-with-xsl:choose">XXX
in XSLT Specification</a>
*/
public class ElemChoose extends ElemTemplateElement
-{
+{
+
/**
* Get an int constant identifying the type of element.
* @see org.apache.xalan.templates.Constants
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public int getXSLToken()
{
return Constants.ELEMNAME_CHOOSE;
}
-
- /**
+
+ /**
* Return the node name.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public String getNodeName()
{
return Constants.ELEMNAME_CHOOSE_STRING;
}
-
- public ElemChoose()
+
+ /**
+ * Constructor ElemChoose
+ *
+ */
+ public ElemChoose(){}
+
+ /**
+ * NEEDSDOC Method execute
+ *
+ *
+ * NEEDSDOC @param transformer
+ * NEEDSDOC @param sourceNode
+ * NEEDSDOC @param mode
+ *
+ * @throws SAXException
+ */
+ public void execute(
+ TransformerImpl transformer, Node sourceNode, QName mode)
+ throws SAXException
{
- }
- public void execute(TransformerImpl transformer,
- Node sourceNode,
- QName mode)
- throws SAXException
- {
- if(TransformerImpl.S_DEBUG)
+ if (TransformerImpl.S_DEBUG)
transformer.getTraceManager().fireTraceEvent(sourceNode, mode, this);
-
+
boolean found = false;
- for (ElemTemplateElement childElem = getFirstChildElem();
- childElem != null; childElem = childElem.getNextSiblingElem())
+
+ for (ElemTemplateElement childElem = getFirstChildElem();
+ childElem != null; childElem = childElem.getNextSiblingElem())
{
int type = childElem.getXSLToken();
- if(Constants.ELEMNAME_WHEN == type)
+
+ if (Constants.ELEMNAME_WHEN == type)
{
- found = true;
- ElemWhen when = (ElemWhen)childElem;
+ found = true;
+
+ ElemWhen when = (ElemWhen) childElem;
+
// must be xsl:when
-
- XObject test = when.getTest().execute(transformer.getXPathContext(),
- sourceNode, this);
- if(TransformerImpl.S_DEBUG)
- transformer.getTraceManager().fireSelectedEvent(sourceNode,
- when, "test",
- when.getTest(), test);
+ XObject test = when.getTest().execute(transformer.getXPathContext(),
+ sourceNode, this);
+
+ if (TransformerImpl.S_DEBUG)
+ transformer.getTraceManager().fireSelectedEvent(sourceNode, when,
+ "test", when.getTest(), test);
- if((null != test) && test.bool())
+ if ((null != test) && test.bool())
{
transformer.executeChildTemplates(when, sourceNode, mode);
+
return;
}
}
- else if(Constants.ELEMNAME_OTHERWISE == type)
+ else if (Constants.ELEMNAME_OTHERWISE == type)
{
found = true;
- // xsl:otherwise
+
+ // xsl:otherwise
transformer.executeChildTemplates(childElem, sourceNode, mode);
+
return;
}
}
- if(!found)
-
transformer.getMsgMgr().error(XSLTErrorResources.ER_CHOOSE_REQUIRES_WHEN);
+
+ if (!found)
+ transformer.getMsgMgr().error(
+ XSLTErrorResources.ER_CHOOSE_REQUIRES_WHEN);
}
-
+
/**
* Add a child to the child list.
+ *
+ * NEEDSDOC @param newChild
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws DOMException
*/
- public Node appendChild(Node newChild)
- throws DOMException
+ public Node appendChild(Node newChild) throws DOMException
{
- int type = ((ElemTemplateElement)newChild).getXSLToken();
- switch(type)
+
+ int type = ((ElemTemplateElement) newChild).getXSLToken();
+
+ switch (type)
{
- case Constants.ELEMNAME_WHEN:
- case Constants.ELEMNAME_OTHERWISE:
+ case Constants.ELEMNAME_WHEN :
+ case Constants.ELEMNAME_OTHERWISE :
+
// TODO: Positional checking
break;
-
- default:
- error(XSLTErrorResources.ER_CANNOT_ADD, new Object[]
{newChild.getNodeName(), this.getNodeName()}); //"Can not add "
+((ElemTemplateElement)newChild).m_elemName +
- //" to " + this.m_elemName);
+ default :
+ error(XSLTErrorResources.ER_CANNOT_ADD,
+ new Object[]{ newChild.getNodeName(),
+ this.getNodeName() }); //"Can not add "
+((ElemTemplateElement)newChild).m_elemName +
+
+ //" to " + this.m_elemName);
}
+
return super.appendChild(newChild);
}
-
}
1.3 +64 -36
xml-xalan/java/src/org/apache/xalan/templates/ElemComment.java
Index: ElemComment.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemComment.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ElemComment.java 2000/07/05 14:39:58 1.2
+++ ElemComment.java 2000/10/30 18:49:41 1.3
@@ -57,7 +57,9 @@
package org.apache.xalan.templates;
import org.w3c.dom.*;
+
import org.xml.sax.*;
+
import org.apache.xpath.*;
import org.apache.xalan.utils.QName;
import org.apache.xalan.res.XSLTErrorResources;
@@ -74,31 +76,46 @@
*/
public class ElemComment extends ElemTemplateElement
{
+
/**
* Get an int constant identifying the type of element.
* @see org.apache.xalan.templates.Constants
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public int getXSLToken()
{
return Constants.ELEMNAME_COMMENT;
}
-
- /**
+
+ /**
* Return the node name.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public String getNodeName()
{
return Constants.ELEMNAME_COMMENT_STRING;
}
-
- public void execute(TransformerImpl transformer,
- Node sourceNode,
- QName mode)
- throws SAXException
- {
- if(TransformerImpl.S_DEBUG)
+
+ /**
+ * NEEDSDOC Method execute
+ *
+ *
+ * NEEDSDOC @param transformer
+ * NEEDSDOC @param sourceNode
+ * NEEDSDOC @param mode
+ *
+ * @throws SAXException
+ */
+ public void execute(
+ TransformerImpl transformer, Node sourceNode, QName mode)
+ throws SAXException
+ {
+
+ if (TransformerImpl.S_DEBUG)
transformer.getTraceManager().fireTraceEvent(sourceNode, mode, this);
-
+
// Note the content model is:
// <!ENTITY % instructions "
// %char-instructions;
@@ -108,46 +125,57 @@
// | xsl:attribute
// ">
String data = transformer.transformToString(this, sourceNode, mode);
+
transformer.getResultTreeHandler().comment(data);
}
-
+
/**
* Add a child to the child list.
+ *
+ * NEEDSDOC @param newChild
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws DOMException
*/
- public Node appendChild(Node newChild)
- throws DOMException
+ public Node appendChild(Node newChild) throws DOMException
{
- int type = ((ElemTemplateElement)newChild).getXSLToken();
- switch(type)
+
+ int type = ((ElemTemplateElement) newChild).getXSLToken();
+
+ switch (type)
{
- // char-instructions
- case Constants.ELEMNAME_TEXTLITERALRESULT:
- case Constants.ELEMNAME_APPLY_TEMPLATES:
- case Constants.ELEMNAME_APPLY_IMPORTS:
- case Constants.ELEMNAME_CALLTEMPLATE:
- case Constants.ELEMNAME_FOREACH:
- case Constants.ELEMNAME_VALUEOF:
- case Constants.ELEMNAME_COPY_OF:
- case Constants.ELEMNAME_NUMBER:
- case Constants.ELEMNAME_CHOOSE:
- case Constants.ELEMNAME_IF:
- case Constants.ELEMNAME_TEXT:
- case Constants.ELEMNAME_COPY:
- case Constants.ELEMNAME_VARIABLE:
- case Constants.ELEMNAME_MESSAGE:
-
+
+ // char-instructions
+ case Constants.ELEMNAME_TEXTLITERALRESULT :
+ case Constants.ELEMNAME_APPLY_TEMPLATES :
+ case Constants.ELEMNAME_APPLY_IMPORTS :
+ case Constants.ELEMNAME_CALLTEMPLATE :
+ case Constants.ELEMNAME_FOREACH :
+ case Constants.ELEMNAME_VALUEOF :
+ case Constants.ELEMNAME_COPY_OF :
+ case Constants.ELEMNAME_NUMBER :
+ case Constants.ELEMNAME_CHOOSE :
+ case Constants.ELEMNAME_IF :
+ case Constants.ELEMNAME_TEXT :
+ case Constants.ELEMNAME_COPY :
+ case Constants.ELEMNAME_VARIABLE :
+ case Constants.ELEMNAME_MESSAGE :
+
// instructions
// case Constants.ELEMNAME_PI:
// case Constants.ELEMNAME_COMMENT:
// case Constants.ELEMNAME_ELEMENT:
// case Constants.ELEMNAME_ATTRIBUTE:
-
break;
-
- default:
- error(XSLTErrorResources.ER_CANNOT_ADD, new Object[]
{newChild.getNodeName(), this.getNodeName()}); //"Can not add "
+((ElemTemplateElement)newChild).m_elemName +
- //" to " + this.m_elemName);
+ default :
+ error(XSLTErrorResources.ER_CANNOT_ADD,
+ new Object[]{ newChild.getNodeName(),
+ this.getNodeName() }); //"Can not add "
+((ElemTemplateElement)newChild).m_elemName +
+
+ //" to " + this.m_elemName);
}
+
return super.appendChild(newChild);
}
}
1.4 +48 -30
xml-xalan/java/src/org/apache/xalan/templates/ElemCopy.java
Index: ElemCopy.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemCopy.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ElemCopy.java 2000/10/17 19:06:29 1.3
+++ ElemCopy.java 2000/10/30 18:49:42 1.4
@@ -57,9 +57,13 @@
package org.apache.xalan.templates;
import org.w3c.dom.*;
+
import org.xml.sax.*;
+
import org.apache.xpath.*;
+
import java.util.*;
+
import org.apache.xalan.utils.QName;
import org.apache.xalan.trace.*;
import org.apache.xalan.res.XSLTErrorResources;
@@ -80,70 +84,84 @@
*/
public class ElemCopy extends ElemUse
{
+
/**
* Get an int constant identifying the type of element.
* @see org.apache.xalan.templates.Constants
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public int getXSLToken()
{
return Constants.ELEMNAME_COPY;
}
-
- /**
+
+ /**
* Return the node name.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public String getNodeName()
{
return Constants.ELEMNAME_COPY_STRING;
}
-
+
/**
- * The xsl:copy element provides an easy way of copying the current node.
- * Executing this function creates a copy of the current node into the
- * result tree.
- * <p>The namespace nodes of the current node are automatically
- * copied as well, but the attributes and children of the node are not
- * automatically copied. The content of the xsl:copy element is a
- * template for the attributes and children of the created node;
- * the content is instantiated only for nodes of types that can have
+ * The xsl:copy element provides an easy way of copying the current node.
+ * Executing this function creates a copy of the current node into the
+ * result tree.
+ * <p>The namespace nodes of the current node are automatically
+ * copied as well, but the attributes and children of the node are not
+ * automatically copied. The content of the xsl:copy element is a
+ * template for the attributes and children of the created node;
+ * the content is instantiated only for nodes of types that can have
* attributes or children (i.e. root nodes and element nodes).</p>
- * <p>The root node is treated specially because the root node of the
- * result tree is created implicitly. When the current node is the
- * root node, xsl:copy will not create a root node, but will just use
+ * <p>The root node is treated specially because the root node of the
+ * result tree is created implicitly. When the current node is the
+ * root node, xsl:copy will not create a root node, but will just use
* the content template.</p>
+ *
+ * NEEDSDOC @param transformer
+ * NEEDSDOC @param sourceNode
+ * NEEDSDOC @param mode
+ *
+ * @throws SAXException
*/
- public void execute(TransformerImpl transformer,
- Node sourceNode,
- QName mode)
- throws SAXException
- {
- int nodeType = sourceNode.getNodeType();
- if((Node.DOCUMENT_NODE != nodeType))
+ public void execute(
+ TransformerImpl transformer, Node sourceNode, QName mode)
+ throws SAXException
+ {
+
+ short nodeType = sourceNode.getNodeType();
+
+ if ((Node.DOCUMENT_NODE != nodeType))
{
ResultTreeHandler rthandler = transformer.getResultTreeHandler();
-
+
// TODO: Process the use-attribute-sets stuff
- rthandler.cloneToResultTree( sourceNode, false );
-
- if(Node.ELEMENT_NODE == nodeType)
+ rthandler.cloneToResultTree(sourceNode, false);
+
+ if (Node.ELEMENT_NODE == nodeType)
{
super.execute(transformer, sourceNode, mode);
rthandler.processNSDecls(sourceNode);
transformer.executeChildTemplates(this, sourceNode, mode);
- transformer.getResultTreeHandler().endElement("", "",
sourceNode.getNodeName());
+ transformer.getResultTreeHandler().endElement("", "",
+ sourceNode.getNodeName());
}
else
{
- if(TransformerImpl.S_DEBUG)
- transformer.getTraceManager().fireTraceEvent(sourceNode, mode,
this);
+ if (TransformerImpl.S_DEBUG)
+ transformer.getTraceManager().fireTraceEvent(sourceNode, mode,
+ this);
}
}
else
{
- if(TransformerImpl.S_DEBUG)
+ if (TransformerImpl.S_DEBUG)
transformer.getTraceManager().fireTraceEvent(sourceNode, mode, this);
+
transformer.executeChildTemplates(this, sourceNode, mode);
}
}
-
}
1.4 +81 -51
xml-xalan/java/src/org/apache/xalan/templates/ElemCopyOf.java
Index: ElemCopyOf.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemCopyOf.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ElemCopyOf.java 2000/10/13 23:33:05 1.3
+++ ElemCopyOf.java 2000/10/30 18:49:43 1.4
@@ -58,7 +58,9 @@
import org.w3c.dom.*;
import org.w3c.dom.traversal.NodeIterator;
+
import org.xml.sax.*;
+
import org.apache.xpath.*;
import org.apache.xpath.objects.XObject;
import org.apache.xalan.trace.SelectionEvent;
@@ -79,14 +81,17 @@
*/
public class ElemCopyOf extends ElemTemplateElement
{
+
/**
- * The required select attribute contains an expression.
+ * The required select attribute contains an expression.
*/
public XPath m_selectExpression = null;
-
+
/**
- * Set the "select" attribute.
- * The required select attribute contains an expression.
+ * Set the "select" attribute.
+ * The required select attribute contains an expression.
+ *
+ * NEEDSDOC @param expr
*/
public void setSelect(XPath expr)
{
@@ -95,7 +100,9 @@
/**
* Get the "use-attribute-sets" attribute.
- * The required select attribute contains an expression.
+ * The required select attribute contains an expression.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public XPath getSelect()
{
@@ -105,14 +112,18 @@
/**
* Get an int constant identifying the type of element.
* @see org.apache.xalan.templates.Constants
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public int getXSLToken()
{
return Constants.ELEMNAME_COPY_OF;
}
-
- /**
+
+ /**
* Return the node name.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public String getNodeName()
{
@@ -120,64 +131,75 @@
}
/**
- * The xsl:copy-of element can be used to insert a result tree
- * fragment into the result tree, without first converting it to
- * a string as xsl:value-of does (see [7.6.1 Generating Text with
- * xsl:value-of]).
- */
- public void execute(TransformerImpl transformer,
- Node sourceNode,
- QName mode)
- throws SAXException
- {
- if(TransformerImpl.S_DEBUG)
+ * The xsl:copy-of element can be used to insert a result tree
+ * fragment into the result tree, without first converting it to
+ * a string as xsl:value-of does (see [7.6.1 Generating Text with
+ * xsl:value-of]).
+ *
+ * NEEDSDOC @param transformer
+ * NEEDSDOC @param sourceNode
+ * NEEDSDOC @param mode
+ *
+ * @throws SAXException
+ */
+ public void execute(
+ TransformerImpl transformer, Node sourceNode, QName mode)
+ throws SAXException
+ {
+
+ if (TransformerImpl.S_DEBUG)
transformer.getTraceManager().fireTraceEvent(sourceNode, mode, this);
XPathContext xctxt = transformer.getXPathContext();
XObject value = m_selectExpression.execute(xctxt, sourceNode, this);
-
- if(TransformerImpl.S_DEBUG)
- transformer.getTraceManager().fireSelectedEvent(sourceNode,
- this, "select", m_selectExpression,
value);
-
+
+ if (TransformerImpl.S_DEBUG)
+ transformer.getTraceManager().fireSelectedEvent(sourceNode, this,
+ "select", m_selectExpression, value);
+
ResultTreeHandler handler = transformer.getResultTreeHandler();
-
- if(null != value)
+
+ if (null != value)
{
int type = value.getType();
String s;
- switch(type)
+
+ switch (type)
{
- case XObject.CLASS_BOOLEAN:
- case XObject.CLASS_NUMBER:
- case XObject.CLASS_STRING:
+ case XObject.CLASS_BOOLEAN :
+ case XObject.CLASS_NUMBER :
+ case XObject.CLASS_STRING :
s = value.str();
+
handler.characters(s.toCharArray(), 0, s.length());
break;
-
- case XObject.CLASS_NODESET:
+ case XObject.CLASS_NODESET :
+
// System.out.println(value);
NodeIterator nl = value.nodeset();
-
+
// Copy the tree.
- org.apache.xalan.utils.TreeWalker tw
- = new TreeWalker2Result(transformer, handler);
+ org.apache.xalan.utils.TreeWalker tw =
+ new TreeWalker2Result(transformer, handler);
Node pos;
- while(null != (pos = nl.nextNode()))
+
+ while (null != (pos = nl.nextNode()))
{
- int t = pos.getNodeType();
+ short t = pos.getNodeType();
+
// If we just copy the whole document, a startDoc and endDoc get
// generated, so we need to only walk the child nodes.
- if(t == Node.DOCUMENT_NODE)
+ if (t == Node.DOCUMENT_NODE)
{
- for(Node child = pos.getFirstChild(); child != null; child =
child.getNextSibling())
+ for (Node child = pos.getFirstChild(); child != null;
+ child = child.getNextSibling())
{
tw.traverse(child);
}
}
- else if(t == Node.ATTRIBUTE_NODE)
+ else if (t == Node.ATTRIBUTE_NODE)
{
- handler.addAttribute((Attr)pos);
+ handler.addAttribute((Attr) pos);
}
else
{
@@ -185,28 +207,36 @@
}
}
break;
-
- case XObject.CLASS_RTREEFRAG:
- handler.outputResultTreeFragment(value,
transformer.getXPathContext());
+ case XObject.CLASS_RTREEFRAG :
+ handler.outputResultTreeFragment(value,
+ transformer.getXPathContext());
break;
-
- default:
+ default :
s = value.str();
+
handler.characters(s.toCharArray(), 0, s.length());
break;
}
}
}
-
+
/**
* Add a child to the child list.
+ *
+ * NEEDSDOC @param newChild
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws DOMException
*/
- public Node appendChild(Node newChild)
- throws DOMException
+ public Node appendChild(Node newChild) throws DOMException
{
- error(XSLTErrorResources.ER_CANNOT_ADD, new Object[]
{newChild.getNodeName(), this.getNodeName()}); //"Can not add "
+((ElemTemplateElement)newChild).m_elemName +
- //" to " + this.m_elemName);
+
+ error(XSLTErrorResources.ER_CANNOT_ADD,
+ new Object[]{ newChild.getNodeName(),
+ this.getNodeName() }); //"Can not add "
+((ElemTemplateElement)newChild).m_elemName +
+
+ //" to " + this.m_elemName);
return null;
}
-
}
1.7 +109 -72
xml-xalan/java/src/org/apache/xalan/templates/ElemElement.java
Index: ElemElement.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemElement.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ElemElement.java 2000/10/18 16:25:10 1.6
+++ ElemElement.java 2000/10/30 18:49:44 1.7
@@ -2,7 +2,7 @@
* The Apache Software License, Version 1.1
*
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -10,7 +10,7 @@
* are met:
*
* 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
+ * notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
@@ -18,7 +18,7 @@
* distribution.
*
* 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
+ * if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
@@ -26,7 +26,7 @@
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
- * software without prior written permission. For written
+ * software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
@@ -57,7 +57,9 @@
package org.apache.xalan.templates;
import org.w3c.dom.*;
+
import org.xml.sax.*;
+
import org.apache.xpath.*;
import org.apache.xalan.utils.QName;
import org.apache.xalan.res.XSLTErrorResources;
@@ -69,7 +71,7 @@
* Implement xsl:decimal-format.
* <pre>
* <!ELEMENT xsl:element %template;>
- * <!ATTLIST xsl:element
+ * <!ATTLIST xsl:element
* name %avt; #REQUIRED
* namespace %avt; #IMPLIED
* use-attribute-sets %qnames; #IMPLIED
@@ -80,18 +82,21 @@
*/
public class ElemElement extends ElemUse
{
+
/**
- * The name attribute is interpreted as an attribute value template.
- * It is an error if the string that results from instantiating the
+ * The name attribute is interpreted as an attribute value template.
+ * It is an error if the string that results from instantiating the
* attribute value template is not a QName.
*/
private AVT m_name_avt = null;
-
+
/**
- * Set the "name" attribute.
- * The name attribute is interpreted as an attribute value template.
- * It is an error if the string that results from instantiating the
+ * Set the "name" attribute.
+ * The name attribute is interpreted as an attribute value template.
+ * It is an error if the string that results from instantiating the
* attribute value template is not a QName.
+ *
+ * NEEDSDOC @param v
*/
public void setName(AVT v)
{
@@ -99,30 +104,34 @@
}
/**
- * Get the "name" attribute.
- * The name attribute is interpreted as an attribute value template.
- * It is an error if the string that results from instantiating the
+ * Get the "name" attribute.
+ * The name attribute is interpreted as an attribute value template.
+ * It is an error if the string that results from instantiating the
* attribute value template is not a QName.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public AVT getName()
{
return m_name_avt;
- }
-
+ }
+
/**
- * If the namespace attribute is present, then it also is interpreted
- * as an attribute value template. The string that results from
- * instantiating the attribute value template should be a URI reference.
- * It is not an error if the string is not a syntactically legal URI
reference.
+ * If the namespace attribute is present, then it also is interpreted
+ * as an attribute value template. The string that results from
+ * instantiating the attribute value template should be a URI reference.
+ * It is not an error if the string is not a syntactically legal URI
reference.
*/
private AVT m_namespace_avt = null;
-
+
/**
- * Set the "namespace" attribute.
- * If the namespace attribute is present, then it also is interpreted
- * as an attribute value template. The string that results from
- * instantiating the attribute value template should be a URI reference.
- * It is not an error if the string is not a syntactically legal URI
reference.
+ * Set the "namespace" attribute.
+ * If the namespace attribute is present, then it also is interpreted
+ * as an attribute value template. The string that results from
+ * instantiating the attribute value template should be a URI reference.
+ * It is not an error if the string is not a syntactically legal URI
reference.
+ *
+ * NEEDSDOC @param v
*/
public void setNamespace(AVT v)
{
@@ -130,17 +139,19 @@
}
/**
- * Get the "namespace" attribute.
- * If the namespace attribute is present, then it also is interpreted
- * as an attribute value template. The string that results from
- * instantiating the attribute value template should be a URI reference.
- * It is not an error if the string is not a syntactically legal URI
reference.
+ * Get the "namespace" attribute.
+ * If the namespace attribute is present, then it also is interpreted
+ * as an attribute value template. The string that results from
+ * instantiating the attribute value template should be a URI reference.
+ * It is not an error if the string is not a syntactically legal URI
reference.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public AVT getNamespace()
{
return m_namespace_avt;
- }
-
+ }
+
/**
* Cached prefix value... the use of which is dubious.
*/
@@ -149,14 +160,18 @@
/**
* Get an int constant identifying the type of element.
* @see org.apache.xalan.templates.Constants
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public int getXSLToken()
{
return Constants.ELEMNAME_ELEMENT;
}
-
- /**
+
+ /**
* Return the node name.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public String getNodeName()
{
@@ -165,101 +180,123 @@
/**
* Create an element in the result tree.
- * The xsl:element element allows an element to be created with a
- * computed name. The expanded-name of the element to be created
- * is specified by a required name attribute and an optional namespace
- * attribute. The content of the xsl:element element is a template
+ * The xsl:element element allows an element to be created with a
+ * computed name. The expanded-name of the element to be created
+ * is specified by a required name attribute and an optional namespace
+ * attribute. The content of the xsl:element element is a template
* for the attributes and children of the created element.
+ *
+ * NEEDSDOC @param transformer
+ * NEEDSDOC @param sourceNode
+ * NEEDSDOC @param mode
+ *
+ * @throws SAXException
*/
- public void execute(TransformerImpl transformer,
- Node sourceNode,
- QName mode)
- throws SAXException
+ public void execute(
+ TransformerImpl transformer, Node sourceNode, QName mode)
+ throws SAXException
{
+
ResultTreeHandler rhandler = transformer.getResultTreeHandler();
XPathContext xctxt = transformer.getXPathContext();
-
String elemName = m_name_avt.evaluate(xctxt, sourceNode, this);
- // make sure that if a prefix is specified on the attribute name, it is
valid
+
+ // make sure that if a prefix is specified on the attribute name, it is
valid
int indexOfNSSep = elemName.indexOf(':');
- String ns ="" ;
- if(indexOfNSSep >= 0)
+ String ns = "";
+
+ if (indexOfNSSep >= 0)
{
String nsprefix = elemName.substring(0, indexOfNSSep);
+
// Catch the exception this may cause. We don't want to stop
processing.
- try{
+ try
+ {
ns = getNamespaceForPrefix(nsprefix);
+
// Check if valid QName. Assuming that if the prefix is defined,
// it is valid.
- if ( indexOfNSSep+1 == elemName.length() ||
- !isValidNCName(elemName.substring(indexOfNSSep + 1)))
+ if (indexOfNSSep + 1 == elemName.length()
+ ||!isValidNCName(elemName.substring(indexOfNSSep + 1)))
{
-
transformer.getMsgMgr().warn(XSLTErrorResources.WG_ILLEGAL_ATTRIBUTE_NAME, new
Object[]{elemName});
+ transformer.getMsgMgr().warn(
+ XSLTErrorResources.WG_ILLEGAL_ATTRIBUTE_NAME,
+ new Object[]{ elemName });
+
elemName = null;
}
}
- catch(Exception ex)
+ catch (Exception ex)
{
+
// Could not resolve prefix
ns = null;
-
transformer.getMsgMgr().warn(XSLTErrorResources.WG_COULD_NOT_RESOLVE_PREFIX,
new Object[]{nsprefix});
- }
+ transformer.getMsgMgr().warn(
+ XSLTErrorResources.WG_COULD_NOT_RESOLVE_PREFIX,
+ new Object[]{ nsprefix });
+ }
}
+
// Check if valid QName
- else if (elemName.length() == 0 || !isValidNCName(elemName))
+ else if (elemName.length() == 0 ||!isValidNCName(elemName))
{
-
transformer.getMsgMgr().warn(XSLTErrorResources.WG_ILLEGAL_ATTRIBUTE_NAME, new
Object[]{elemName});
+ transformer.getMsgMgr().warn(
+ XSLTErrorResources.WG_ILLEGAL_ATTRIBUTE_NAME,
+ new Object[]{ elemName });
+
elemName = null;
}
+
// Only do this if name is valid
String elemNameSpace = null;
String prefix = null;
- if(null != elemName && null != ns)
+
+ if (null != elemName && null != ns)
{
- if(null != m_namespace_avt)
+ if (null != m_namespace_avt)
{
elemNameSpace = m_namespace_avt.evaluate(xctxt, sourceNode, this);
- if(null != elemNameSpace && elemNameSpace.length()>0)
+ if (null != elemNameSpace && elemNameSpace.length() > 0)
{
+
// Get the prefix for that attribute in the result namespace.
prefix = rhandler.getPrefix(elemNameSpace);
-
+
// If we didn't find the prefix mapping, make up a prefix
// and have it declared in the result tree.
- if(null == prefix)
+ if (null == prefix)
{
- prefix = rhandler.getNewUniqueNSPrefix();
+ prefix = rhandler.getNewUniqueNSPrefix();
}
+
// add the prefix to the attribute name.
- elemName = (prefix + ":"+QName.getLocalPart(elemName));
+ elemName = (prefix + ":" + QName.getLocalPart(elemName));
}
}
// Add namespace declarations.
executeNSDecls(transformer);
-
- rhandler.startElement(elemNameSpace, QName.getLocalPart(elemName),
elemName);
- if(null != prefix)
- {
+
+ if (null != prefix)
rhandler.startPrefixMapping(prefix, elemNameSpace, true);
- }
+
+ rhandler.startElement(elemNameSpace, QName.getLocalPart(elemName),
+ elemName);
}
+
// Instantiate content of xsl:element. Note that if startElement was not
// called(ie: if invalid element name, the element's attributes will be
// excluded because transformer.m_pendingElementName will be null.
super.execute(transformer, sourceNode, mode);
-
transformer.executeChildTemplates(this, sourceNode, mode);
// Now end the element if name was valid
- if(null != elemName && null != ns)
+ if (null != elemName && null != ns)
{
rhandler.endElement("", "", elemName);
unexecuteNSDecls(transformer);
}
-
}
-
}
1.3 +9 -4
xml-xalan/java/src/org/apache/xalan/templates/ElemEmpty.java
Index: ElemEmpty.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemEmpty.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ElemEmpty.java 2000/07/05 14:40:07 1.2
+++ ElemEmpty.java 2000/10/30 18:49:45 1.3
@@ -57,18 +57,23 @@
package org.apache.xalan.templates;
import org.w3c.dom.*;
+
import org.xml.sax.*;
+
import org.apache.xpath.*;
import org.apache.xalan.transformer.TransformerImpl;
/**
* <meta name="usage" content="internal"/>
- * Simple empty elem to push on the stack when nothing
+ * Simple empty elem to push on the stack when nothing
* else got pushed, so that pop() works correctly.
*/
public class ElemEmpty extends ElemTemplateElement
{
- public ElemEmpty()
- {
- }
+
+ /**
+ * Constructor ElemEmpty
+ *
+ */
+ public ElemEmpty(){}
}
1.11 +139 -65
xml-xalan/java/src/org/apache/xalan/templates/ElemExtensionCall.java
Index: ElemExtensionCall.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemExtensionCall.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- ElemExtensionCall.java 2000/10/17 19:02:38 1.10
+++ ElemExtensionCall.java 2000/10/30 18:49:46 1.11
@@ -57,12 +57,16 @@
package org.apache.xalan.templates;
import java.io.*;
+
import java.util.*;
import org.w3c.dom.*;
+
import org.xml.sax.*;
import org.xml.sax.helpers.*;
+
import java.util.StringTokenizer;
+
import org.apache.xalan.utils.QName;
import org.apache.xalan.utils.NameSpace;
import org.apache.xalan.utils.StringToStringTable;
@@ -82,31 +86,50 @@
*/
public class ElemExtensionCall extends ElemLiteralResult
{
+
// ExtensionNSHandler nsh;
+
+ /** NEEDSDOC Field m_extns */
String m_extns;
+
// String m_extHandlerLookup;
+
+ /** NEEDSDOC Field isAvailable */
transient boolean isAvailable = false;
+
+ /** NEEDSDOC Field m_lang */
String m_lang;
+
+ /** NEEDSDOC Field m_srcURL */
String m_srcURL;
+
+ /** NEEDSDOC Field m_scriptSrc */
String m_scriptSrc;
+
+ /** NEEDSDOC Field m_decl */
ElemExtensionDecl m_decl = null;
/**
* Get an int constant identifying the type of element.
* @see org.apache.xalan.templates.Constants
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public int getXSLToken()
{
return Constants.ELEMNAME_EXTENSIONCALL;
}
-
- /**
+
+ /**
* Return the node name.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
+
// public String getNodeName()
// {
- // TODO: Need prefix.
- // return localPart;
+ // TODO: Need prefix.
+ // return localPart;
// }
/**
@@ -116,137 +139,169 @@
{
return isAvailable;
}
-
+
/**
- * This function is called after everything else has been
- * recomposed, and allows the template to set remaining
- * values that may be based on some other property that
+ * This function is called after everything else has been
+ * recomposed, and allows the template to set remaining
+ * values that may be based on some other property that
* depends on recomposition.
*/
public void compose()
{
+
m_extns = this.getNamespace();
-
+
StylesheetRoot stylesheet = this.getStylesheetRoot();
-
+
m_decl = getElemExtensionDecl(stylesheet, m_extns);
-
- if(null != m_decl)
+
+ if (null != m_decl)
{
- for(ElemTemplateElement child = m_decl.getFirstChildElem();
- child != null; child = child.getNextSiblingElem())
+ for (ElemTemplateElement child = m_decl.getFirstChildElem();
+ child != null; child = child.getNextSiblingElem())
{
- if(Constants.ELEMNAME_EXTENSIONSCRIPT == child.getXSLToken())
+ if (Constants.ELEMNAME_EXTENSIONSCRIPT == child.getXSLToken())
{
- ElemExtensionScript sdecl = (ElemExtensionScript)child;
+ ElemExtensionScript sdecl = (ElemExtensionScript) child;
+
m_lang = sdecl.getLang();
m_srcURL = sdecl.getSrc();
+
ElemTemplateElement childOfSDecl = sdecl.getFirstChildElem();
- if(null != childOfSDecl)
+
+ if (null != childOfSDecl)
{
- if(Constants.ELEMNAME_TEXTLITERALRESULT ==
childOfSDecl.getXSLToken())
+ if (Constants.ELEMNAME_TEXTLITERALRESULT
+ == childOfSDecl.getXSLToken())
{
- ElemTextLiteral tl = (ElemTextLiteral)childOfSDecl;
+ ElemTextLiteral tl = (ElemTextLiteral) childOfSDecl;
char[] chars = tl.getChars();
+
m_scriptSrc = new String(chars);
}
}
+
break;
}
}
-
}
else
{
+
// stylesheet.error(xxx);
}
}
-
- private ElemExtensionDecl getElemExtensionDecl(StylesheetRoot stylesheet,
- String namespace)
+
+ /**
+ * NEEDSDOC Method getElemExtensionDecl
+ *
+ *
+ * NEEDSDOC @param stylesheet
+ * NEEDSDOC @param namespace
+ *
+ * NEEDSDOC (getElemExtensionDecl) @return
+ */
+ private ElemExtensionDecl getElemExtensionDecl(StylesheetRoot stylesheet,
+ String namespace)
{
+
ElemExtensionDecl decl = null;
-
int n = stylesheet.getGlobalImportCount();
- for(int i = 0; i < n; i++)
+
+ for (int i = 0; i < n; i++)
{
Stylesheet imported = stylesheet.getGlobalImport(i);
- for(ElemTemplateElement child = imported.getFirstChildElem();
- child != null; child = child.getNextSiblingElem())
+
+ for (ElemTemplateElement child = imported.getFirstChildElem();
+ child != null; child = child.getNextSiblingElem())
{
- if(Constants.ELEMNAME_EXTENSIONDECL == child.getXSLToken())
+ if (Constants.ELEMNAME_EXTENSIONDECL == child.getXSLToken())
{
- decl = (ElemExtensionDecl)child;
+ decl = (ElemExtensionDecl) child;
+
String prefix = decl.getPrefix();
String declNamespace = child.getNamespaceForPrefix(prefix);
- if(namespace.equals(declNamespace))
+
+ if (namespace.equals(declNamespace))
{
return decl;
}
}
}
}
+
return decl;
}
/**
* Execute an extension.
+ *
+ * NEEDSDOC @param transformer
+ * NEEDSDOC @param sourceNode
+ * NEEDSDOC @param mode
+ *
+ * @throws SAXException
*/
- public void execute(TransformerImpl transformer,
- Node sourceNode,
- QName mode)
- throws SAXException
+ public void execute(
+ TransformerImpl transformer, Node sourceNode, QName mode)
+ throws SAXException
{
+
try
{
transformer.getResultTreeHandler().flushPending();
-
- XPathContext liaison = ((XPathContext)transformer.getXPathContext());
+
+ XPathContext liaison = ((XPathContext) transformer.getXPathContext());
ExtensionsTable etable = liaison.getExtensionsTable();
ExtensionHandler nsh = etable.get(m_extns);
// We're seeing this extension namespace used for the first time. Try
to
// autodeclare it as a java namespace.
-
if (null == nsh)
{
nsh = etable.makeJavaNamespace(m_extns);
+
etable.addExtensionNamespace(m_extns, nsh);
}
- nsh.processElement(this.getLocalName(),
- this,
- transformer,
- getStylesheet(),
- sourceNode.getOwnerDocument(),
- sourceNode,
- mode,
- this);
+ nsh.processElement(this.getLocalName(), this, transformer,
+ getStylesheet(), sourceNode.getOwnerDocument(),
+ sourceNode, mode, this);
}
- catch(Exception e)
+ catch (Exception e)
{
+
// System.out.println(e);
// e.printStackTrace();
String msg = e.getMessage();
- if(null != msg)
+
+ if (null != msg)
{
- if(msg.startsWith("Stopping after fatal error:"))
+ if (msg.startsWith("Stopping after fatal error:"))
{
msg = msg.substring("Stopping after fatal error:".length());
}
-
transformer.getMsgMgr().message(XSLMessages.createMessage(XSLTErrorResources.ER_CALL_TO_EXT_FAILED,
new Object[]{msg}), false); //"Call to extension element failed: "+msg);
+
+ transformer.getMsgMgr().message(
+ XSLMessages.createMessage(
+ XSLTErrorResources.ER_CALL_TO_EXT_FAILED, new Object[]{ msg }),
+ false); //"Call to extension element failed: "+msg);
+
// e.printStackTrace();
// System.exit(-1);
}
+
// transformer.message(msg);
- isAvailable = false;
- for (ElemTemplateElement child = m_firstChild; child != null; child =
child.m_nextSibling)
+ isAvailable = false;
+
+ for (ElemTemplateElement child = m_firstChild; child != null;
+ child = child.m_nextSibling)
{
- if(child.getXSLToken() == Constants.ELEMNAME_FALLBACK)
+ if (child.getXSLToken() == Constants.ELEMNAME_FALLBACK)
{
try
{
- transformer.pushElemTemplateElement(child, sourceNode);
+ transformer.pushElemTemplateElement(child);
child.execute(transformer, sourceNode, mode);
}
finally
@@ -257,35 +312,54 @@
}
}
}
-
+
/**
* Return the raw value of the attribute.
+ *
+ * NEEDSDOC @param rawName
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public String getAttribute(String rawName)
{
+
AVT avt = getLiteralResultAttribute(rawName);
- if((null != avt) && avt.getRawName().equals(rawName))
+
+ if ((null != avt) && avt.getRawName().equals(rawName))
{
- return avt.getSimpleString();
+ return avt.getSimpleString();
}
- return null;
+
+ return null;
}
/**
- * Return the value of the attribute interpreted as an Attribute
- * Value Template (in other words, you can use curly expressions
+ * Return the value of the attribute interpreted as an Attribute
+ * Value Template (in other words, you can use curly expressions
* such as href="http://{website}".
+ *
+ * NEEDSDOC @param rawName
+ * NEEDSDOC @param sourceNode
+ * NEEDSDOC @param transformer
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws SAXException
*/
- public String getAttribute(String rawName, Node sourceNode,
TransformerImpl transformer)
- throws SAXException
+ public String getAttribute(
+ String rawName, Node sourceNode, TransformerImpl transformer)
+ throws SAXException
{
+
AVT avt = getLiteralResultAttribute(rawName);
- if((null != avt) && avt.getRawName().equals(rawName))
+
+ if ((null != avt) && avt.getRawName().equals(rawName))
{
XPathContext xctxt = transformer.getXPathContext();
- return avt.evaluate(xctxt, sourceNode, this);
+
+ return avt.evaluate(xctxt, sourceNode, this);
}
- return null;
- }
+ return null;
+ }
}
1.9 +146 -53
xml-xalan/java/src/org/apache/xalan/templates/ElemExtensionDecl.java
Index: ElemExtensionDecl.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemExtensionDecl.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- ElemExtensionDecl.java 2000/10/12 07:53:39 1.8
+++ ElemExtensionDecl.java 2000/10/30 18:49:46 1.9
@@ -54,10 +54,10 @@
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
-
package org.apache.xalan.templates;
import java.util.Vector;
+
import org.apache.xalan.utils.QName;
import org.apache.xalan.utils.NameSpace;
import org.apache.xalan.utils.StringToStringTable;
@@ -66,100 +66,186 @@
import org.apache.xalan.extensions.ExtensionHandlerGeneral;
import org.apache.xalan.extensions.ExtensionsTable;
import org.apache.xalan.transformer.TransformerImpl;
+
import org.xml.sax.SAXException;
+
import org.apache.xpath.XPathContext;
import org.apache.xalan.res.XSLTErrorResources;
+/**
+ * <meta name="usage" content="internal"/>
+ * NEEDSDOC Class ElemExtensionDecl <needs-comment/>
+ */
public class ElemExtensionDecl extends ElemTemplateElement
{
+
+ /**
+ * Constructor ElemExtensionDecl
+ *
+ */
public ElemExtensionDecl()
{
+
// System.out.println("ElemExtensionDecl ctor");
}
-
+
+ /** NEEDSDOC Field m_prefix */
private String m_prefix = null;
-
+
+ /**
+ * NEEDSDOC Method setPrefix
+ *
+ *
+ * NEEDSDOC @param v
+ */
public void setPrefix(String v)
{
m_prefix = v;
}
+ /**
+ * NEEDSDOC Method getPrefix
+ *
+ *
+ * NEEDSDOC (getPrefix) @return
+ */
public String getPrefix()
{
return m_prefix;
}
+ /** NEEDSDOC Field m_functions */
private StringVector m_functions = new StringVector();
-
+
+ /**
+ * NEEDSDOC Method setFunctions
+ *
+ *
+ * NEEDSDOC @param v
+ */
public void setFunctions(StringVector v)
{
m_functions = v;
}
+ /**
+ * NEEDSDOC Method getFunctions
+ *
+ *
+ * NEEDSDOC (getFunctions) @return
+ */
public StringVector getFunctions()
{
return m_functions;
}
-
- public String getFunction(int i)
- throws ArrayIndexOutOfBoundsException
+
+ /**
+ * NEEDSDOC Method getFunction
+ *
+ *
+ * NEEDSDOC @param i
+ *
+ * NEEDSDOC (getFunction) @return
+ *
+ * @throws ArrayIndexOutOfBoundsException
+ */
+ public String getFunction(int i) throws ArrayIndexOutOfBoundsException
{
- if(null == m_functions)
+
+ if (null == m_functions)
throw new ArrayIndexOutOfBoundsException();
- return (String)m_functions.elementAt(i);
+
+ return (String) m_functions.elementAt(i);
}
+ /**
+ * NEEDSDOC Method getFunctionCount
+ *
+ *
+ * NEEDSDOC (getFunctionCount) @return
+ */
public int getFunctionCount()
{
- return (null != m_functions)
- ? m_functions.size() : 0;
+ return (null != m_functions) ? m_functions.size() : 0;
}
-
+ /** NEEDSDOC Field m_elements */
private StringVector m_elements = null;
-
+
+ /**
+ * NEEDSDOC Method setElements
+ *
+ *
+ * NEEDSDOC @param v
+ */
public void setElements(StringVector v)
{
m_elements = v;
}
+ /**
+ * NEEDSDOC Method getElements
+ *
+ *
+ * NEEDSDOC (getElements) @return
+ */
public StringVector getElements()
{
return m_elements;
}
-
- public String getElement(int i)
- throws ArrayIndexOutOfBoundsException
+
+ /**
+ * NEEDSDOC Method getElement
+ *
+ *
+ * NEEDSDOC @param i
+ *
+ * NEEDSDOC (getElement) @return
+ *
+ * @throws ArrayIndexOutOfBoundsException
+ */
+ public String getElement(int i) throws ArrayIndexOutOfBoundsException
{
- if(null == m_elements)
+
+ if (null == m_elements)
throw new ArrayIndexOutOfBoundsException();
- return (String)m_elements.elementAt(i);
+
+ return (String) m_elements.elementAt(i);
}
+ /**
+ * NEEDSDOC Method getElementCount
+ *
+ *
+ * NEEDSDOC (getElementCount) @return
+ */
public int getElementCount()
{
- return (null != m_elements)
- ? m_elements.size() : 0;
+ return (null != m_elements) ? m_elements.size() : 0;
}
/**
* Get an int constant identifying the type of element.
* @see org.apache.xalan.templates.Constants
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public int getXSLToken()
{
return Constants.ELEMNAME_EXTENSIONDECL;
}
-
- /**
- * This function will be called on top-level elements
+
+ /**
+ * This function will be called on top-level elements
* only, just before the transform begins.
- *
+ *
* @param transformer The XSLT Processor.
+ *
+ * @throws SAXException
*/
- public void runtimeInit(TransformerImpl transformer)
- throws SAXException
+ public void runtimeInit(TransformerImpl transformer) throws SAXException
{
+
String lang = null;
String srcURL = null;
String scriptSrc = null;
@@ -167,38 +253,47 @@
String declNamespace = getNamespaceForPrefix(prefix);
if (null == declNamespace)
- throw new SAXException("Prefix " + prefix + " does not have a
corresponding "
- + "namespace declaration");
+ throw new SAXException("Prefix " + prefix
+ + " does not have a corresponding "
+ + "namespace declaration");
- for(ElemTemplateElement child = getFirstChildElem();
- child != null; child = child.getNextSiblingElem())
+ for (ElemTemplateElement child = getFirstChildElem(); child != null;
+ child = child.getNextSiblingElem())
{
- if(Constants.ELEMNAME_EXTENSIONSCRIPT == child.getXSLToken())
+ if (Constants.ELEMNAME_EXTENSIONSCRIPT == child.getXSLToken())
{
- ElemExtensionScript sdecl = (ElemExtensionScript)child;
+ ElemExtensionScript sdecl = (ElemExtensionScript) child;
+
lang = sdecl.getLang();
srcURL = sdecl.getSrc();
+
ElemTemplateElement childOfSDecl = sdecl.getFirstChildElem();
- if(null != childOfSDecl)
+
+ if (null != childOfSDecl)
{
- if(Constants.ELEMNAME_TEXTLITERALRESULT ==
childOfSDecl.getXSLToken())
+ if (Constants.ELEMNAME_TEXTLITERALRESULT
+ == childOfSDecl.getXSLToken())
{
- ElemTextLiteral tl = (ElemTextLiteral)childOfSDecl;
+ ElemTextLiteral tl = (ElemTextLiteral) childOfSDecl;
char[] chars = tl.getChars();
+
scriptSrc = new String(chars);
- if(scriptSrc.trim().length() == 0)
+
+ if (scriptSrc.trim().length() == 0)
scriptSrc = null;
}
}
}
}
- if(null == lang)
+
+ if (null == lang)
lang = "javaclass";
- if ( lang.equals("javaclass") && (scriptSrc != null) )
- throw new SAXException("Element content not allowed for lang=javaclass
" + scriptSrc);
+ if (lang.equals("javaclass") && (scriptSrc != null))
+ throw new SAXException("Element content not allowed for lang=javaclass
"
+ + scriptSrc);
- XPathContext liaison = ((XPathContext)transformer.getXPathContext());
+ XPathContext liaison = ((XPathContext) transformer.getXPathContext());
ExtensionsTable etable = liaison.getExtensionsTable();
ExtensionHandler nsh = etable.get(declNamespace);
@@ -208,10 +303,10 @@
// Element content is not supported for this so we throw an exception if
// it is provided. Otherwise, we look up the srcURL to see if we
already have
// an ExtensionHandler.
-
- if(null == nsh)
+ if (null == nsh)
{
- if (lang.equals("javaclass")) {
+ if (lang.equals("javaclass"))
+ {
if (null == srcURL)
{
nsh = etable.makeJavaNamespace(declNamespace);
@@ -219,27 +314,25 @@
else
{
nsh = etable.get(srcURL);
- if (null == nsh) {
+
+ if (null == nsh)
+ {
nsh = etable.makeJavaNamespace(srcURL);
}
}
}
- else // not java
+ else // not java
{
- nsh = new ExtensionHandlerGeneral(declNamespace,
- this.m_elements,
- this.m_functions,
- lang,
- srcURL,
+ nsh = new ExtensionHandlerGeneral(declNamespace, this.m_elements,
+ this.m_functions, lang, srcURL,
scriptSrc);
+
// System.out.println("Adding NS Handler: declNamespace = "+
// declNamespace+", lang = "+lang+", srcURL = "+
// srcURL+", scriptSrc="+scriptSrc);
}
-
- etable.addExtensionNamespace (declNamespace, nsh);
+ etable.addExtensionNamespace(declNamespace, nsh);
}
}
}
-
1.3 +97 -4
xml-xalan/java/src/org/apache/xalan/templates/ElemExtensionScript.java
Index: ElemExtensionScript.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemExtensionScript.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ElemExtensionScript.java 2000/10/03 19:38:05 1.2
+++ ElemExtensionScript.java 2000/10/30 18:49:47 1.3
@@ -1,31 +1,123 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Xalan" and "Apache Software Foundation" must
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written
+ * permission, please contact [EMAIL PROTECTED]
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * nor may "Apache" appear in their name, without prior written
+ * permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation and was
+ * originally based on software copyright (c) 1999, Lotus
+ * Development Corporation., http://www.lotus.com. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.xalan.templates;
+/**
+ * <meta name="usage" content="internal"/>
+ * NEEDSDOC Class ElemExtensionScript <needs-comment/>
+ */
public class ElemExtensionScript extends ElemTemplateElement
{
+
+ /**
+ * Constructor ElemExtensionScript
+ *
+ */
public ElemExtensionScript()
{
+
// System.out.println("ElemExtensionScript ctor");
}
+ /** NEEDSDOC Field m_lang */
private String m_lang = null;
-
+
+ /**
+ * NEEDSDOC Method setLang
+ *
+ *
+ * NEEDSDOC @param v
+ */
public void setLang(String v)
{
m_lang = v;
}
+ /**
+ * NEEDSDOC Method getLang
+ *
+ *
+ * NEEDSDOC (getLang) @return
+ */
public String getLang()
{
return m_lang;
}
-
+
+ /** NEEDSDOC Field m_src */
private String m_src = null;
-
+
+ /**
+ * NEEDSDOC Method setSrc
+ *
+ *
+ * NEEDSDOC @param v
+ */
public void setSrc(String v)
{
m_src = v;
}
+ /**
+ * NEEDSDOC Method getSrc
+ *
+ *
+ * NEEDSDOC (getSrc) @return
+ */
public String getSrc()
{
return m_src;
@@ -34,10 +126,11 @@
/**
* Get an int constant identifying the type of element.
* @see org.apache.xalan.templates.Constants
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public int getXSLToken()
{
return Constants.ELEMNAME_EXTENSIONSCRIPT;
}
-
}
1.3 +34 -17
xml-xalan/java/src/org/apache/xalan/templates/ElemFallback.java
Index: ElemFallback.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemFallback.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ElemFallback.java 2000/07/05 14:40:09 1.2
+++ ElemFallback.java 2000/10/30 18:49:48 1.3
@@ -57,7 +57,9 @@
package org.apache.xalan.templates;
import org.w3c.dom.*;
+
import org.xml.sax.*;
+
import org.apache.xpath.*;
import org.apache.xalan.trace.SelectionEvent;
import org.apache.xalan.utils.QName;
@@ -75,17 +77,22 @@
*/
public class ElemFallback extends ElemTemplateElement
{
+
/**
* Get an int constant identifying the type of element.
* @see org.apache.xalan.templates.Constants
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public int getXSLToken()
{
return Constants.ELEMNAME_FALLBACK;
}
-
- /**
+
+ /**
* Return the node name.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public String getNodeName()
{
@@ -94,24 +101,32 @@
/**
* Execute the fallback elements.
- * When an XSLT transformer performs fallback for an instruction
- * element, if the instruction element has one or more xsl:fallback
- * children, then the content of each of the xsl:fallback children
- * must be instantiated in sequence; otherwise, an error must
+ * When an XSLT transformer performs fallback for an instruction
+ * element, if the instruction element has one or more xsl:fallback
+ * children, then the content of each of the xsl:fallback children
+ * must be instantiated in sequence; otherwise, an error must
* be signaled. The content of an xsl:fallback element is a template.
+ *
+ * NEEDSDOC @param transformer
+ * NEEDSDOC @param sourceNode
+ * NEEDSDOC @param mode
+ *
+ * @throws SAXException
*/
- public void execute(TransformerImpl transformer,
- Node sourceNode,
- QName mode)
- throws SAXException
- {
- if(Constants.ELEMNAME_EXTENSIONCALL == m_parentNode.getXSLToken())
+ public void execute(
+ TransformerImpl transformer, Node sourceNode, QName mode)
+ throws SAXException
+ {
+
+ if (Constants.ELEMNAME_EXTENSIONCALL == m_parentNode.getXSLToken())
{
- ElemExtensionCall parent = (ElemExtensionCall)m_parentNode;
- if(!parent.elementIsAvailable())
+ ElemExtensionCall parent = (ElemExtensionCall) m_parentNode;
+
+ if (!parent.elementIsAvailable())
{
- if(TransformerImpl.S_DEBUG)
- transformer.getTraceManager().fireTraceEvent(sourceNode, mode,
this);
+ if (TransformerImpl.S_DEBUG)
+ transformer.getTraceManager().fireTraceEvent(sourceNode, mode,
+ this);
// XPathContext xctxt = transformer.getXPathContext();
transformer.executeChildTemplates(this, sourceNode, mode);
@@ -119,8 +134,10 @@
}
else
{
+
// Should never happen
- System.out.println("Error! parent of xsl:fallback must be an
extension element!");
+ System.out.println(
+ "Error! parent of xsl:fallback must be an extension element!");
}
}
}
1.3 +366 -44
xml-xalan/java/src/org/apache/xalan/templates/ElemForEach.java
Index: ElemForEach.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemForEach.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ElemForEach.java 2000/07/05 14:40:09 1.2
+++ ElemForEach.java 2000/10/30 18:49:48 1.3
@@ -57,12 +57,24 @@
package org.apache.xalan.templates;
import org.w3c.dom.*;
+import org.w3c.dom.traversal.NodeIterator;
+
import org.xml.sax.*;
+
import org.apache.xpath.*;
+import org.apache.xpath.axes.ContextNodeList;
+import org.apache.xpath.objects.XObject;
+
import java.util.Vector;
+
import org.apache.xalan.utils.QName;
+import org.apache.xalan.utils.PrefixResolver;
import org.apache.xalan.res.XSLTErrorResources;
import org.apache.xalan.transformer.TransformerImpl;
+import org.apache.xalan.transformer.NodeSorter;
+import org.apache.xalan.transformer.ResultTreeHandler;
+import org.apache.xalan.transformer.StackGuard;
+import org.apache.xalan.stree.SaxEventDispatch;
/**
* <meta name="usage" content="advanced"/>
@@ -72,9 +84,9 @@
* (#PCDATA
* %instructions;
* %result-elements;
- * | xsl:sort)*
+ * | xsl:sort)
* >
- *
+ *
* <!ATTLIST xsl:for-each
* select %expr; #REQUIRED
* %space-att;
@@ -84,20 +96,21 @@
*/
public class ElemForEach extends ElemTemplateElement
{
+
/**
* Construct a element representing xsl:for-each.
*/
- public ElemForEach()
- {
- }
+ public ElemForEach(){}
/**
* The "select" expression.
*/
private XPath m_selectExpression = null;
-
+
/**
* Set the "select" attribute.
+ *
+ * NEEDSDOC @param xpath
*/
public void setSelect(XPath xpath)
{
@@ -106,14 +119,28 @@
/**
* Set the "select" attribute.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public XPath getSelect()
{
return m_selectExpression;
}
+
+ /**
+ * Set the "select" attribute.
+ *
+ * NEEDSDOC ($objectName$) @return
+ */
+ public XPath getSelectOrDefault()
+ {
+ return (null == m_selectExpression)
+ ? getStylesheetRoot().m_selectDefault : m_selectExpression;
+ }
+
+ /** NEEDSDOC Field m_sortElems */
+ protected Vector m_sortElems = null;
- private Vector m_sortElems = null;
-
/**
* Get the count xsl:sort elements associated with this element.
* @return The number of xsl:sort elements.
@@ -122,76 +149,363 @@
{
return (m_sortElems == null) ? 0 : m_sortElems.size();
}
-
+
/**
* Get a xsl:sort element associated with this element.
+ *
+ * NEEDSDOC @param i
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public ElemSort getSortElem(int i)
{
- return (ElemSort)m_sortElems.elementAt(i);
+ return (ElemSort) m_sortElems.elementAt(i);
}
-
+
/**
* Set a xsl:sort element associated with this element.
+ *
+ * NEEDSDOC @param sortElem
*/
public void setSortElem(ElemSort sortElem)
{
- if(null == m_sortElems)
+
+ if (null == m_sortElems)
m_sortElems = new Vector();
+
m_sortElems.addElement(sortElem);
}
-
/**
* Get an int constant identifying the type of element.
* @see org.apache.xalan.templates.Constants
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public int getXSLToken()
{
return Constants.ELEMNAME_FOREACH;
}
-
- /**
+
+ /**
* Return the node name.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public String getNodeName()
{
return Constants.ELEMNAME_FOREACH_STRING;
}
- public void execute(TransformerImpl transformer,
- Node sourceNode,
- QName mode)
- throws SAXException
- {
+ /**
+ * NEEDSDOC Method execute
+ *
+ *
+ * NEEDSDOC @param transformer
+ * NEEDSDOC @param sourceNode
+ * NEEDSDOC @param mode
+ *
+ * @throws SAXException
+ */
+ public void execute(
+ TransformerImpl transformer, Node sourceNode, QName mode)
+ throws SAXException
+ {
+
transformer.pushCurrentTemplateRuleIsNull(true);
try
{
- if(TransformerImpl.S_DEBUG)
+ if (TransformerImpl.S_DEBUG)
transformer.getTraceManager().fireTraceEvent(sourceNode, mode, this);
- if(null != sourceNode)
- {
- transformer.transformSelectedNodes(getStylesheetComposed(),
- this,
- this,
- sourceNode, mode,
- m_selectExpression,
-
transformer.getXPathContext().getVarStack().getCurrentStackFrameIndex());
- }
- else // if(null == sourceNode)
+
+ transformSelectedNodes(transformer, sourceNode, this, mode);
+ }
+ finally
+ {
+ transformer.popCurrentTemplateRuleIsNull();
+ }
+ }
+
+ /**
+ * NEEDSDOC Method getTemplateMatch
+ *
+ *
+ * NEEDSDOC (getTemplateMatch) @return
+ */
+ protected ElemTemplateElement getTemplateMatch()
+ {
+ return this;
+ }
+
+ /**
+ * NEEDSDOC Method sortNodes
+ *
+ *
+ * NEEDSDOC @param xctxt
+ * NEEDSDOC @param keys
+ * NEEDSDOC @param sourceNodes
+ *
+ * NEEDSDOC (sortNodes) @return
+ *
+ * @throws SAXException
+ */
+ protected NodeIterator sortNodes(
+ XPathContext xctxt, Vector keys, NodeIterator sourceNodes)
+ throws SAXException
+ {
+
+ NodeSorter sorter = new NodeSorter(xctxt);
+ NodeSet nodeList;
+
+ if (sourceNodes instanceof NodeSet)
+ {
+ nodeList = ((NodeSet) sourceNodes);
+
+ nodeList.setShouldCacheNodes(true);
+ nodeList.runTo(-1);
+ }
+ else
+ {
+ nodeList = new NodeSet(sourceNodes);
+ sourceNodes = nodeList;
+
+ ((ContextNodeList) sourceNodes).setCurrentPos(0);
+ }
+
+ xctxt.pushContextNodeList((ContextNodeList) sourceNodes);
+
+ try
+ {
+ sorter.sort(nodeList, keys, xctxt);
+ nodeList.setCurrentPos(0);
+ }
+ finally
+ {
+ xctxt.popContextNodeList();
+ }
+
+ return sourceNodes;
+ }
+
+ /**
+ * NEEDSDOC Method needToPushParams
+ *
+ *
+ * NEEDSDOC (needToPushParams) @return
+ */
+ boolean needToPushParams()
+ {
+ return false;
+ }
+
+ /**
+ * NEEDSDOC Method pushParams
+ *
+ *
+ * NEEDSDOC @param transformer
+ * NEEDSDOC @param xctxt
+ * NEEDSDOC @param sourceNode
+ * NEEDSDOC @param mode
+ *
+ * @throws SAXException
+ */
+ void pushParams(
+ TransformerImpl transformer, XPathContext xctxt, Node sourceNode,
QName mode)
+ throws SAXException
+ {
+
+ VariableStack vars = xctxt.getVarStack();
+
+ vars.pushElemFrame();
+ }
+
+ /**
+ * NEEDSDOC Method popParams
+ *
+ *
+ * NEEDSDOC @param xctxt
+ */
+ void popParams(XPathContext xctxt)
+ {
+
+ VariableStack vars = xctxt.getVarStack();
+
+ vars.popElemFrame();
+ }
+
+ /**
+ * <meta name="usage" content="advanced"/>
+ * Perform a query if needed, and call transformNode for each child.
+ *
+ *
+ * NEEDSDOC @param transformer
+ * NEEDSDOC @param sourceNode
+ * @exception SAXException Thrown in a variety of circumstances.
+ * @param stylesheetTree The owning stylesheet tree.
+ * @param xslInstruction The stylesheet element context (depricated -- I do
+ * not think we need this).
+ * @param template The owning template context.
+ * @param sourceNodeContext The current source node context.
+ * @param mode The current mode.
+ * @param selectPattern The XPath with which to perform the selection.
+ * @param xslToken The current XSLT instruction (depricated -- I do not
+ * think we want this).
+ * @param tcontext The TransformerImpl context.
+ * @param selectStackFrameIndex The stack frame context for executing the
+ * select statement.
+ */
+ public void transformSelectedNodes(
+ TransformerImpl transformer, Node sourceNode, ElemTemplateElement
template, QName mode)
+ throws SAXException
+ {
+
+ XPathContext xctxt = transformer.getXPathContext();
+ XPath selectPattern = getSelectOrDefault();
+ XObject selectResult = selectPattern.execute(xctxt, sourceNode, this);
+ Vector keys = transformer.processSortKeys(this, sourceNode);
+ NodeIterator sourceNodes = selectResult.nodeset();
+
+ // Sort if we need to.
+ if (null != keys)
+ sourceNodes = sortNodes(xctxt, keys, sourceNodes);
+
+ pushParams(transformer, xctxt, sourceNode, mode);
+
+ // Push the ContextNodeList on a stack, so that select="position()"
+ // and the like will work.
+ // System.out.println("pushing context node list...");
+ Locator savedLocator = xctxt.getSAXLocator();
+
+ xctxt.pushContextNodeList((ContextNodeList) sourceNodes);
+ transformer.pushElemTemplateElement(null);
+
+ ResultTreeHandler rth = transformer.getResultTreeHandler();
+ StylesheetRoot sroot = getStylesheetRoot();
+ TemplateList tl = sroot.getTemplateListComposed();
+
+ // StylesheetComposed stylesheet = getStylesheetComposed();
+ StackGuard guard = transformer.getStackGuard();
+ boolean check = (guard.m_recursionLimit > -1);
+ boolean quiet = transformer.getQuietConflictWarnings();
+ boolean rdebug = TransformerImpl.S_DEBUG;
+ boolean needToFindTemplate = (null == template);
+
+ try
+ {
+ Node child;
+
+ while (null != (child = sourceNodes.nextNode()))
{
- transformer.getMsgMgr().error(this, sourceNode,
XSLTErrorResources.ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES);
- //"sourceNode is null in handleApplyTemplatesInstruction!");
+ if (needToFindTemplate)
+ {
+ template = tl.getTemplate(xctxt, child, mode, quiet);
+
+ // If that didn't locate a node, fall back to a default template
rule.
+ // See http://www.w3.org/TR/xslt#built-in-rule.
+ if (null == template)
+ {
+ switch (child.getNodeType())
+ {
+ case Node.DOCUMENT_FRAGMENT_NODE :
+ case Node.ELEMENT_NODE :
+ template = sroot.getDefaultRule();
+ break;
+ case Node.CDATA_SECTION_NODE :
+ if (child.supports(SaxEventDispatch.SUPPORTSINTERFACE, "1.0"))
+ {
+ ((SaxEventDispatch) child).dispatchSaxEvent(rth);
+ }
+ else
+ {
+ rth.startCDATA();
+
+ String data = child.getNodeValue();
+
+ rth.characters(data.toCharArray(), 0, data.length());
+ rth.endCDATA();
+ }
+
+ continue;
+ case Node.TEXT_NODE :
+ if (child.supports(SaxEventDispatch.SUPPORTSINTERFACE, "1.0"))
+ {
+ ((SaxEventDispatch) child).dispatchSaxEvent(rth);
+ }
+ else
+ {
+ String data = child.getNodeValue();
+
+ rth.characters(data.toCharArray(), 0, data.length());
+ }
+
+ continue;
+ case Node.ATTRIBUTE_NODE :
+ String data = child.getNodeValue();
+
+ rth.characters(data.toCharArray(), 0, data.length());
+
+ continue;
+ case Node.DOCUMENT_NODE :
+ template = sroot.getDefaultRootRule();
+ break;
+ default :
+
+ // No default rules for processing instructions and the like.
+ continue;
+ }
+ }
+ }
+
+ // If we are processing the default text rule, then just clone
+ // the value directly to the result tree.
+ try
+ {
+ transformer.pushPairCurrentMatched(template, child);
+
+ if (check)
+ guard.push(this, child);
+
+ // Fire a trace event for the template.
+ if (rdebug)
+ transformer.getTraceManager().fireTraceEvent(child, mode,
+ template);
+
+ // And execute the child templates.
+ if (template.isCompiledTemplate())
+ template.execute(transformer, child, mode);
+ else
+ {
+
+ // Loop through the children of the template, calling execute on
+ // each of them.
+ for (ElemTemplateElement t = template.m_firstChild; t != null;
+ t = t.m_nextSibling)
+ {
+ xctxt.setSAXLocator(t);
+ transformer.setCurrentElement(t);
+ t.execute(transformer, child, mode);
+ }
+ }
+ }
+ finally
+ {
+ transformer.popCurrentMatched();
+
+ if (check)
+ guard.pop();
+ }
}
}
-
finally
{
- transformer.popCurrentTemplateRuleIsNull();
+ xctxt.setSAXLocator(savedLocator);
+ xctxt.popContextNodeList();
+ transformer.popElemTemplateElement();
+ popParams(xctxt);
}
}
-
+
/**
* Add a child to the child list.
* <!ELEMENT xsl:apply-templates (xsl:sort|xsl:with-param)*>
@@ -199,17 +513,25 @@
* select %expr; "node()"
* mode %qname; #IMPLIED
* >
+ *
+ * NEEDSDOC @param newChild
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws DOMException
*/
- public Node appendChild(Node newChild)
- throws DOMException
+ public Node appendChild(Node newChild) throws DOMException
{
- int type = ((ElemTemplateElement)newChild).getXSLToken();
- if(Constants.ELEMNAME_SORT == type)
+
+ int type = ((ElemTemplateElement) newChild).getXSLToken();
+
+ if (Constants.ELEMNAME_SORT == type)
{
- setSortElem((ElemSort)newChild);
- }
+ setSortElem((ElemSort) newChild);
- return super.appendChild(newChild);
+ return newChild;
+ }
+ else
+ return super.appendChild(newChild);
}
-
}
1.3 +42 -22 xml-xalan/java/src/org/apache/xalan/templates/ElemIf.java
Index: ElemIf.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemIf.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ElemIf.java 2000/07/05 14:40:10 1.2
+++ ElemIf.java 2000/10/30 18:49:50 1.3
@@ -57,7 +57,9 @@
package org.apache.xalan.templates;
import org.w3c.dom.*;
+
import org.xml.sax.*;
+
import org.apache.xpath.*;
import org.apache.xpath.objects.XObject;
import org.apache.xalan.trace.SelectionEvent;
@@ -79,14 +81,17 @@
*/
public class ElemIf extends ElemTemplateElement
{
+
/**
- * The xsl:if element must have a test attribute, which specifies an
expression.
+ * The xsl:if element must have a test attribute, which specifies an
expression.
*/
private XPath m_test = null;
-
+
/**
- * Set the "test" attribute.
- * The xsl:if element must have a test attribute, which specifies an
expression.
+ * Set the "test" attribute.
+ * The xsl:if element must have a test attribute, which specifies an
expression.
+ *
+ * NEEDSDOC @param v
*/
public void setTest(XPath v)
{
@@ -94,8 +99,10 @@
}
/**
- * Get the "test" attribute.
- * The xsl:if element must have a test attribute, which specifies an
expression.
+ * Get the "test" attribute.
+ * The xsl:if element must have a test attribute, which specifies an
expression.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public XPath getTest()
{
@@ -105,40 +112,53 @@
/**
* Get an int constant identifying the type of element.
* @see org.apache.xalan.templates.Constants
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public int getXSLToken()
{
return Constants.ELEMNAME_IF;
}
-
- /**
+
+ /**
* Return the node name.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public String getNodeName()
{
return Constants.ELEMNAME_IF_STRING;
}
-
+
/**
* Conditionally execute a sub-template.
- * The expression is evaluated and the resulting object is converted
- * to a boolean as if by a call to the boolean function. If the result
- * is true, then the content template is instantiated; otherwise, nothing
+ * The expression is evaluated and the resulting object is converted
+ * to a boolean as if by a call to the boolean function. If the result
+ * is true, then the content template is instantiated; otherwise, nothing
* is created.
- */
- public void execute(TransformerImpl transformer,
- Node sourceNode,
- QName mode)
- throws SAXException
- {
- if(TransformerImpl.S_DEBUG)
+ *
+ * NEEDSDOC @param transformer
+ * NEEDSDOC @param sourceNode
+ * NEEDSDOC @param mode
+ *
+ * @throws SAXException
+ */
+ public void execute(
+ TransformerImpl transformer, Node sourceNode, QName mode)
+ throws SAXException
+ {
+
+ if (TransformerImpl.S_DEBUG)
transformer.getTraceManager().fireTraceEvent(sourceNode, mode, this);
XPathContext xctxt = transformer.getXPathContext();
XObject test = m_test.execute(xctxt, sourceNode, this);
- if(TransformerImpl.S_DEBUG)
- transformer.getTraceManager().fireSelectedEvent(sourceNode, this,
"test", m_test, test);
- if(test.bool())
+
+ if (TransformerImpl.S_DEBUG)
+ transformer.getTraceManager().fireSelectedEvent(sourceNode, this,
+ "test", m_test, test);
+
+ if (test.bool())
{
transformer.executeChildTemplates(this, sourceNode, mode);
}
1.9 +236 -118
xml-xalan/java/src/org/apache/xalan/templates/ElemLiteralResult.java
Index: ElemLiteralResult.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemLiteralResult.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- ElemLiteralResult.java 2000/10/17 19:03:08 1.8
+++ ElemLiteralResult.java 2000/10/30 18:49:50 1.9
@@ -57,9 +57,12 @@
package org.apache.xalan.templates;
import org.w3c.dom.*;
+
import org.xml.sax.*;
import org.xml.sax.helpers.*;
+
import java.util.StringTokenizer;
+
import org.apache.xalan.utils.QName;
import org.apache.xalan.utils.NameSpace;
import org.apache.xpath.XPathContext;
@@ -71,8 +74,8 @@
import org.apache.xalan.transformer.ResultTreeHandler;
import java.io.*;
-import java.util.*;
+import java.util.*;
/**
* <meta name="usage" content="advanced"/>
@@ -81,62 +84,110 @@
*/
public class ElemLiteralResult extends ElemUse
{
+
/**
- * The created element node will have the attribute nodes
- * that were present on the element node in the stylesheet tree,
+ * Tells if this element represents a root element
+ * that is also the stylesheet element.
+ */
+ private boolean isLiteralResultAsStylesheet = false;
+
+ /**
+ * NEEDSDOC Method setIsLiteralResultAsStylesheet
+ *
+ *
+ * NEEDSDOC @param b
+ */
+ public void setIsLiteralResultAsStylesheet(boolean b)
+ {
+ isLiteralResultAsStylesheet = b;
+ }
+
+ /**
+ * NEEDSDOC Method getIsLiteralResultAsStylesheet
+ *
+ *
+ * NEEDSDOC (getIsLiteralResultAsStylesheet) @return
+ */
+ public boolean getIsLiteralResultAsStylesheet()
+ {
+ return isLiteralResultAsStylesheet;
+ }
+
+ /**
+ * The created element node will have the attribute nodes
+ * that were present on the element node in the stylesheet tree,
* other than attributes with names in the XSLT namespace.
*/
private Vector m_avts = null;
-
+
+ /** NEEDSDOC Field m_xslAttr */
private Vector m_xslAttr = null;
-
+
/**
* Set a literal result attribute (AVTs only).
+ *
+ * NEEDSDOC @param avt
*/
public void addLiteralResultAttribute(AVT avt)
{
- if(null == m_avts)
+
+ if (null == m_avts)
m_avts = new Vector();
- m_avts.addElement(avt);
+
+ m_avts.addElement(avt);
}
-
+
/**
* Set a literal result attribute (used for xsl attributes).
+ *
+ * NEEDSDOC @param att
*/
public void addLiteralResultAttribute(String att)
{
- if(null == m_xslAttr)
+
+ if (null == m_xslAttr)
m_xslAttr = new Vector();
- m_xslAttr.addElement(att);
+
+ m_xslAttr.addElement(att);
}
-
+
/**
* Get a literal result attribute by name.
+ *
+ * NEEDSDOC @param name
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public AVT getLiteralResultAttribute(String name)
{
- if(null != m_avts)
+
+ if (null != m_avts)
{
int nAttrs = m_avts.size();
- for(int i = (nAttrs-1); i >= 0; i--)
+
+ for (int i = (nAttrs - 1); i >= 0; i--)
{
- AVT avt = (AVT)m_avts.elementAt(i);
- if(avt.getRawName().equals(name))
+ AVT avt = (AVT) m_avts.elementAt(i);
+
+ if (avt.getRawName().equals(name))
{
- return avt;
+ return avt;
}
- } // end for
+ } // end for
}
- return null;
- }
-
+
+ return null;
+ }
+
/**
* The namespace of the element to be created.
*/
private String m_namespace;
-
+
/**
* Set the m_namespace of the LRE.
+ *
+ * NEEDSDOC @param ns
*/
public void setNamespace(String ns)
{
@@ -145,6 +196,8 @@
/**
* Get the m_namespace of the Literal Result Element.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public String getNamespace()
{
@@ -155,9 +208,11 @@
* The raw name of the element to be created.
*/
private String m_localName;
-
+
/**
* Set the local name of the LRE.
+ *
+ * NEEDSDOC @param localName
*/
public void setLocalName(String localName)
{
@@ -166,20 +221,23 @@
/**
* Get the local name of the Literal Result Element.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public String getLocalName()
{
return m_localName;
}
-
/**
* The raw name of the element to be created.
*/
private String m_rawName;
-
+
/**
* Set the raw name of the LRE.
+ *
+ * NEEDSDOC @param rawName
*/
public void setRawName(String rawName)
{
@@ -188,6 +246,8 @@
/**
* Get the raw name of the Literal Result Element.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public String getRawName()
{
@@ -195,265 +255,323 @@
}
/**
- * The "extension-element-prefixes" property, actually contains URIs.
+ * The "extension-element-prefixes" property, actually contains URIs.
*/
private StringVector m_ExtensionElementURIs;
/**
- * Set the "extension-element-prefixes" property.
+ * Set the "extension-element-prefixes" property.
* @see <a
href="http://www.w3.org/TR/xslt#extension-element">extension-element in XSLT
Specification</a>
+ *
+ * NEEDSDOC @param v
*/
- public void setExtensionElementPrefixes (StringVector v)
+ public void setExtensionElementPrefixes(StringVector v)
{
m_ExtensionElementURIs = v;
}
/**
- * Get and "extension-element-prefix" property.
+ * Get and "extension-element-prefix" property.
* @see <a
href="http://www.w3.org/TR/xslt#extension-element">extension-element in XSLT
Specification</a>
+ *
+ * NEEDSDOC @param i
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws ArrayIndexOutOfBoundsException
*/
public String getExtensionElementPrefix(int i)
- throws ArrayIndexOutOfBoundsException
+ throws ArrayIndexOutOfBoundsException
{
- if(null == m_ExtensionElementURIs)
+
+ if (null == m_ExtensionElementURIs)
throw new ArrayIndexOutOfBoundsException();
+
return m_ExtensionElementURIs.elementAt(i);
}
-
+
/**
- * Get the number of "extension-element-prefixes" Strings.
+ * Get the number of "extension-element-prefixes" Strings.
* @see <a
href="http://www.w3.org/TR/xslt#extension-element">extension-element in XSLT
Specification</a>
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public int getExtensionElementPrefixCount()
{
- return (null != m_ExtensionElementURIs)
+ return (null != m_ExtensionElementURIs)
? m_ExtensionElementURIs.size() : 0;
}
-
+
/**
- * Get and "extension-element-prefix" property.
+ * Get and "extension-element-prefix" property.
* @see <a
href="http://www.w3.org/TR/xslt#extension-element">extension-element in XSLT
Specification</a>
+ *
+ * NEEDSDOC @param uri
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public boolean containsExtensionElementURI(String uri)
{
- if(null == m_ExtensionElementURIs)
+
+ if (null == m_ExtensionElementURIs)
return false;
+
return m_ExtensionElementURIs.contains(uri);
- }
+ }
/**
* Get an int constant identifying the type of element.
* @see org.apache.xalan.templates.Constants
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public int getXSLToken()
{
return Constants.ELEMNAME_LITERALRESULT;
}
-
- /**
+
+ /**
* Return the node name.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public String getNodeName()
{
+
// TODO: Need prefix.
return m_rawName;
}
-
+
/**
* The XSLT version as specified by this element.
*/
private String m_version;
-
+
/**
- * Set the "version" property.
+ * Set the "version" property.
* @see <a href="http://www.w3.org/TR/xslt#forwards">forwards in XSLT
Specification</a>
+ *
+ * NEEDSDOC @param v
*/
- public void setVersion (String v)
+ public void setVersion(String v)
{
m_version = v;
}
-
+
/**
* The "exclude-result-prefixes" property.
*/
private StringVector m_excludeResultPrefixes;
-
+
/**
- * Set the "exclude-result-prefixes" property.
- * The designation of a namespace as an excluded namespace is
- * effective within the subtree of the stylesheet rooted at
- * the element bearing the exclude-result-prefixes or
- * xsl:exclude-result-prefixes attribute; a subtree rooted
- * at an xsl:stylesheet element does not include any stylesheets
+ * Set the "exclude-result-prefixes" property.
+ * The designation of a namespace as an excluded namespace is
+ * effective within the subtree of the stylesheet rooted at
+ * the element bearing the exclude-result-prefixes or
+ * xsl:exclude-result-prefixes attribute; a subtree rooted
+ * at an xsl:stylesheet element does not include any stylesheets
* imported or included by children of that xsl:stylesheet element.
* @see <a
href="http://www.w3.org/TR/xslt#literal-result-element">literal-result-element
in XSLT Specification</a>
+ *
+ * NEEDSDOC @param v
*/
- public void setExcludeResultPrefixes (StringVector v)
+ public void setExcludeResultPrefixes(StringVector v)
{
m_excludeResultPrefixes = v;
}
-
+
/**
- * Tell if the result namespace decl should be excluded. Should be called
before
+ * Tell if the result namespace decl should be excluded. Should be called
before
* namespace aliasing (I think).
+ *
+ * NEEDSDOC @param prefix
+ * NEEDSDOC @param uri
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws SAXException
*/
private boolean excludeResultNSDecl(String prefix, String uri)
- throws SAXException
+ throws SAXException
{
- if(null != m_excludeResultPrefixes)
- {
+
+ if (null != m_excludeResultPrefixes)
+ {
if (m_excludeResultPrefixes.contains(prefix))
return true;
- }
- return false;
+ }
+
+ return false;
}
-
+
/**
- * Combine the parent's namespaces with this namespace
- * for fast processing, taking care to reference the
+ * Combine the parent's namespaces with this namespace
+ * for fast processing, taking care to reference the
* parent's namespace if this namespace adds nothing new.
- * (Recursive method, walking the elements depth-first,
+ * (Recursive method, walking the elements depth-first,
* processing parents before children).
* Overide super method to handle exclude-result-prefix attribute.
+ *
+ * @throws SAXException
*/
- public void resolvePrefixTables()
- throws SAXException
+ public void resolvePrefixTables() throws SAXException
{
+
// Always start with a fresh prefix table!
m_prefixTable = null;
+
Vector m_declaredPrefixes = getDeclaredPrefixes();
-
+
// If we have declared declarations, then we look for
// a parent that has namespace decls, and add them
// to this element's decls. Otherwise we just point
// to the parent that has decls.
- if(null != m_declaredPrefixes)
+ if (null != m_declaredPrefixes)
{
+
// Add this element's declared prefixes to the
// prefix table.
int n = m_declaredPrefixes.size();
- for(int i = 0; i < n; i++)
+
+ for (int i = 0; i < n; i++)
{
- XMLNSDecl decl = (XMLNSDecl)m_declaredPrefixes.elementAt(i);
+ XMLNSDecl decl = (XMLNSDecl) m_declaredPrefixes.elementAt(i);
String prefix = decl.getPrefix();
String uri = decl.getURI();
boolean shouldExclude = excludeResultNSDecl(prefix, uri);
+
// Create a new prefix table if one has not already been created.
- if(null == m_prefixTable)
+ if (null == m_prefixTable)
m_prefixTable = new Vector();
+
m_prefixTable.addElement(new XMLNSDecl(prefix, uri, shouldExclude));
}
}
-
- ElemTemplateElement parent = (ElemTemplateElement)this.getParentNode();
- if(null != parent)
+
+ ElemTemplateElement parent = (ElemTemplateElement) this.getParentNode();
+
+ if (null != parent)
{
+
// The prefix table of the parent should never be null!
Vector prefixes = parent.m_prefixTable;
- if (null == m_excludeResultPrefixes && null == m_prefixTable)
+
+ if (null == m_excludeResultPrefixes && null == m_prefixTable)
{
+
// Nothing to combine, so just use parent's table!
- this.m_prefixTable = parent.m_prefixTable;
+ this.m_prefixTable = parent.m_prefixTable;
}
- else
- {
+ else
+ {
if (null == m_prefixTable)
m_prefixTable = new Vector();
-
+
// Add the prefixes from the parent's prefix table.
int n = prefixes.size();
- for(int i = 0; i < n; i++)
+
+ for (int i = 0; i < n; i++)
{
- XMLNSDecl decl = (XMLNSDecl)prefixes.elementAt(i);
+ XMLNSDecl decl = (XMLNSDecl) prefixes.elementAt(i);
boolean isexcluded = decl.getIsExcluded();
+
if (!isexcluded)
- {
- boolean shouldExclude = excludeResultNSDecl(decl.getPrefix(),
decl.getURI());
- if(shouldExclude != isexcluded)
+ {
+ boolean shouldExclude = excludeResultNSDecl(decl.getPrefix(),
+ decl.getURI());
+
+ if (shouldExclude != isexcluded)
{
- decl = new XMLNSDecl(decl.getPrefix(), decl.getURI(),
shouldExclude);
+ decl = new XMLNSDecl(decl.getPrefix(), decl.getURI(),
+ shouldExclude);
}
}
+
m_prefixTable.addElement(decl);
}
-
}
}
- else if(null == m_prefixTable)
+ else if (null == m_prefixTable)
{
+
// Must be stylesheet element without any result prefixes!
m_prefixTable = new Vector();
}
-
+
// Resolve the children's prefix tables.
- for(ElemTemplateElement child = m_firstChild;
- child != null; child = child.m_nextSibling)
+ for (ElemTemplateElement child = m_firstChild; child != null;
+ child = child.m_nextSibling)
{
child.resolvePrefixTables();
}
}
-
/**
- * Copy a Literal Result Element into the Result tree, copy the
- * non-excluded namespace attributes, copy the attributes not
+ * Copy a Literal Result Element into the Result tree, copy the
+ * non-excluded namespace attributes, copy the attributes not
* of the XSLT namespace, and execute the children of the LRE.
* @see <a
href="http://www.w3.org/TR/xslt#literal-result-element">literal-result-element
in XSLT Specification</a>
- */
- public void execute(TransformerImpl transformer,
- Node sourceNode,
- QName mode)
- throws SAXException
+ *
+ * NEEDSDOC @param transformer
+ * NEEDSDOC @param sourceNode
+ * NEEDSDOC @param mode
+ *
+ * @throws SAXException
+ */
+ public void execute(
+ TransformerImpl transformer, Node sourceNode, QName mode)
+ throws SAXException
{
+
ResultTreeHandler rhandler = transformer.getResultTreeHandler();
-
+
// Add namespace declarations.
executeNSDecls(transformer);
-
rhandler.startElement(getNamespace(), getLocalName(), getRawName());
-
+
// Process any possible attributes from xsl:use-attribute-sets first
super.execute(transformer, sourceNode, mode);
-
+
//xsl:version, excludeResultPrefixes???
-
// Process the list of avts next
- if(null != m_avts)
+ if (null != m_avts)
{
int nAttrs = m_avts.size();
- for(int i = (nAttrs-1); i >= 0; i--)
+
+ for (int i = (nAttrs - 1); i >= 0; i--)
{
- AVT avt = (AVT)m_avts.elementAt(i);
+ AVT avt = (AVT) m_avts.elementAt(i);
XPathContext xctxt = transformer.getXPathContext();
String stringedValue = avt.evaluate(xctxt, sourceNode, this);
-
- if(null != stringedValue)
+
+ if (null != stringedValue)
{
+
// Important Note: I'm not going to check for excluded namespace
// prefixes here. It seems like it's to expensive, and I'm not
// even sure this is right. But I could be wrong, so this needs
// to be tested against other implementations.
rhandler.addAttribute(avt.getURI(), avt.getName(),
- avt.getRawName(),
- "CDATA", stringedValue);
+ avt.getRawName(), "CDATA", stringedValue);
}
- } // end for
- }
-
+ } // end for
+ }
+
// Now process all the elements in this subtree
// TODO: Process m_extensionElementPrefixes && m_attributeSetsNames
transformer.executeChildTemplates(this, sourceNode, mode);
-
- rhandler.endElement (getNamespace(), getLocalName(), getRawName());
+ rhandler.endElement(getNamespace(), getLocalName(), getRawName());
unexecuteNSDecls(transformer);
}
-
- /** Compiling templates requires that we be able to list the AVTs
+
+ /**
+ * Compiling templates requires that we be able to list the AVTs
* ADDED 9/5/2000 to support compilation experiment
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public Enumeration enumerateLiteralResultAttributes()
{
- return (null==m_avts) ? null : m_avts.elements();
+ return (null == m_avts) ? null : m_avts.elements();
}
-
}
1.3 +43 -26
xml-xalan/java/src/org/apache/xalan/templates/ElemMessage.java
Index: ElemMessage.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemMessage.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ElemMessage.java 2000/07/05 14:40:12 1.2
+++ ElemMessage.java 2000/10/30 18:49:52 1.3
@@ -57,7 +57,9 @@
package org.apache.xalan.templates;
import org.w3c.dom.*;
+
import org.xml.sax.*;
+
import org.apache.xpath.*;
import org.apache.xalan.utils.QName;
import org.apache.xalan.res.XSLTErrorResources;
@@ -77,18 +79,21 @@
*/
public class ElemMessage extends ElemTemplateElement
{
+
/**
- * If the terminate attribute has the value yes, then the
- * XSLT transformer should terminate processing after sending
+ * If the terminate attribute has the value yes, then the
+ * XSLT transformer should terminate processing after sending
* the message. The default value is no.
*/
- private boolean m_terminate = Constants.ATTRVAL_NO; // default value
-
+ private boolean m_terminate = Constants.ATTRVAL_NO; // default value
+
/**
- * Set the "terminate" attribute.
- * If the terminate attribute has the value yes, then the
- * XSLT transformer should terminate processing after sending
+ * Set the "terminate" attribute.
+ * If the terminate attribute has the value yes, then the
+ * XSLT transformer should terminate processing after sending
* the message. The default value is no.
+ *
+ * NEEDSDOC @param v
*/
public void setTerminate(boolean v)
{
@@ -96,51 +101,63 @@
}
/**
- * Get the "terminate" attribute.
- * If the terminate attribute has the value yes, then the
- * XSLT transformer should terminate processing after sending
+ * Get the "terminate" attribute.
+ * If the terminate attribute has the value yes, then the
+ * XSLT transformer should terminate processing after sending
* the message. The default value is no.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public boolean getTerminate()
{
return m_terminate;
}
-
+
/**
* Get an int constant identifying the type of element.
* @see org.apache.xalan.templates.Constants
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public int getXSLToken()
{
return Constants.ELEMNAME_MESSAGE;
}
-
- /**
+
+ /**
* Return the node name.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public String getNodeName()
{
return Constants.ELEMNAME_MESSAGE_STRING;
}
-
/**
* Send a message to diagnostics.
- * The xsl:message instruction sends a message in a way that
- * is dependent on the XSLT transformer. The content of the xsl:message
- * instruction is a template. The xsl:message is instantiated by
- * instantiating the content to create an XML fragment. This XML
+ * The xsl:message instruction sends a message in a way that
+ * is dependent on the XSLT transformer. The content of the xsl:message
+ * instruction is a template. The xsl:message is instantiated by
+ * instantiating the content to create an XML fragment. This XML
* fragment is the content of the message.
- */
- public void execute(TransformerImpl transformer,
- Node sourceNode,
- QName mode)
- throws SAXException
- {
- if(TransformerImpl.S_DEBUG)
+ *
+ * NEEDSDOC @param transformer
+ * NEEDSDOC @param sourceNode
+ * NEEDSDOC @param mode
+ *
+ * @throws SAXException
+ */
+ public void execute(
+ TransformerImpl transformer, Node sourceNode, QName mode)
+ throws SAXException
+ {
+
+ if (TransformerImpl.S_DEBUG)
transformer.getTraceManager().fireTraceEvent(sourceNode, mode, this);
String data = transformer.transformToString(this, sourceNode, mode);
- transformer.getMsgMgr().message(data, m_terminate);
+
+ transformer.getMsgMgr().message(data, m_terminate);
}
}
1.8 +997 -646
xml-xalan/java/src/org/apache/xalan/templates/ElemNumber.java
Index: ElemNumber.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemNumber.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ElemNumber.java 2000/10/18 04:36:43 1.7
+++ ElemNumber.java 2000/10/30 18:49:52 1.8
@@ -1,66 +1,68 @@
/*
-* The Apache Software License, Version 1.1
-*
-*
-* Copyright (c) 1999 The Apache Software Foundation. All rights
-* reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions
-* are met:
-*
-* 1. Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-*
-* 2. Redistributions in binary form must reproduce the above copyright
-* notice, this list of conditions and the following disclaimer in
-* the documentation and/or other materials provided with the
-* distribution.
-*
-* 3. The end-user documentation included with the redistribution,
-* if any, must include the following acknowledgment:
-* "This product includes software developed by the
-* Apache Software Foundation (http://www.apache.org/)."
-* Alternately, this acknowledgment may appear in the software itself,
-* if and wherever such third-party acknowledgments normally appear.
-*
-* 4. The names "Xalan" and "Apache Software Foundation" must
-* not be used to endorse or promote products derived from this
-* software without prior written permission. For written
-* permission, please contact [EMAIL PROTECTED]
-*
-* 5. Products derived from this software may not be called "Apache",
-* nor may "Apache" appear in their name, without prior written
-* permission of the Apache Software Foundation.
-*
-* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
-* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
-* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-* SUCH DAMAGE.
-* ====================================================================
-*
-* This software consists of voluntary contributions made by many
-* individuals on behalf of the Apache Software Foundation and was
-* originally based on software copyright (c) 1999, Lotus
-* Development Corporation., http://www.lotus.com. For more
-* information on the Apache Software Foundation, please see
-* <http://www.apache.org/>.
-*/
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Xalan" and "Apache Software Foundation" must
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written
+ * permission, please contact [EMAIL PROTECTED]
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * nor may "Apache" appear in their name, without prior written
+ * permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation and was
+ * originally based on software copyright (c) 1999, Lotus
+ * Development Corporation., http://www.lotus.com. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.xalan.templates;
import org.w3c.dom.*;
import org.w3c.dom.traversal.NodeIterator;
+
import org.xml.sax.*;
import java.util.*;
+
import java.text.NumberFormat;
import java.text.DecimalFormat;
@@ -75,6 +77,7 @@
import org.apache.xalan.transformer.CountersTable;
import org.apache.xalan.transformer.TransformerImpl;
import org.apache.xalan.utils.NodeVector;
+
// import org.apache.xalan.dtm.*;
/**
@@ -98,19 +101,22 @@
*/
public class ElemNumber extends ElemTemplateElement
{
+
/**
* Only nodes are counted that match this pattern.
*/
private XPath m_countMatchPattern = null;
-
+
/**
- * Set the "count" attribute.
- * The count attribute is a pattern that specifies what nodes
- * should be counted at those levels. If count attribute is not
- * specified, then it defaults to the pattern that matches any
- * node with the same node type as the current node and, if the
- * current node has an expanded-name, with the same expanded-name
+ * Set the "count" attribute.
+ * The count attribute is a pattern that specifies what nodes
+ * should be counted at those levels. If count attribute is not
+ * specified, then it defaults to the pattern that matches any
+ * node with the same node type as the current node and, if the
+ * current node has an expanded-name, with the same expanded-name
* as the current node.
+ *
+ * NEEDSDOC @param v
*/
public void setCount(XPath v)
{
@@ -118,40 +124,44 @@
}
/**
- * Get the "count" attribute.
- * The count attribute is a pattern that specifies what nodes
- * should be counted at those levels. If count attribute is not
- * specified, then it defaults to the pattern that matches any
- * node with the same node type as the current node and, if the
- * current node has an expanded-name, with the same expanded-name
+ * Get the "count" attribute.
+ * The count attribute is a pattern that specifies what nodes
+ * should be counted at those levels. If count attribute is not
+ * specified, then it defaults to the pattern that matches any
+ * node with the same node type as the current node and, if the
+ * current node has an expanded-name, with the same expanded-name
* as the current node.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public XPath getCount()
{
return m_countMatchPattern;
}
-
+
/**
* Specifies where to count from.
* For level="single" or level="multiple":
- * Only ancestors that are searched are
- * those that are descendants of the nearest ancestor that matches
+ * Only ancestors that are searched are
+ * those that are descendants of the nearest ancestor that matches
* the from pattern.
* For level="any:
- * Only nodes after the first node before the
+ * Only nodes after the first node before the
* current node that match the from pattern are considered.
*/
private XPath m_fromMatchPattern = null;
-
+
/**
* Set the "from" attribute. Specifies where to count from.
* For level="single" or level="multiple":
- * Only ancestors that are searched are
- * those that are descendants of the nearest ancestor that matches
+ * Only ancestors that are searched are
+ * those that are descendants of the nearest ancestor that matches
* the from pattern.
* For level="any:
- * Only nodes after the first node before the
+ * Only nodes after the first node before the
* current node that match the from pattern are considered.
+ *
+ * NEEDSDOC @param v
*/
public void setFrom(XPath v)
{
@@ -159,52 +169,56 @@
}
/**
- * Get the "from" attribute.
+ * Get the "from" attribute.
* For level="single" or level="multiple":
- * Only ancestors that are searched are
- * those that are descendants of the nearest ancestor that matches
+ * Only ancestors that are searched are
+ * those that are descendants of the nearest ancestor that matches
* the from pattern.
* For level="any:
- * Only nodes after the first node before the
+ * Only nodes after the first node before the
* current node that match the from pattern are considered.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public XPath getFrom()
{
return m_fromMatchPattern;
}
-
+
/**
- * When level="single", it goes up to the first node in the
ancestor-or-self axis
- * that matches the count pattern, and constructs a list of length one
containing
- * one plus the number of preceding siblings of that ancestor that match
the count
- * pattern. If there is no such ancestor, it constructs an empty list. If
the from
- * attribute is specified, then the only ancestors that are searched are
those
- * that are descendants of the nearest ancestor that matches the from
pattern.
+ * When level="single", it goes up to the first node in the
ancestor-or-self axis
+ * that matches the count pattern, and constructs a list of length one
containing
+ * one plus the number of preceding siblings of that ancestor that match
the count
+ * pattern. If there is no such ancestor, it constructs an empty list. If
the from
+ * attribute is specified, then the only ancestors that are searched are
those
+ * that are descendants of the nearest ancestor that matches the from
pattern.
* Preceding siblings has the same meaning here as with the
preceding-sibling axis.
- *
- * When level="multiple", it constructs a list of all ancestors of the
current node
- * in document order followed by the element itself; it then selects from
the list
- * those nodes that match the count pattern; it then maps each node in the
list to
- * one plus the number of preceding siblings of that node that match the
count pattern.
- * If the from attribute is specified, then the only ancestors that are
searched are
- * those that are descendants of the nearest ancestor that matches the
from pattern.
+ *
+ * When level="multiple", it constructs a list of all ancestors of the
current node
+ * in document order followed by the element itself; it then selects from
the list
+ * those nodes that match the count pattern; it then maps each node in the
list to
+ * one plus the number of preceding siblings of that node that match the
count pattern.
+ * If the from attribute is specified, then the only ancestors that are
searched are
+ * those that are descendants of the nearest ancestor that matches the
from pattern.
* Preceding siblings has the same meaning here as with the
preceding-sibling axis.
- *
- * When level="any", it constructs a list of length one containing the
number of
- * nodes that match the count pattern and belong to the set containing the
current
- * node and all nodes at any level of the document that are before the
current node
- * in document order, excluding any namespace and attribute nodes (in
other words
- * the union of the members of the preceding and ancestor-or-self axes).
If the
- * from attribute is specified, then only nodes after the first node
before the
+ *
+ * When level="any", it constructs a list of length one containing the
number of
+ * nodes that match the count pattern and belong to the set containing the
current
+ * node and all nodes at any level of the document that are before the
current node
+ * in document order, excluding any namespace and attribute nodes (in
other words
+ * the union of the members of the preceding and ancestor-or-self axes).
If the
+ * from attribute is specified, then only nodes after the first node
before the
* current node that match the from pattern are considered.
*/
private int m_level = Constants.NUMBERLEVEL_SINGLE;
-
+
/**
- * Set the "level" attribute.
- * The level attribute specifies what levels of the source tree should
- * be considered; it has the values single, multiple or any. The default
+ * Set the "level" attribute.
+ * The level attribute specifies what levels of the source tree should
+ * be considered; it has the values single, multiple or any. The default
* is single.
+ *
+ * NEEDSDOC @param v
*/
public void setLevel(int v)
{
@@ -212,10 +226,12 @@
}
/**
- * Get the "level" attribute.
- * The level attribute specifies what levels of the source tree should
- * be considered; it has the values single, multiple or any. The default
+ * Get the "level" attribute.
+ * The level attribute specifies what levels of the source tree should
+ * be considered; it has the values single, multiple or any. The default
* is single.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public int getLevel()
{
@@ -223,17 +239,19 @@
}
/**
- * The value attribute contains an expression. The expression is evaluated
- * and the resulting object is converted to a number as if by a call to
the
- * number function.
+ * The value attribute contains an expression. The expression is evaluated
+ * and the resulting object is converted to a number as if by a call to the
+ * number function.
*/
private XPath m_valueExpr = null;
-
+
/**
- * Set the "value" attribute.
- * The value attribute contains an expression. The expression is evaluated
- * and the resulting object is converted to a number as if by a call to
the
- * number function.
+ * Set the "value" attribute.
+ * The value attribute contains an expression. The expression is evaluated
+ * and the resulting object is converted to a number as if by a call to the
+ * number function.
+ *
+ * NEEDSDOC @param v
*/
public void setValue(XPath v)
{
@@ -241,28 +259,32 @@
}
/**
- * Get the "value" attribute.
- * The value attribute contains an expression. The expression is evaluated
- * and the resulting object is converted to a number as if by a call to
the
- * number function.
+ * Get the "value" attribute.
+ * The value attribute contains an expression. The expression is evaluated
+ * and the resulting object is converted to a number as if by a call to the
+ * number function.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public XPath getValue()
{
return m_valueExpr;
}
-
+
/**
- * The "format" attribute is used to control conversion of a list of
- * numbers into a string.
+ * The "format" attribute is used to control conversion of a list of
+ * numbers into a string.
* @see <a href="http://www.w3.org/TR/xslt#convert">convert in XSLT
Specification</a>
*/
private AVT m_format_avt = null;
-
+
/**
- * Set the "format" attribute.
- * The "format" attribute is used to control conversion of a list of
- * numbers into a string.
+ * Set the "format" attribute.
+ * The "format" attribute is used to control conversion of a list of
+ * numbers into a string.
* @see <a href="http://www.w3.org/TR/xslt#convert">convert in XSLT
Specification</a>
+ *
+ * NEEDSDOC @param v
*/
public void setFormat(AVT v)
{
@@ -270,30 +292,34 @@
}
/**
- * Get the "format" attribute.
- * The "format" attribute is used to control conversion of a list of
- * numbers into a string.
+ * Get the "format" attribute.
+ * The "format" attribute is used to control conversion of a list of
+ * numbers into a string.
* @see <a href="http://www.w3.org/TR/xslt#convert">convert in XSLT
Specification</a>
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public AVT getFormat()
{
return m_format_avt;
- }
-
+ }
+
/**
- * When numbering with an alphabetic sequence, the lang attribute
+ * When numbering with an alphabetic sequence, the lang attribute
* specifies which language's alphabet is to be used.
*/
private AVT m_lang_avt = null;
-
+
/**
- * Set the "lang" attribute.
- * When numbering with an alphabetic sequence, the lang attribute
- * specifies which language's alphabet is to be used; it has the same
- * range of values as xml:lang [XML]; if no lang value is specified,
- * the language should be determined from the system environment.
+ * Set the "lang" attribute.
+ * When numbering with an alphabetic sequence, the lang attribute
+ * specifies which language's alphabet is to be used; it has the same
+ * range of values as xml:lang [XML]; if no lang value is specified,
+ * the language should be determined from the system environment.
* Implementers should document for which languages they support numbering.
* @see <a href="http://www.w3.org/TR/xslt#convert">convert in XSLT
Specification</a>
+ *
+ * NEEDSDOC @param v
*/
public void setLang(AVT v)
{
@@ -301,30 +327,34 @@
}
/**
- * Get the "lang" attribute.
- * When numbering with an alphabetic sequence, the lang attribute
- * specifies which language's alphabet is to be used; it has the same
- * range of values as xml:lang [XML]; if no lang value is specified,
- * the language should be determined from the system environment.
+ * Get the "lang" attribute.
+ * When numbering with an alphabetic sequence, the lang attribute
+ * specifies which language's alphabet is to be used; it has the same
+ * range of values as xml:lang [XML]; if no lang value is specified,
+ * the language should be determined from the system environment.
* Implementers should document for which languages they support numbering.
* @see <a href="http://www.w3.org/TR/xslt#convert">convert in XSLT
Specification</a>
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public AVT getLang()
{
return m_lang_avt;
- }
-
+ }
+
/**
- * The letter-value attribute disambiguates between numbering
- * sequences that use letters.
+ * The letter-value attribute disambiguates between numbering
+ * sequences that use letters.
*/
private AVT m_lettervalue_avt = null;
-
+
/**
- * Set the "letter-value" attribute.
- * The letter-value attribute disambiguates between numbering sequences
+ * Set the "letter-value" attribute.
+ * The letter-value attribute disambiguates between numbering sequences
* that use letters.
* @see <a href="http://www.w3.org/TR/xslt#convert">convert in XSLT
Specification</a>
+ *
+ * NEEDSDOC @param v
*/
public void setLetterValue(AVT v)
{
@@ -332,29 +362,33 @@
}
/**
- * Get the "letter-value" attribute.
- * The letter-value attribute disambiguates between numbering sequences
+ * Get the "letter-value" attribute.
+ * The letter-value attribute disambiguates between numbering sequences
* that use letters.
* @see <a href="http://www.w3.org/TR/xslt#convert">convert in XSLT
Specification</a>
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public AVT getLetterValue()
{
return m_lettervalue_avt;
- }
-
+ }
+
/**
- * The grouping-separator attribute gives the separator
- * used as a grouping (e.g. thousands) separator in decimal
+ * The grouping-separator attribute gives the separator
+ * used as a grouping (e.g. thousands) separator in decimal
* numbering sequences.
*/
private AVT m_groupingSeparator_avt = null;
-
+
/**
- * Set the "grouping-separator" attribute.
- * The grouping-separator attribute gives the separator
- * used as a grouping (e.g. thousands) separator in decimal
+ * Set the "grouping-separator" attribute.
+ * The grouping-separator attribute gives the separator
+ * used as a grouping (e.g. thousands) separator in decimal
* numbering sequences.
* @see <a href="http://www.w3.org/TR/xslt#convert">convert in XSLT
Specification</a>
+ *
+ * NEEDSDOC @param v
*/
public void setGroupingSeparator(AVT v)
{
@@ -362,26 +396,30 @@
}
/**
- * Get the "grouping-separator" attribute.
- * The grouping-separator attribute gives the separator
- * used as a grouping (e.g. thousands) separator in decimal
+ * Get the "grouping-separator" attribute.
+ * The grouping-separator attribute gives the separator
+ * used as a grouping (e.g. thousands) separator in decimal
* numbering sequences.
* @see <a href="http://www.w3.org/TR/xslt#convert">convert in XSLT
Specification</a>
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public AVT getGroupingSeparator()
{
return m_groupingSeparator_avt;
- }
-
+ }
+
/**
- * The optional grouping-size specifies the size (normally 3) of the
grouping.
+ * The optional grouping-size specifies the size (normally 3) of the
grouping.
*/
private AVT m_groupingSize_avt = null;
-
+
/**
- * Set the "grouping-size" attribute.
- * The optional grouping-size specifies the size (normally 3) of the
grouping.
+ * Set the "grouping-size" attribute.
+ * The optional grouping-size specifies the size (normally 3) of the
grouping.
* @see <a href="http://www.w3.org/TR/xslt#convert">convert in XSLT
Specification</a>
+ *
+ * NEEDSDOC @param v
*/
public void setGroupingSize(AVT v)
{
@@ -389,35 +427,36 @@
}
/**
- * Get the "grouping-size" attribute.
- * The optional grouping-size specifies the size (normally 3) of the
grouping.
+ * Get the "grouping-size" attribute.
+ * The optional grouping-size specifies the size (normally 3) of the
grouping.
* @see <a href="http://www.w3.org/TR/xslt#convert">convert in XSLT
Specification</a>
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public AVT getGroupingSize()
{
return m_groupingSize_avt;
- }
-
+ }
+
/**
* Shouldn't this be in the transformer? Big worries about threads...
*/
- // private XSLTResourceBundle thisBundle;
+
+ // private XSLTResourceBundle thisBundle;
/**
* Table to help in converting decimals to roman numerals.
* @see TransformerImpl#DecimalToRoman
* @see TransformerImpl#long2roman
*/
- private final static DecimalToRoman m_romanConvertTable[] =
- {
+ private final static DecimalToRoman m_romanConvertTable[] = {
new DecimalToRoman(1000, "M", 900, "CM"),
new DecimalToRoman(500, "D", 400, "CD"),
new DecimalToRoman(100L, "C", 90L, "XC"),
new DecimalToRoman(50L, "L", 40L, "XL"),
new DecimalToRoman(10L, "X", 9L, "IX"),
new DecimalToRoman(5L, "V", 4L, "IV"),
- new DecimalToRoman(1L, "I", 1L, "I")
- };
+ new DecimalToRoman(1L, "I", 1L, "I") };
/**
* Chars for converting integers into alpha counts.
@@ -428,14 +467,18 @@
/**
* Get an int constant identifying the type of element.
* @see org.apache.xalan.templates.Constants
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public int getXSLToken()
{
return Constants.ELEMNAME_NUMBER;
}
-
- /**
+
+ /**
* Return the node name.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public String getNodeName()
{
@@ -443,64 +486,87 @@
}
/**
- * Execute an xsl:number instruction. The xsl:number element is
- * used to insert a formatted number into the result tree.
+ * Execute an xsl:number instruction. The xsl:number element is
+ * used to insert a formatted number into the result tree.
+ *
+ * NEEDSDOC @param transformer
+ * NEEDSDOC @param sourceNode
+ * NEEDSDOC @param mode
+ *
+ * @throws SAXException
*/
- public void execute(TransformerImpl transformer,
- Node sourceNode,
- QName mode)
- throws SAXException
+ public void execute(
+ TransformerImpl transformer, Node sourceNode, QName mode)
+ throws SAXException
{
- if(TransformerImpl.S_DEBUG)
- transformer.getTraceManager().fireTraceEvent(sourceNode, mode, this);
+
+ if (TransformerImpl.S_DEBUG)
+ transformer.getTraceManager().fireTraceEvent(sourceNode, mode, this);
String countString = getCountString(transformer, sourceNode);
- transformer.getResultTreeHandler().characters(countString.toCharArray(),
0, countString.length());
+ transformer.getResultTreeHandler().characters(countString.toCharArray(),
+ 0, countString.length());
}
/**
* Add a child to the child list.
+ *
+ * NEEDSDOC @param newChild
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws DOMException
*/
- public Node appendChild(Node newChild)
- throws DOMException
+ public Node appendChild(Node newChild) throws DOMException
{
- error(XSLTErrorResources.ER_CANNOT_ADD, new Object[]
{newChild.getNodeName(), this.getNodeName()}); //"Can not add "
+((ElemTemplateElement)newChild).m_elemName +
+
+ error(XSLTErrorResources.ER_CANNOT_ADD,
+ new Object[]{ newChild.getNodeName(),
+ this.getNodeName() }); //"Can not add "
+((ElemTemplateElement)newChild).m_elemName +
+
//" to " + this.m_elemName);
return null;
}
-
/**
* Given a 'from' pattern (ala xsl:number), a match pattern
* and a context, find the first ancestor that matches the
* pattern (including the context handed in).
+ *
+ * NEEDSDOC @param xctxt
* @param fromMatchPattern The ancestor must match this pattern.
* @param countMatchPattern The ancestor must also match this pattern.
* @param context The node that "." expresses.
* @param namespaceContext The context in which namespaces in the
* queries are supposed to be expanded.
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws org.xml.sax.SAXException
*/
- Node findAncestor(XPathContext xctxt, XPath fromMatchPattern,
- XPath countMatchPattern,
- Node context,
- Element namespaceContext)
- throws org.xml.sax.SAXException
+ Node findAncestor(
+ XPathContext xctxt, XPath fromMatchPattern, XPath
countMatchPattern, Node context, Element namespaceContext)
+ throws org.xml.sax.SAXException
{
- while(null != context)
+
+ while (null != context)
{
- if(null != fromMatchPattern)
+ if (null != fromMatchPattern)
{
- if(fromMatchPattern.getMatchScore(xctxt, context) !=
XPath.MATCH_SCORE_NONE)
+ if (fromMatchPattern.getMatchScore(xctxt, context)
+ != XPath.MATCH_SCORE_NONE)
{
+
//context = null;
break;
}
}
- if(null != countMatchPattern)
+ if (null != countMatchPattern)
{
- if(countMatchPattern.getMatchScore(xctxt, context) !=
XPath.MATCH_SCORE_NONE)
+ if (countMatchPattern.getMatchScore(xctxt, context)
+ != XPath.MATCH_SCORE_NONE)
{
break;
}
@@ -508,9 +574,9 @@
context = xctxt.getDOMHelper().getParentOfNode(context);
}
- return context;
- }
+ return context;
+ }
/**
* Given a 'from' pattern (ala xsl:number), a match pattern
@@ -518,311 +584,398 @@
* pattern (including the context handed in).
* @param matchPatternString The match pattern.
* @param node The node that "." expresses.
+ *
+ * NEEDSDOC @param xctxt
+ * NEEDSDOC @param fromMatchPattern
+ * NEEDSDOC @param countMatchPattern
+ * NEEDSDOC @param context
* @param namespaceContext The context in which namespaces in the
* queries are supposed to be expanded.
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws org.xml.sax.SAXException
*/
- private Node findPrecedingOrAncestorOrSelf(XPathContext xctxt,
- XPath fromMatchPattern,
- XPath countMatchPattern,
- Node context,
- Element namespaceContext)
- throws org.xml.sax.SAXException
+ private Node findPrecedingOrAncestorOrSelf(
+ XPathContext xctxt, XPath fromMatchPattern, XPath
countMatchPattern, Node context, Element namespaceContext)
+ throws org.xml.sax.SAXException
{
- while(null != context)
+
+ while (null != context)
{
- if(null != fromMatchPattern)
+ if (null != fromMatchPattern)
{
- if(fromMatchPattern.getMatchScore(xctxt, context) !=
XPath.MATCH_SCORE_NONE)
+ if (fromMatchPattern.getMatchScore(xctxt, context)
+ != XPath.MATCH_SCORE_NONE)
{
context = null;
+
break;
}
}
- if(null != countMatchPattern)
+ if (null != countMatchPattern)
{
- if(countMatchPattern.getMatchScore(xctxt, context) !=
XPath.MATCH_SCORE_NONE)
+ if (countMatchPattern.getMatchScore(xctxt, context)
+ != XPath.MATCH_SCORE_NONE)
{
break;
}
}
Node prevSibling = context.getPreviousSibling();
- if(null == prevSibling)
+
+ if (null == prevSibling)
{
context = xctxt.getDOMHelper().getParentOfNode(context);
}
else
{
+
// Now go down the chain of children of this sibling
context = prevSibling.getLastChild();
+
if (context == null)
context = prevSibling;
}
}
+
return context;
}
-
+
/**
* Get the count match pattern, or a default value.
+ *
+ * NEEDSDOC @param support
+ * NEEDSDOC @param contextNode
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws org.xml.sax.SAXException
*/
XPath getCountMatchPattern(XPathContext support, Node contextNode)
- throws org.xml.sax.SAXException
+ throws org.xml.sax.SAXException
{
+
XPath countMatchPattern = m_countMatchPattern;
- if(null == countMatchPattern)
+
+ if (null == countMatchPattern)
{
- switch( contextNode.getNodeType())
+ switch (contextNode.getNodeType())
{
- case Node.ELEMENT_NODE:
+ case Node.ELEMENT_NODE :
+
// countMatchPattern =
m_stylesheet.createMatchPattern(contextNode.getNodeName(), this);
- countMatchPattern
- = new XPath(contextNode.getNodeName(), this, this, XPath.MATCH);
+ countMatchPattern = new XPath(contextNode.getNodeName(), this, this,
+ XPath.MATCH);
break;
- case Node.ATTRIBUTE_NODE:
+ case Node.ATTRIBUTE_NODE :
+
// countMatchPattern =
m_stylesheet.createMatchPattern("@"+contextNode.getNodeName(), this);
- countMatchPattern
- = new XPath("@"+contextNode.getNodeName(), this, this,
XPath.MATCH);
+ countMatchPattern = new XPath("@" + contextNode.getNodeName(), this,
+ this, XPath.MATCH);
break;
- case Node.CDATA_SECTION_NODE:
- case Node.TEXT_NODE:
+ case Node.CDATA_SECTION_NODE :
+ case Node.TEXT_NODE :
+
// countMatchPattern = m_stylesheet.createMatchPattern("text()",
this);
- countMatchPattern
- = new XPath("text()", this, this, XPath.MATCH);
+ countMatchPattern = new XPath("text()", this, this, XPath.MATCH);
break;
- case Node.COMMENT_NODE:
+ case Node.COMMENT_NODE :
+
// countMatchPattern = m_stylesheet.createMatchPattern("comment()",
this);
- countMatchPattern
- = new XPath("comment()", this, this, XPath.MATCH);
+ countMatchPattern = new XPath("comment()", this, this, XPath.MATCH);
break;
- case Node.DOCUMENT_NODE:
+ case Node.DOCUMENT_NODE :
+
// countMatchPattern = m_stylesheet.createMatchPattern("/", this);
- countMatchPattern
- = new XPath("/", this, this, XPath.MATCH);
+ countMatchPattern = new XPath("/", this, this, XPath.MATCH);
break;
- case Node.PROCESSING_INSTRUCTION_NODE:
+ case Node.PROCESSING_INSTRUCTION_NODE :
+
// countMatchPattern =
m_stylesheet.createMatchPattern("pi("+contextNode.getNodeName()+")", this);
- countMatchPattern
- = new XPath("pi("+contextNode.getNodeName()+")", this, this,
XPath.MATCH);
+ countMatchPattern = new XPath("pi(" + contextNode.getNodeName()
+ + ")", this, this, XPath.MATCH);
break;
- default:
+ default :
countMatchPattern = null;
}
}
+
return countMatchPattern;
}
-
+
/**
* Given an XML source node, get the count according to the
* parameters set up by the xsl:number attributes.
* @param transformer The node being counted.
* @param sourceNode The source node being counted.
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws SAXException
*/
String getCountString(TransformerImpl transformer, Node sourceNode)
- throws SAXException
+ throws SAXException
{
+
int[] list = null;
XPathContext xctxt = transformer.getXPathContext();
CountersTable ctable = transformer.getCountersTable();
- if(null != m_valueExpr)
+ if (null != m_valueExpr)
{
XObject countObj = m_valueExpr.execute(xctxt, sourceNode, this);
- int count = (int)countObj.num();
+ int count = (int) countObj.num();
+
list = new int[1];
list[0] = count;
}
else
{
- if(Constants.NUMBERLEVEL_ANY == m_level)
+ if (Constants.NUMBERLEVEL_ANY == m_level)
{
list = new int[1];
list[0] = ctable.countNode(xctxt, this, sourceNode);
}
else
{
- NodeVector ancestors = getMatchingAncestors(xctxt, sourceNode,
-
Constants.NUMBERLEVEL_SINGLE == m_level);
+ NodeVector ancestors =
+ getMatchingAncestors(xctxt, sourceNode,
+ Constants.NUMBERLEVEL_SINGLE == m_level);
int lastIndex = ancestors.size() - 1;
- if(lastIndex >= 0)
+
+ if (lastIndex >= 0)
{
- list = new int[lastIndex+1];
- for(int i = lastIndex; i >= 0; i--)
+ list = new int[lastIndex + 1];
+
+ for (int i = lastIndex; i >= 0; i--)
{
Node target = ancestors.elementAt(i);
- list[lastIndex-i] = ctable.countNode(xctxt, this, target);
+
+ list[lastIndex - i] = ctable.countNode(xctxt, this, target);
}
}
}
}
-
- return (null != list) ? formatNumberList(transformer, list, sourceNode)
: "";
+
+ return (null != list)
+ ? formatNumberList(transformer, list, sourceNode) : "";
}
-
+
/**
* Get the previous node to be counted.
+ *
+ * NEEDSDOC @param xctxt
+ * NEEDSDOC @param pos
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws SAXException
*/
public Node getPreviousNode(XPathContext xctxt, Node pos)
- throws SAXException
- {
+ throws SAXException
+ {
+
XPath countMatchPattern = getCountMatchPattern(xctxt, pos);
- if(Constants.NUMBERLEVEL_ANY == m_level)
+
+ if (Constants.NUMBERLEVEL_ANY == m_level)
{
XPath fromMatchPattern = m_fromMatchPattern;
// Do a backwards document-order walk 'till a node is found that
matches
// the 'from' pattern, or a node is found that matches the 'count'
pattern,
// or the top of the tree is found.
- while(null != pos)
- {
+ while (null != pos)
+ {
+
// Get the previous sibling, if there is no previous sibling,
// then count the parent, but if there is a previous sibling,
// dive down to the lowest right-hand (last) child of that sibling.
Node next = pos.getPreviousSibling();
- if(null == next)
+
+ if (null == next)
{
next = pos.getParentNode();
- if((null != next) && ((((null != fromMatchPattern) &&
- (fromMatchPattern.getMatchScore(xctxt,
next) !=
- XPath.MATCH_SCORE_NONE))) ||
- (next.getNodeType() == Node.DOCUMENT_NODE)))
+
+ if ((null != next) && ((((null != fromMatchPattern) &&
(fromMatchPattern.getMatchScore(
+ xctxt, next) != XPath.MATCH_SCORE_NONE))) ||
(next.getNodeType() == Node.DOCUMENT_NODE)))
{
- pos = null; // return null from function.
- break; // from while loop
+ pos = null; // return null from function.
+
+ break; // from while loop
}
}
else
{
+
// dive down to the lowest right child.
Node child = next;
- while(null != child)
+
+ while (null != child)
{
child = next.getLastChild();
- if(null != child)
+
+ if (null != child)
next = child;
}
}
+
pos = next;
-
- if((null != pos) && ((null == countMatchPattern) ||
- (countMatchPattern.getMatchScore(xctxt, pos) !=
- XPath.MATCH_SCORE_NONE)))
+
+ if ((null != pos)
+ && ((null == countMatchPattern)
+ || (countMatchPattern.getMatchScore(xctxt, pos)
+ != XPath.MATCH_SCORE_NONE)))
{
break;
}
}
}
- else // NUMBERLEVEL_MULTI or NUMBERLEVEL_SINGLE
+ else // NUMBERLEVEL_MULTI or NUMBERLEVEL_SINGLE
{
- while(null != pos)
- {
+ while (null != pos)
+ {
pos = pos.getPreviousSibling();
- if((null != pos) && ((null == countMatchPattern) ||
- (countMatchPattern.getMatchScore(xctxt, pos) !=
- XPath.MATCH_SCORE_NONE)))
+
+ if ((null != pos)
+ && ((null == countMatchPattern)
+ || (countMatchPattern.getMatchScore(xctxt, pos)
+ != XPath.MATCH_SCORE_NONE)))
{
break;
}
}
}
+
return pos;
}
-
+
/**
* Get the target node that will be counted..
+ *
+ * NEEDSDOC @param xctxt
+ * NEEDSDOC @param sourceNode
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws SAXException
*/
public Node getTargetNode(XPathContext xctxt, Node sourceNode)
- throws SAXException
+ throws SAXException
{
+
Node target = null;
XPath countMatchPattern = getCountMatchPattern(xctxt, sourceNode);
- if(Constants.NUMBERLEVEL_ANY == m_level)
+
+ if (Constants.NUMBERLEVEL_ANY == m_level)
{
- target= findPrecedingOrAncestorOrSelf(xctxt, m_fromMatchPattern,
- countMatchPattern,
- sourceNode, this);
-
+ target = findPrecedingOrAncestorOrSelf(xctxt, m_fromMatchPattern,
+ countMatchPattern, sourceNode,
+ this);
}
else
{
- target = findAncestor(xctxt, m_fromMatchPattern,
- countMatchPattern, sourceNode, this);
+ target = findAncestor(xctxt, m_fromMatchPattern, countMatchPattern,
+ sourceNode, this);
}
+
return target;
}
-
-
-
/**
* Get the ancestors, up to the root, that match the
* pattern.
* @param patterns if non-null, count only nodes
* that match this pattern, if null count all ancestors.
+ *
+ * NEEDSDOC @param xctxt
* @param node Count this node and it's ancestors.
+ * NEEDSDOC @param stopAtFirstFound
* @return The number of ancestors that match the pattern.
+ *
+ * @throws org.xml.sax.SAXException
*/
- NodeVector getMatchingAncestors(XPathContext xctxt,
- Node node,
- boolean stopAtFirstFound)
- throws org.xml.sax.SAXException
+ NodeVector getMatchingAncestors(
+ XPathContext xctxt, Node node, boolean stopAtFirstFound)
+ throws org.xml.sax.SAXException
{
+
NodeSet ancestors = new NodeSet();
XPath countMatchPattern = getCountMatchPattern(xctxt, node);
- while( null != node )
+
+ while (null != node)
{
- if((null != m_fromMatchPattern) &&
- (m_fromMatchPattern.getMatchScore(xctxt, node) !=
- XPath.MATCH_SCORE_NONE))
- {
+ if ((null != m_fromMatchPattern)
+ && (m_fromMatchPattern.getMatchScore(xctxt, node)
+ != XPath.MATCH_SCORE_NONE))
+ {
+
// The following if statement gives level="single" different
// behavior from level="multiple", which seems incorrect according
// to the XSLT spec. For now we are leaving this in to replicate
// the same behavior in XT, but, for all intents and purposes we
// think this is a bug, or there is something about level="single"
// that we still don't understand.
- if(!stopAtFirstFound)
+ if (!stopAtFirstFound)
break;
- }
-
- if(null == countMatchPattern)
- System.out.println("Programmers error! countMatchPattern should
never be null!");
-
- if(countMatchPattern.getMatchScore(xctxt, node) !=
- XPath.MATCH_SCORE_NONE)
+ }
+
+ if (null == countMatchPattern)
+ System.out.println(
+ "Programmers error! countMatchPattern should never be null!");
+
+ if (countMatchPattern.getMatchScore(xctxt, node)
+ != XPath.MATCH_SCORE_NONE)
{
ancestors.addElement(node);
- if(stopAtFirstFound)
+
+ if (stopAtFirstFound)
break;
}
-
+
node = xctxt.getDOMHelper().getParentOfNode(node);
}
- return ancestors;
- } // end getMatchingAncestors method
+ return ancestors;
+ } // end getMatchingAncestors method
/**
* Get the locale we should be using.
+ *
+ * NEEDSDOC @param transformer
+ * NEEDSDOC @param contextNode
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws SAXException
*/
Locale getLocale(TransformerImpl transformer, Node contextNode)
- throws SAXException
+ throws SAXException
{
+
Locale locale = null;
- if(null != m_lang_avt)
+
+ if (null != m_lang_avt)
{
- String langValue = m_lang_avt.evaluate(transformer.getXPathContext(),
contextNode, this);
- if(null != langValue)
+ String langValue = m_lang_avt.evaluate(transformer.getXPathContext(),
+ contextNode, this);
+
+ if (null != langValue)
{
+
// Not really sure what to do about the country code, so I use the
// default from the system.
// TODO: fix xml:lang handling.
- locale = new Locale(langValue.toUpperCase(),"");
+ locale = new Locale(langValue.toUpperCase(), "");
+
//Locale.getDefault().getDisplayCountry());
- if(null == locale)
+ if (null == locale)
{
transformer.getMsgMgr().warn(null, contextNode,
- XSLTErrorResources.WG_LOCALE_NOT_FOUND, new
Object[] {langValue}); //"Warning: Could not find locale for
xml:lang="+langValue);
+
XSLTErrorResources.WG_LOCALE_NOT_FOUND,
+ new Object[]{ langValue });
//"Warning: Could not find locale for xml:lang="+langValue);
+
locale = Locale.getDefault();
}
}
@@ -831,48 +984,58 @@
{
locale = Locale.getDefault();
}
+
return locale;
}
/**
*
+ *
+ * NEEDSDOC @param transformer
+ * NEEDSDOC @param contextNode
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws SAXException
*/
- private DecimalFormat getNumberFormatter(TransformerImpl transformer, Node
contextNode)
- throws SAXException
+ private DecimalFormat getNumberFormatter(
+ TransformerImpl transformer, Node contextNode) throws SAXException
{
+
Locale locale = getLocale(transformer, contextNode);
// Helper to format local specific numbers to strings.
DecimalFormat formatter;
- synchronized(locale)
+
+ synchronized (locale)
{
- formatter = (DecimalFormat)NumberFormat.getNumberInstance(locale);
+ formatter = (DecimalFormat) NumberFormat.getNumberInstance(locale);
}
- String digitGroupSepValue = (null != m_groupingSeparator_avt)
- ?
m_groupingSeparator_avt.evaluate(transformer.getXPathContext(),
-
contextNode, this)
- : null;
+ String digitGroupSepValue =
+ (null != m_groupingSeparator_avt)
+ ? m_groupingSeparator_avt.evaluate(
+ transformer.getXPathContext(), contextNode, this) : null;
+ String nDigitsPerGroupValue =
+ (null != m_groupingSize_avt)
+ ? m_groupingSize_avt.evaluate(
+ transformer.getXPathContext(), contextNode, this) : null;
- String nDigitsPerGroupValue = (null != m_groupingSize_avt)
- ?
m_groupingSize_avt.evaluate(transformer.getXPathContext(),
-
contextNode, this)
- : null;
-
// TODO: Handle digit-group attributes
- if((null != digitGroupSepValue) && (null != nDigitsPerGroupValue))
+ if ((null != digitGroupSepValue) && (null != nDigitsPerGroupValue))
{
- try
+ try
{
-
formatter.setGroupingSize(Integer.valueOf(nDigitsPerGroupValue).intValue());
-
formatter.getDecimalFormatSymbols().setGroupingSeparator(digitGroupSepValue.charAt(0));
+ formatter.setGroupingSize(
+ Integer.valueOf(nDigitsPerGroupValue).intValue());
+ formatter.getDecimalFormatSymbols().setGroupingSeparator(
+ digitGroupSepValue.charAt(0));
formatter.setGroupingUsed(true);
- }
- catch(NumberFormatException ex)
+ }
+ catch (NumberFormatException ex)
{
formatter.setGroupingUsed(false);
}
-
}
return formatter;
@@ -881,22 +1044,31 @@
/**
* Format a vector of numbers into a formatted string.
* @param xslNumberElement Element that takes %conversion-atts; attributes.
+ *
+ * NEEDSDOC @param transformer
* @param list Array of one or more integer numbers.
+ * NEEDSDOC @param contextNode
* @return String that represents list according to
* %conversion-atts; attributes.
* TODO: Optimize formatNumberList so that it caches the last count and
* reuses that info for the next count.
+ *
+ * @throws SAXException
*/
- String formatNumberList(TransformerImpl transformer, int[] list, Node
contextNode)
- throws SAXException
+ String formatNumberList(
+ TransformerImpl transformer, int[] list, Node contextNode)
+ throws SAXException
{
+
String numStr;
FastStringBuffer formattedNumber = StringBufferPool.get();
+
try
{
int nNumbers = list.length, numberWidth = 1;
char numberType = '1';
String formatToken, lastSepString = null, formatTokenString = null;
+
// If a seperator hasn't been specified, then use "."
// as a default separator.
// For instance: [2][1][5] with a format value of "1 "
@@ -904,107 +1076,115 @@
// Otherwise, use the seperator specified in the format string.
// For instance: [2][1][5] with a format value of "01-001. "
// should format to "02-001-005 ".
- String lastSep = ".";
- boolean isFirstToken = true; // true if first token
+ String lastSep = ".";
+ boolean isFirstToken = true; // true if first token
+ String formatValue =
+ (null != m_format_avt)
+ ? m_format_avt.evaluate(
+ transformer.getXPathContext(), contextNode, this) : null;
+
+ if (null == formatValue)
+ formatValue = "1";
- String formatValue = (null != m_format_avt)
- ?
m_format_avt.evaluate(transformer.getXPathContext(), contextNode, this)
- : null;
- if(null == formatValue) formatValue = "1";
+ NumberFormatStringTokenizer formatTokenizer =
+ new NumberFormatStringTokenizer(formatValue);
- NumberFormatStringTokenizer formatTokenizer = new
NumberFormatStringTokenizer(formatValue);
-
// int sepCount = 0; // keep track of seperators
// Loop through all the numbers in the list.
- for(int i = 0; i < nNumbers; i++)
+ for (int i = 0; i < nNumbers; i++)
{
+
// Loop to the next digit, letter, or separator.
- if(formatTokenizer.hasMoreTokens())
+ if (formatTokenizer.hasMoreTokens())
{
formatToken = formatTokenizer.nextToken();
-
+
// If the first character of this token is a character or digit,
then
// it is a number format directive.
-
if(Character.isLetterOrDigit(formatToken.charAt(formatToken.length()-1)))
+ if (Character.isLetterOrDigit(
+ formatToken.charAt(formatToken.length() - 1)))
{
numberWidth = formatToken.length();
- numberType = formatToken.charAt(numberWidth-1);
+ numberType = formatToken.charAt(numberWidth - 1);
}
+
// If there is a number format directive ahead,
// then append the formatToken.
- else if(formatTokenizer.isLetterOrDigitAhead())
- {
+ else if (formatTokenizer.isLetterOrDigitAhead())
+ {
formatTokenString = formatToken;
-
+
// Append the formatToken string...
// For instance [2][1][5] with a format value of "1--1. "
// should format to "2--1--5. " (I guess).
- while(formatTokenizer.nextIsSep())
+ while (formatTokenizer.nextIsSep())
{
formatToken = formatTokenizer.nextToken();
formatTokenString += formatToken;
}
+
// Record this separator, so it can be used as the
// next separator, if the next is the last.
// For instance: [2][1][5] with a format value of "1-1 "
// should format to "2-1-5 ".
if (!isFirstToken)
lastSep = formatTokenString;
-
+
// Since we know the next is a number or digit, we get it now.
formatToken = formatTokenizer.nextToken();
numberWidth = formatToken.length();
- numberType = formatToken.charAt(numberWidth-1);
+ numberType = formatToken.charAt(numberWidth - 1);
}
- else // only separators left
+ else // only separators left
{
+
// Set up the string for the trailing characters after
// the last number is formatted (i.e. after the loop).
lastSepString = formatToken;
-
+
// And append any remaining characters to the lastSepString.
- while(formatTokenizer.hasMoreTokens())
+ while (formatTokenizer.hasMoreTokens())
{
formatToken = formatTokenizer.nextToken();
lastSepString += formatToken;
}
- } // else
-
- } // end if(formatTokenizer.hasMoreTokens())
-
+ } // else
+ } // end if(formatTokenizer.hasMoreTokens())
+
// if this is the first token and there was a prefix
// append the prefix else, append the separator
// For instance, [2][1][5] with a format value of "(1-1.) "
// should format to "(2-1-5.) " (I guess).
- if(null != formatTokenString && isFirstToken)
+ if (null != formatTokenString && isFirstToken)
{
formattedNumber.append(formatTokenString);
- }
- else if(null != lastSep && !isFirstToken)
+ }
+ else if (null != lastSep &&!isFirstToken)
formattedNumber.append(lastSep);
-
- getFormattedNumber(transformer, contextNode,
- numberType, numberWidth,
+
+ getFormattedNumber(transformer, contextNode, numberType, numberWidth,
list[i], formattedNumber);
- isFirstToken = false; // After the first pass, this
should be false
-
- } // end for loop
-
+
+ isFirstToken = false; // After the first pass, this should be false
+ } // end for loop
// Check to see if we finished up the format string...
-
// Skip past all remaining letters or digits
- while(formatTokenizer.isLetterOrDigitAhead())
+ while (formatTokenizer.isLetterOrDigitAhead())
+ {
formatTokenizer.nextToken();
-
- if(lastSepString != null)
+ }
+
+ if (lastSepString != null)
formattedNumber.append(lastSepString);
-
- while(formatTokenizer.hasMoreTokens())
+
+ while (formatTokenizer.hasMoreTokens())
{
formatToken = formatTokenizer.nextToken();
+
formattedNumber.append(formatToken);
}
+
numStr = formattedNumber.toString();
}
finally
@@ -1013,184 +1193,297 @@
}
return numStr;
- } // end formatNumberList method
+ } // end formatNumberList method
/*
* Get Formatted number
*/
- private void getFormattedNumber(TransformerImpl transformer,
- Node contextNode,
- char numberType,
- int numberWidth,
- int listElement,
- FastStringBuffer formattedNumber)
- throws org.xml.sax.SAXException
+
+ /**
+ * NEEDSDOC Method getFormattedNumber
+ *
+ *
+ * NEEDSDOC @param transformer
+ * NEEDSDOC @param contextNode
+ * NEEDSDOC @param numberType
+ * NEEDSDOC @param numberWidth
+ * NEEDSDOC @param listElement
+ * NEEDSDOC @param formattedNumber
+ *
+ * @throws org.xml.sax.SAXException
+ */
+ private void getFormattedNumber(
+ TransformerImpl transformer, Node contextNode, char numberType,
int numberWidth, int listElement, FastStringBuffer formattedNumber)
+ throws org.xml.sax.SAXException
{
+
DecimalFormat formatter = getNumberFormatter(transformer, contextNode);
String padString = formatter.format(0);
- String letterVal = (m_lettervalue_avt != null) ?
m_lettervalue_avt.evaluate(transformer.getXPathContext(),
-
contextNode, this) : null;
- switch(numberType)
- {
- case 'A':
+ String letterVal =
+ (m_lettervalue_avt != null)
+ ? m_lettervalue_avt.evaluate(
+ transformer.getXPathContext(), contextNode, this) : null;
+
+ switch (numberType)
+ {
+ case 'A' :
if (m_alphaCountTable == null)
- {
+ {
XSLTResourceBundle thisBundle;
- thisBundle =
(XSLTResourceBundle)XSLTResourceBundle.loadResourceBundle(
Constants.LANG_BUNDLE_NAME, getLocale(transformer, contextNode) );
+
+ thisBundle =
+ (XSLTResourceBundle) XSLTResourceBundle.loadResourceBundle(
+ Constants.LANG_BUNDLE_NAME, getLocale(transformer, contextNode));
+
char[] alphabet;
- alphabet= (char[]) thisBundle.getObject(Constants.LANG_ALPHABET);
+
+ alphabet = (char[]) thisBundle.getObject(Constants.LANG_ALPHABET);
m_alphaCountTable = alphabet;
- }
+ }
+
int2alphaCount(listElement, m_alphaCountTable, formattedNumber);
break;
- case 'a':
+ case 'a' :
if (m_alphaCountTable == null)
- {
+ {
XSLTResourceBundle thisBundle;
- thisBundle =
(XSLTResourceBundle)XSLTResourceBundle.loadResourceBundle(
Constants.LANG_BUNDLE_NAME, getLocale(transformer, contextNode) );
+
+ thisBundle =
+ (XSLTResourceBundle) XSLTResourceBundle.loadResourceBundle(
+ Constants.LANG_BUNDLE_NAME, getLocale(transformer, contextNode));
+
char[] alphabet;
- alphabet= (char[]) thisBundle.getObject(Constants.LANG_ALPHABET);
+
+ alphabet = (char[]) thisBundle.getObject(Constants.LANG_ALPHABET);
m_alphaCountTable = alphabet;
}
+
FastStringBuffer stringBuf = StringBufferPool.get();
+
try
{
int2alphaCount(listElement, m_alphaCountTable, stringBuf);
-
formattedNumber.append(stringBuf.toString().toLowerCase(getLocale(transformer,
contextNode)));
+ formattedNumber.append(
+ stringBuf.toString().toLowerCase(
+ getLocale(transformer, contextNode)));
}
finally
{
StringBufferPool.free(stringBuf);
}
break;
- case 'I':
- formattedNumber.append( long2roman(listElement, true));
+ case 'I' :
+ formattedNumber.append(long2roman(listElement, true));
break;
- case 'i':
- formattedNumber.append( long2roman(listElement, true).toLowerCase(
getLocale(transformer, contextNode)));
+ case 'i' :
+ formattedNumber.append(
+ long2roman(listElement, true).toLowerCase(
+ getLocale(transformer, contextNode)));
break;
- case 0x3042:
- {
- XSLTResourceBundle thisBundle;
- thisBundle =
(XSLTResourceBundle)XSLTResourceBundle.loadResourceBundle(
Constants.LANG_BUNDLE_NAME, new Locale("ja","JP","HA" ) );
- if (letterVal != null &&
letterVal.equals(Constants.ATTRVAL_TRADITIONAL))
- formattedNumber.append( tradAlphaCount(listElement, thisBundle));
- else //if (m_lettervalue_avt != null &&
m_lettervalue_avt.equals(Constants.ATTRVAL_ALPHABETIC))
- formattedNumber.append( int2singlealphaCount(listElement,
(char[])thisBundle.getObject(Constants.LANG_ALPHABET)));
- break;
- }
- case 0x3044:
- {
- XSLTResourceBundle thisBundle;
- thisBundle =
(XSLTResourceBundle)XSLTResourceBundle.loadResourceBundle(
Constants.LANG_BUNDLE_NAME, new Locale("ja","JP", "HI") );
- if ((letterVal != null) &&
letterVal.equals(Constants.ATTRVAL_TRADITIONAL))
- formattedNumber.append( tradAlphaCount(listElement, thisBundle));
- else //if (m_lettervalue_avt != null &&
m_lettervalue_avt.equals(Constants.ATTRVAL_ALPHABETIC))
- formattedNumber.append( int2singlealphaCount(listElement,
(char[])thisBundle.getObject(Constants.LANG_ALPHABET)));
- break;
- }
- case 0x30A2:
- {
- XSLTResourceBundle thisBundle;
- thisBundle =
(XSLTResourceBundle)XSLTResourceBundle.loadResourceBundle(
Constants.LANG_BUNDLE_NAME, new Locale("ja","JP","A" ) );
- if (letterVal != null &&
letterVal.equals(Constants.ATTRVAL_TRADITIONAL))
- formattedNumber.append( tradAlphaCount(listElement, thisBundle));
- else //if (m_lettervalue_avt != null &&
m_lettervalue_avt.equals(Constants.ATTRVAL_ALPHABETIC))
- formattedNumber.append( int2singlealphaCount(listElement,
(char[])thisBundle.getObject(Constants.LANG_ALPHABET)));
- break;
- }
- case 0x30A4:
- {
- XSLTResourceBundle thisBundle;
- thisBundle =
(XSLTResourceBundle)XSLTResourceBundle.loadResourceBundle(
Constants.LANG_BUNDLE_NAME, new Locale("ja","JP", "I") );
- if (letterVal != null &&
letterVal.equals(Constants.ATTRVAL_TRADITIONAL))
- formattedNumber.append( tradAlphaCount(listElement, thisBundle));
- else //if (m_lettervalue_avt != null &&
m_lettervalue_avt.equals(Constants.ATTRVAL_ALPHABETIC))
- formattedNumber.append( int2singlealphaCount(listElement,
(char[])thisBundle.getObject(Constants.LANG_ALPHABET)));
- break;
- }
- case 0x4E00:
- {
- XSLTResourceBundle thisBundle;
- thisBundle =
(XSLTResourceBundle)XSLTResourceBundle.loadResourceBundle(
Constants.LANG_BUNDLE_NAME, new Locale("zh","CN" ) );
- if (letterVal != null &&
letterVal.equals(Constants.ATTRVAL_TRADITIONAL))
- {
- formattedNumber.append(tradAlphaCount(listElement, thisBundle));
- }
- else //if (m_lettervalue_avt != null &&
m_lettervalue_avt.equals(Constants.ATTRVAL_ALPHABETIC))
- int2alphaCount(listElement,
(char[])thisBundle.getObject(Constants.LANG_ALPHABET), formattedNumber);
- break;
- }
- case 0x58F9:
- {
- XSLTResourceBundle thisBundle;
- thisBundle =
(XSLTResourceBundle)XSLTResourceBundle.loadResourceBundle(
Constants.LANG_BUNDLE_NAME, new Locale("zh","TW") );
- if (letterVal != null &&
letterVal.equals(Constants.ATTRVAL_TRADITIONAL))
- formattedNumber.append( tradAlphaCount(listElement, thisBundle));
- else //if (m_lettervalue_avt != null &&
m_lettervalue_avt.equals(Constants.ATTRVAL_ALPHABETIC))
- int2alphaCount(listElement,
(char[])thisBundle.getObject(Constants.LANG_ALPHABET), formattedNumber);
- break;
- }
- case 0x0E51:
- {
- XSLTResourceBundle thisBundle;
- thisBundle =
(XSLTResourceBundle)XSLTResourceBundle.loadResourceBundle(
Constants.LANG_BUNDLE_NAME, new Locale("th","") );
- if (letterVal != null &&
letterVal.equals(Constants.ATTRVAL_TRADITIONAL))
- formattedNumber.append( tradAlphaCount(listElement, thisBundle));
- else //if (m_lettervalue_avt != null &&
m_lettervalue_avt.equals(Constants.ATTRVAL_ALPHABETIC))
- int2alphaCount(listElement,
(char[])thisBundle.getObject(Constants.LANG_ALPHABET), formattedNumber);
- break;
- }
- case 0x05D0:
- {
- XSLTResourceBundle thisBundle;
- thisBundle =
(XSLTResourceBundle)XSLTResourceBundle.loadResourceBundle(
Constants.LANG_BUNDLE_NAME, new Locale("he","") );
- if (letterVal != null &&
letterVal.equals(Constants.ATTRVAL_TRADITIONAL))
- formattedNumber.append( tradAlphaCount(listElement, thisBundle));
- else //if (m_lettervalue_avt != null &&
m_lettervalue_avt.equals(Constants.ATTRVAL_ALPHABETIC))
- int2alphaCount(listElement,
(char[])thisBundle.getObject(Constants.LANG_ALPHABET), formattedNumber);
- break;
- }
- case 0x10D0:
- {
- XSLTResourceBundle thisBundle;
- thisBundle =
(XSLTResourceBundle)XSLTResourceBundle.loadResourceBundle(
Constants.LANG_BUNDLE_NAME, new Locale("ka","") );
- if (letterVal != null &&
letterVal.equals(Constants.ATTRVAL_TRADITIONAL))
- formattedNumber.append( tradAlphaCount(listElement, thisBundle));
- else //if (m_lettervalue_avt != null &&
m_lettervalue_avt.equals(Constants.ATTRVAL_ALPHABETIC))
- int2alphaCount(listElement,
(char[])thisBundle.getObject(Constants.LANG_ALPHABET), formattedNumber);
- break;
- }
- case 0x03B1:
- {
- XSLTResourceBundle thisBundle;
- thisBundle =
(XSLTResourceBundle)XSLTResourceBundle.loadResourceBundle(
Constants.LANG_BUNDLE_NAME, new Locale("el","") );
- if (letterVal != null &&
letterVal.equals(Constants.ATTRVAL_TRADITIONAL))
- formattedNumber.append( tradAlphaCount(listElement, thisBundle));
- else //if (m_lettervalue_avt != null &&
m_lettervalue_avt.equals(Constants.ATTRVAL_ALPHABETIC))
- int2alphaCount(listElement,
(char[])thisBundle.getObject(Constants.LANG_ALPHABET), formattedNumber);
- break;
- }
- case 0x0430:
+ case 0x3042 :
+ {
+ XSLTResourceBundle thisBundle;
+
+ thisBundle = (XSLTResourceBundle)
XSLTResourceBundle.loadResourceBundle(
+ Constants.LANG_BUNDLE_NAME, new Locale("ja", "JP", "HA"));
+
+ if (letterVal != null
+ && letterVal.equals(Constants.ATTRVAL_TRADITIONAL))
+ formattedNumber.append(tradAlphaCount(listElement, thisBundle));
+ else //if (m_lettervalue_avt != null &&
m_lettervalue_avt.equals(Constants.ATTRVAL_ALPHABETIC))
+ formattedNumber.append(
+ int2singlealphaCount(
+ listElement,
+ (char[]) thisBundle.getObject(Constants.LANG_ALPHABET)));
+
+ break;
+ }
+ case 0x3044 :
+ {
+ XSLTResourceBundle thisBundle;
+
+ thisBundle = (XSLTResourceBundle)
XSLTResourceBundle.loadResourceBundle(
+ Constants.LANG_BUNDLE_NAME, new Locale("ja", "JP", "HI"));
+
+ if ((letterVal != null)
+ && letterVal.equals(Constants.ATTRVAL_TRADITIONAL))
+ formattedNumber.append(tradAlphaCount(listElement, thisBundle));
+ else //if (m_lettervalue_avt != null &&
m_lettervalue_avt.equals(Constants.ATTRVAL_ALPHABETIC))
+ formattedNumber.append(
+ int2singlealphaCount(
+ listElement,
+ (char[]) thisBundle.getObject(Constants.LANG_ALPHABET)));
+
+ break;
+ }
+ case 0x30A2 :
+ {
+ XSLTResourceBundle thisBundle;
+
+ thisBundle = (XSLTResourceBundle)
XSLTResourceBundle.loadResourceBundle(
+ Constants.LANG_BUNDLE_NAME, new Locale("ja", "JP", "A"));
+
+ if (letterVal != null
+ && letterVal.equals(Constants.ATTRVAL_TRADITIONAL))
+ formattedNumber.append(tradAlphaCount(listElement, thisBundle));
+ else //if (m_lettervalue_avt != null &&
m_lettervalue_avt.equals(Constants.ATTRVAL_ALPHABETIC))
+ formattedNumber.append(
+ int2singlealphaCount(
+ listElement,
+ (char[]) thisBundle.getObject(Constants.LANG_ALPHABET)));
+
+ break;
+ }
+ case 0x30A4 :
+ {
+ XSLTResourceBundle thisBundle;
+
+ thisBundle = (XSLTResourceBundle)
XSLTResourceBundle.loadResourceBundle(
+ Constants.LANG_BUNDLE_NAME, new Locale("ja", "JP", "I"));
+
+ if (letterVal != null
+ && letterVal.equals(Constants.ATTRVAL_TRADITIONAL))
+ formattedNumber.append(tradAlphaCount(listElement, thisBundle));
+ else //if (m_lettervalue_avt != null &&
m_lettervalue_avt.equals(Constants.ATTRVAL_ALPHABETIC))
+ formattedNumber.append(
+ int2singlealphaCount(
+ listElement,
+ (char[]) thisBundle.getObject(Constants.LANG_ALPHABET)));
+
+ break;
+ }
+ case 0x4E00 :
+ {
+ XSLTResourceBundle thisBundle;
+
+ thisBundle = (XSLTResourceBundle)
XSLTResourceBundle.loadResourceBundle(
+ Constants.LANG_BUNDLE_NAME, new Locale("zh", "CN"));
+
+ if (letterVal != null
+ && letterVal.equals(Constants.ATTRVAL_TRADITIONAL))
{
- XSLTResourceBundle thisBundle;
- thisBundle =
(XSLTResourceBundle)XSLTResourceBundle.loadResourceBundle(
Constants.LANG_BUNDLE_NAME, new Locale("cy","") );
- if (letterVal != null &&
letterVal.equals(Constants.ATTRVAL_TRADITIONAL))
- formattedNumber.append( tradAlphaCount(listElement, thisBundle));
- else //if (m_lettervalue_avt != null &&
m_lettervalue_avt.equals(Constants.ATTRVAL_ALPHABETIC))
-
int2alphaCount(listElement,(char[])thisBundle.getObject(Constants.LANG_ALPHABET),
formattedNumber);
- break;
+ formattedNumber.append(tradAlphaCount(listElement, thisBundle));
}
- default: // "1"
+ else //if (m_lettervalue_avt != null &&
m_lettervalue_avt.equals(Constants.ATTRVAL_ALPHABETIC))
+ int2alphaCount(listElement,
+ (char[])
thisBundle.getObject(Constants.LANG_ALPHABET),
+ formattedNumber);
+
+ break;
+ }
+ case 0x58F9 :
+ {
+ XSLTResourceBundle thisBundle;
+
+ thisBundle = (XSLTResourceBundle)
XSLTResourceBundle.loadResourceBundle(
+ Constants.LANG_BUNDLE_NAME, new Locale("zh", "TW"));
+
+ if (letterVal != null
+ && letterVal.equals(Constants.ATTRVAL_TRADITIONAL))
+ formattedNumber.append(tradAlphaCount(listElement, thisBundle));
+ else //if (m_lettervalue_avt != null &&
m_lettervalue_avt.equals(Constants.ATTRVAL_ALPHABETIC))
+ int2alphaCount(listElement,
+ (char[])
thisBundle.getObject(Constants.LANG_ALPHABET),
+ formattedNumber);
+
+ break;
+ }
+ case 0x0E51 :
+ {
+ XSLTResourceBundle thisBundle;
+
+ thisBundle = (XSLTResourceBundle)
XSLTResourceBundle.loadResourceBundle(
+ Constants.LANG_BUNDLE_NAME, new Locale("th", ""));
+
+ if (letterVal != null
+ && letterVal.equals(Constants.ATTRVAL_TRADITIONAL))
+ formattedNumber.append(tradAlphaCount(listElement, thisBundle));
+ else //if (m_lettervalue_avt != null &&
m_lettervalue_avt.equals(Constants.ATTRVAL_ALPHABETIC))
+ int2alphaCount(listElement,
+ (char[])
thisBundle.getObject(Constants.LANG_ALPHABET),
+ formattedNumber);
+
+ break;
+ }
+ case 0x05D0 :
+ {
+ XSLTResourceBundle thisBundle;
+
+ thisBundle = (XSLTResourceBundle)
XSLTResourceBundle.loadResourceBundle(
+ Constants.LANG_BUNDLE_NAME, new Locale("he", ""));
+
+ if (letterVal != null
+ && letterVal.equals(Constants.ATTRVAL_TRADITIONAL))
+ formattedNumber.append(tradAlphaCount(listElement, thisBundle));
+ else //if (m_lettervalue_avt != null &&
m_lettervalue_avt.equals(Constants.ATTRVAL_ALPHABETIC))
+ int2alphaCount(listElement,
+ (char[])
thisBundle.getObject(Constants.LANG_ALPHABET),
+ formattedNumber);
+
+ break;
+ }
+ case 0x10D0 :
+ {
+ XSLTResourceBundle thisBundle;
+
+ thisBundle = (XSLTResourceBundle)
XSLTResourceBundle.loadResourceBundle(
+ Constants.LANG_BUNDLE_NAME, new Locale("ka", ""));
+
+ if (letterVal != null
+ && letterVal.equals(Constants.ATTRVAL_TRADITIONAL))
+ formattedNumber.append(tradAlphaCount(listElement, thisBundle));
+ else //if (m_lettervalue_avt != null &&
m_lettervalue_avt.equals(Constants.ATTRVAL_ALPHABETIC))
+ int2alphaCount(listElement,
+ (char[])
thisBundle.getObject(Constants.LANG_ALPHABET),
+ formattedNumber);
+
+ break;
+ }
+ case 0x03B1 :
+ {
+ XSLTResourceBundle thisBundle;
+
+ thisBundle = (XSLTResourceBundle)
XSLTResourceBundle.loadResourceBundle(
+ Constants.LANG_BUNDLE_NAME, new Locale("el", ""));
+
+ if (letterVal != null
+ && letterVal.equals(Constants.ATTRVAL_TRADITIONAL))
+ formattedNumber.append(tradAlphaCount(listElement, thisBundle));
+ else //if (m_lettervalue_avt != null &&
m_lettervalue_avt.equals(Constants.ATTRVAL_ALPHABETIC))
+ int2alphaCount(listElement,
+ (char[])
thisBundle.getObject(Constants.LANG_ALPHABET),
+ formattedNumber);
+
+ break;
+ }
+ case 0x0430 :
+ {
+ XSLTResourceBundle thisBundle;
+
+ thisBundle = (XSLTResourceBundle)
XSLTResourceBundle.loadResourceBundle(
+ Constants.LANG_BUNDLE_NAME, new Locale("cy", ""));
+
+ if (letterVal != null
+ && letterVal.equals(Constants.ATTRVAL_TRADITIONAL))
+ formattedNumber.append(tradAlphaCount(listElement, thisBundle));
+ else //if (m_lettervalue_avt != null &&
m_lettervalue_avt.equals(Constants.ATTRVAL_ALPHABETIC))
+ int2alphaCount(listElement,
+ (char[])
thisBundle.getObject(Constants.LANG_ALPHABET),
+ formattedNumber);
+
+ break;
+ }
+ default : // "1"
String numString = formatter.format(listElement);
int nPadding = numberWidth - numString.length();
- for(int k = 0; k < nPadding; k++)
+
+ for (int k = 0; k < nPadding; k++)
{
formattedNumber.append(padString);
}
+
formattedNumber.append(numString);
}
-
}
/**
@@ -1204,16 +1497,16 @@
* Note that the radix of the conversion is inferred from the size
* of the table.
*/
- protected String int2singlealphaCount(int val, char [] table)
+ protected String int2singlealphaCount(int val, char[] table)
{
+
int radix = table.length;
// TODO: throw error on out of range input
if (val > radix)
- return "#E("+val+")";
+ return "#E(" + val + ")";
else
- return (new Character(table[val-1])).toString(); // index into
table is off one, starts at 0
-
+ return (new Character(table[val - 1])).toString(); // index into
table is off one, starts at 0
}
/**
@@ -1221,21 +1514,29 @@
* count using the sequence A B C ... Z AA AB AC.... etc.
* @param val Value to convert -- must be greater than zero.
* @param table a table containing one character for each digit in the
radix
+ * NEEDSDOC @param aTable
+ * NEEDSDOC @param stringBuf
* @return String representing alpha count of number.
* @see TransformerImpl#DecimalToRoman
*
* Note that the radix of the conversion is inferred from the size
* of the table.
*/
- protected void int2alphaCount(int val, char [] aTable, FastStringBuffer
stringBuf)
+ protected void int2alphaCount(int val, char[] aTable,
+ FastStringBuffer stringBuf)
{
int radix = aTable.length;
char[] table = new char[aTable.length];
+
// start table at 1, add last char at index 0. Reason explained above
and below.
int i;
- for (i=0; i<aTable.length-1;i++)
- table[i+1] = aTable[i];
+
+ for (i = 0; i < aTable.length - 1; i++)
+ {
+ table[i + 1] = aTable[i];
+ }
+
table[0] = aTable[i];
// Create a buffer to hold the result
@@ -1246,27 +1547,24 @@
//some languages go left to right(ie. english), right to left (ie.
Hebrew),
//top to bottom (ie.Japanese), etc... Handle them differently
//String orientation = thisBundle.getString(Constants.LANG_ORIENTATION);
-
// next character to set in the buffer
int charPos;
- charPos= buf.length -1 ; // work backward through buf[]
-
+ charPos = buf.length - 1; // work backward through buf[]
+
// index in table of the last character that we stored
int lookupIndex = 1; // start off with anything other than zero to make
correction work
-
-
- // Correction number
+ // Correction number
//
- // Correction can take on exactly two values:
+ // Correction can take on exactly two values:
//
- // 0 if the next character is to be emitted is usual
+ // 0 if the next character is to be emitted is usual
//
// radix - 1
- // if the next char to be emitted should be one
less than
- // you would expect
- //
+ // if the next char to be emitted should be one less
than
+ // you would expect
+ //
// For example, consider radix 10, where 1="A" and 10="J"
//
// In this scheme, we count: A, B, C ... H, I, J (not A0 and certainly
@@ -1281,21 +1579,21 @@
// it can represent either 10 or zero). In summary, the correction
value of
// "radix-1" acts like "-1" when run through the mod operator, but with
the
// desireable characteristic that it never produces a negative number.
-
int correction = 0;
// TODO: throw error on out of range input
-
do
{
+
// most of the correction calculation is explained above, the reason
for the
// term after the "|| " is that it correctly propagates carries across
// multiple columns.
- correction = ((lookupIndex == 0) ||
- (correction != 0 && lookupIndex == radix-1 )) ?
(radix-1) : 0;
+ correction =
+ ((lookupIndex == 0) || (correction != 0 && lookupIndex == radix - 1))
+ ? (radix - 1) : 0;
// index in "table" of the next char to emit
- lookupIndex = (val+correction) % radix;
+ lookupIndex = (val + correction) % radix;
// shift input by one "column"
val = (val / radix);
@@ -1305,18 +1603,19 @@
break;
// put out the next character of output
- buf[charPos--] = table[lookupIndex]; // left to right or top to
bottom
+ buf[charPos--] = table[lookupIndex]; // left to right or top to
bottom
}
- while (val > 0);
-
- stringBuf.append(buf, charPos+1, (buf.length - charPos -1));
+ while (val > 0);
+
+ stringBuf.append(buf, charPos + 1, (buf.length - charPos - 1));
}
/**
- *Convert a long integer into traditional alphabetic counting, in other
words
+ * Convert a long integer into traditional alphabetic counting, in other
words
* count using the traditional numbering.
* @param val Value to convert -- must be greater than zero.
* @param table a table containing one character for each digit in the
radix
+ * NEEDSDOC @param thisBundle
* @return String representing alpha count of number.
* @see XSLProcessor#DecimalToRoman
*
@@ -1325,171 +1624,199 @@
*/
protected String tradAlphaCount(int val, XSLTResourceBundle thisBundle)
{
+
// if this number is larger than the largest number we can represent,
error!
//if (val >
((Integer)thisBundle.getObject("MaxNumericalValue")).intValue())
//return XSLTErrorResources.ERROR_STRING;
char[] table = null;
+
// index in table of the last character that we stored
int lookupIndex = 1; // start off with anything other than zero to make
correction work
+
// Create a buffer to hold the result
// TODO: size of the table can be detereined by computing
// logs of the radix. For now, we fake it.
char buf[] = new char[100];
-
+
//some languages go left to right(ie. english), right to left (ie.
Hebrew),
//top to bottom (ie.Japanese), etc... Handle them differently
//String orientation = thisBundle.getString(Constants.LANG_ORIENTATION);
-
// next character to set in the buffer
int charPos;
- charPos= 0; //start at 0
-
+
+ charPos = 0; //start at 0
+
// array of number groups: ie.1000, 100, 10, 1
- int[] groups = (int[])thisBundle.getObject(Constants.LANG_NUMBERGROUPS);
-
+ int[] groups = (int[]) thisBundle.getObject(Constants.LANG_NUMBERGROUPS);
+
// array of tables of hundreds, tens, digits...
- String[] tables =
(String[])(thisBundle.getObject(Constants.LANG_NUM_TABLES));
-
-
+ String[] tables =
+ (String[]) (thisBundle.getObject(Constants.LANG_NUM_TABLES));
+
//some languages have additive alphabetical notation,
//some multiplicative-additive, etc... Handle them differently.
- String numbering = thisBundle.getString(Constants.LANG_NUMBERING);
-
+ String numbering = thisBundle.getString(Constants.LANG_NUMBERING);
+
// do multiplicative part first
if (numbering.equals(Constants.LANG_MULT_ADD))
{
String mult_order = thisBundle.getString(Constants.MULT_ORDER);
- int[] multiplier =
(int[])(thisBundle.getObject(Constants.LANG_MULTIPLIER));
- char[]zeroChar = (char[])thisBundle.getObject("zero");
-
- int i= 0;
+ int[] multiplier =
+ (int[]) (thisBundle.getObject(Constants.LANG_MULTIPLIER));
+ char[] zeroChar = (char[]) thisBundle.getObject("zero");
+ int i = 0;
+
// skip to correct multiplier
- while (i < multiplier.length && val < multiplier[i] )
+ while (i < multiplier.length && val < multiplier[i])
+ {
i++;
-
+ }
+
do
{
if (i >= multiplier.length)
- break; //number is smaller than multipliers
-
+ break; //number is smaller than multipliers
+
// some languages (ie chinese) put a zero character (and only one)
when
// the multiplier is multiplied by zero. (ie, 1001 is 1X1000 + 0X100
+ 0X10 + 1)
// 0X100 is replaced by the zero character, we don't need one for
0X10
- if (val< multiplier[i])
+ if (val < multiplier[i])
{
if (zeroChar.length == 0)
{
i++;
- }
+ }
else
{
- if (buf[charPos-1]!= zeroChar[0])
+ if (buf[charPos - 1] != zeroChar[0])
buf[charPos++] = zeroChar[0];
+
i++;
}
- }
- else if (val>= multiplier[i])
- {
- int mult = val/multiplier[i];
- val = val % multiplier[i]; // save this.
-
+ }
+ else if (val >= multiplier[i])
+ {
+ int mult = val / multiplier[i];
+
+ val = val % multiplier[i]; // save this.
+
int k = 0;
+
while (k < groups.length)
{
- lookupIndex = 1; // initialize for each table
- if (mult/groups[k]<= 0) // look for right table
+ lookupIndex = 1; // initialize for each table
+
+ if (mult / groups[k] <= 0) // look for right table
k++;
else
{
+
// get the table
- char[] THEletters= (char[]) thisBundle.getObject(tables[k]);
- table = new char[THEletters.length+1];
+ char[] THEletters = (char[]) thisBundle.getObject(tables[k]);
+
+ table = new char[THEletters.length + 1];
+
int j;
- for (j=0; j<THEletters.length;j++)
- table[j+1] = THEletters[j];
- table[0] = THEletters[j-1]; // don't need this
+
+ for (j = 0; j < THEletters.length; j++)
+ {
+ table[j + 1] = THEletters[j];
+ }
+
+ table[0] = THEletters[j - 1]; // don't need this
+
// index in "table" of the next char to emit
- lookupIndex = mult/ groups[k];
+ lookupIndex = mult / groups[k];
//this should not happen
if (lookupIndex == 0 && mult == 0)
break;
- char multiplierChar =
((char[])(thisBundle.getObject(Constants.LANG_MULTIPLIER_CHAR)))[i];
- // put out the next character of output
+
+ char multiplierChar = ((char[]) (thisBundle.getObject(
+ Constants.LANG_MULTIPLIER_CHAR)))[i];
+
+ // put out the next character of output
if (lookupIndex < table.length)
- {
- if( mult_order.equals(Constants.MULT_PRECEDES))
+ {
+ if (mult_order.equals(Constants.MULT_PRECEDES))
{
- buf[charPos++] = multiplierChar;
- buf[charPos++] = table[lookupIndex];
- }
+ buf[charPos++] = multiplierChar;
+ buf[charPos++] = table[lookupIndex];
+ }
else
- {
+ {
+
// don't put out 1 (ie 1X10 is just 10)
- if (lookupIndex == 1 && i == multiplier.length -1)
- {}
+ if (lookupIndex == 1 && i == multiplier.length - 1){}
else
- buf[charPos++] = table[lookupIndex];
- buf[charPos++] = multiplierChar ;
+ buf[charPos++] = table[lookupIndex];
+
+ buf[charPos++] = multiplierChar;
}
-
- break; // all done!
+
+ break; // all done!
}
else
return XSLTErrorResources.ERROR_STRING;
- } //end else
- } // end while
-
+ } //end else
+ } // end while
+
i++;
- } // end else if
- } // end do while
- while ( i < multiplier.length);
+ } // end else if
+ } // end do while
+ while (i < multiplier.length);
}
// Now do additive part...
-
int count = 0;
String tableName;
+
// do this for each table of hundreds, tens, digits...
while (count < groups.length)
{
- if (val/groups[count]<= 0) // look for correct table
+ if (val / groups[count] <= 0) // look for correct table
count++;
else
{
- char[] theletters= (char[]) thisBundle.getObject(tables[count]);
- table = new char[theletters.length+1];
+ char[] theletters = (char[]) thisBundle.getObject(tables[count]);
+
+ table = new char[theletters.length + 1];
+
int j;
+
// need to start filling the table up at index 1
- for (j=0; j<theletters.length;j++)
+ for (j = 0; j < theletters.length; j++)
{
- table[j+1] = theletters[j];
- }
- table[0] = theletters[j-1]; // don't need this
-
+ table[j + 1] = theletters[j];
+ }
+
+ table[0] = theletters[j - 1]; // don't need this
+
// index in "table" of the next char to emit
- lookupIndex = val / groups[count];
+ lookupIndex = val / groups[count];
// shift input by one "column"
val = val % groups[count];
// this should not happen
if (lookupIndex == 0 && val == 0)
- break;
-
+ break;
+
if (lookupIndex < table.length)
{
- // put out the next character of output
- buf[charPos++] = table[lookupIndex]; // left to right or top to
bottom
+
+ // put out the next character of output
+ buf[charPos++] = table[lookupIndex]; // left to right or top to
bottom
}
else
return XSLTErrorResources.ERROR_STRING;
+
count++;
}
- } // end while
+ } // end while
// String s = new String(buf, 0, charPos);
- return new String(buf, 0, charPos);
+ return new String(buf, 0, charPos);
}
/**
@@ -1503,13 +1830,15 @@
*/
protected String long2roman(long val, boolean prefixesAreOK)
{
- if(val <= 0)
+
+ if (val <= 0)
{
- return "#E("+val+")";
+ return "#E(" + val + ")";
}
String roman = "";
int place = 0;
+
if (val <= 3999L)
{
do
@@ -1519,6 +1848,7 @@
roman += m_romanConvertTable[place].m_postLetter;
val -= m_romanConvertTable[place].m_postValue;
}
+
if (prefixesAreOK)
{
if (val >= m_romanConvertTable[place].m_preValue)
@@ -1527,29 +1857,39 @@
val -= m_romanConvertTable[place].m_preValue;
}
}
+
place++;
}
- while (val > 0);
+ while (val > 0);
}
else
{
roman = XSLTErrorResources.ERROR_STRING;
}
+
return roman;
- } // end long2roman
+ } // end long2roman
-/**
- * This class returns tokens using non-alphanumberic
- * characters as delimiters.
- */
+ /**
+ * This class returns tokens using non-alphanumberic
+ * characters as delimiters.
+ */
class NumberFormatStringTokenizer
{
+
+ /** NEEDSDOC Field currentPosition */
private int currentPosition;
+
+ /** NEEDSDOC Field maxPosition */
private int maxPosition;
+
+ /** NEEDSDOC Field str */
private String str;
/**
* Construct a NumberFormatStringTokenizer.
+ *
+ * NEEDSDOC @param str
*/
public NumberFormatStringTokenizer(String str)
{
@@ -1574,25 +1914,29 @@
*/
public String nextToken()
{
+
if (currentPosition >= maxPosition)
{
throw new NoSuchElementException();
}
int start = currentPosition;
- while ((currentPosition < maxPosition) &&
- Character.isLetterOrDigit(str.charAt(currentPosition)))
+
+ while ((currentPosition < maxPosition)
+ && Character.isLetterOrDigit(str.charAt(currentPosition)))
{
currentPosition++;
}
- if ((start == currentPosition) &&
- (!Character.isLetterOrDigit(str.charAt(currentPosition))))
+
+ if ((start == currentPosition)
+ && (!Character.isLetterOrDigit(str.charAt(currentPosition))))
{
currentPosition++;
}
+
return str.substring(start, currentPosition);
}
-
+
/**
* Tells if there is a digit or a letter character ahead.
*
@@ -1600,14 +1944,17 @@
*/
public boolean isLetterOrDigitAhead()
{
+
int pos = currentPosition;
while (pos < maxPosition)
{
- if(Character.isLetterOrDigit(str.charAt(pos)))
+ if (Character.isLetterOrDigit(str.charAt(pos)))
return true;
+
pos++;
}
+
return false;
}
@@ -1618,13 +1965,13 @@
*/
public boolean nextIsSep()
{
- if(Character.isLetterOrDigit(str.charAt(currentPosition)))
+
+ if (Character.isLetterOrDigit(str.charAt(currentPosition)))
return false;
else
return true;
}
-
/**
* Tells if <code>nextToken</code> will throw an exception
* if it is called.
@@ -1648,26 +1995,30 @@
*/
public int countTokens()
{
+
int count = 0;
int currpos = currentPosition;
while (currpos < maxPosition)
{
int start = currpos;
- while ((currpos < maxPosition) &&
- Character.isLetterOrDigit(str.charAt(currpos)))
+
+ while ((currpos < maxPosition)
+ && Character.isLetterOrDigit(str.charAt(currpos)))
{
currpos++;
}
- if ((start == currpos) &&
- (Character.isLetterOrDigit(str.charAt(currpos)) == false))
+
+ if ((start == currpos)
+ && (Character.isLetterOrDigit(str.charAt(currpos)) == false))
{
currpos++;
}
+
count++;
}
+
return count;
}
-
- } // end NumberFormatStringTokenizer
-}
\ No newline at end of file
+ } // end NumberFormatStringTokenizer
+}
1.3 +10 -5
xml-xalan/java/src/org/apache/xalan/templates/ElemOtherwise.java
Index: ElemOtherwise.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemOtherwise.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ElemOtherwise.java 2000/07/05 14:40:13 1.2
+++ ElemOtherwise.java 2000/10/30 18:49:52 1.3
@@ -57,7 +57,9 @@
package org.apache.xalan.templates;
import org.w3c.dom.*;
+
import org.xml.sax.*;
+
import org.apache.xpath.*;
import org.apache.xalan.res.XSLTErrorResources;
import org.apache.xalan.transformer.TransformerImpl;
@@ -72,23 +74,26 @@
* @see <a
href="http://www.w3.org/TR/xslt#section-Conditional-Processing-with-xsl:choose">XXX
in XSLT Specification</a>
*/
public class ElemOtherwise extends ElemTemplateElement
-{
+{
+
/**
* Get an int constant identifying the type of element.
* @see org.apache.xalan.templates.Constants
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public int getXSLToken()
{
return Constants.ELEMNAME_OTHERWISE;
}
-
- /**
+
+ /**
* Return the node name.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public String getNodeName()
{
return Constants.ELEMNAME_OTHERWISE_STRING;
}
-
-
}
1.4 +84 -55 xml-xalan/java/src/org/apache/xalan/templates/ElemPI.java
Index: ElemPI.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemPI.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ElemPI.java 2000/10/17 19:03:55 1.3
+++ ElemPI.java 2000/10/30 18:49:53 1.4
@@ -57,7 +57,9 @@
package org.apache.xalan.templates;
import org.w3c.dom.*;
+
import org.xml.sax.*;
+
import org.apache.xpath.*;
import org.apache.xalan.utils.QName;
import org.apache.xalan.res.XSLTErrorResources;
@@ -68,7 +70,7 @@
* Implement xsl:processing-instruction.
* <pre>
* <!ELEMENT xsl:processing-instruction %char-template;>
- * <!ATTLIST xsl:processing-instruction
+ * <!ATTLIST xsl:processing-instruction
* name %avt; #REQUIRED
* %space-att;
* >
@@ -77,17 +79,20 @@
*/
public class ElemPI extends ElemTemplateElement
{
+
/**
- * The xsl:processing-instruction element has a required name
- * attribute that specifies the name of the processing instruction node.
- * The value of the name attribute is interpreted as an
+ * The xsl:processing-instruction element has a required name
+ * attribute that specifies the name of the processing instruction node.
+ * The value of the name attribute is interpreted as an
* attribute value template.
*/
private AVT m_name_atv = null;
/**
- * Set the "name" attribute.
- * DJD
+ * Set the "name" attribute.
+ * DJD
+ *
+ * NEEDSDOC @param v
*/
public void setName(AVT v)
{
@@ -95,25 +100,31 @@
}
/**
- * Get the "name" attribute.
- * DJD
+ * Get the "name" attribute.
+ * DJD
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public AVT getName()
{
return m_name_atv;
}
-
+
/**
* Get an int constant identifying the type of element.
* @see org.apache.xalan.templates.Constants
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public int getXSLToken()
{
return Constants.ELEMNAME_PI;
}
-
- /**
+
+ /**
* Return the node name.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public String getNodeName()
{
@@ -122,28 +133,37 @@
/**
* Create a processing instruction in the result tree.
- * The content of the xsl:processing-instruction element is a
- * template for the string-value of the processing instruction node.
+ * The content of the xsl:processing-instruction element is a
+ * template for the string-value of the processing instruction node.
* @see <a
href="http://www.w3.org/TR/xslt#section-Creating-Processing-Instructions">section-Creating-Processing-Instructions
in XSLT Specification</a>
- */
- public void execute(TransformerImpl transformer,
- Node sourceNode,
- QName mode)
- throws SAXException
- {
- if(TransformerImpl.S_DEBUG)
+ *
+ * NEEDSDOC @param transformer
+ * NEEDSDOC @param sourceNode
+ * NEEDSDOC @param mode
+ *
+ * @throws SAXException
+ */
+ public void execute(
+ TransformerImpl transformer, Node sourceNode, QName mode)
+ throws SAXException
+ {
+
+ if (TransformerImpl.S_DEBUG)
transformer.getTraceManager().fireTraceEvent(sourceNode, mode, this);
- String piName = m_name_atv.evaluate(transformer.getXPathContext(),
sourceNode, this);
- if(piName.equalsIgnoreCase("xml"))
+ String piName = m_name_atv.evaluate(transformer.getXPathContext(),
+ sourceNode, this);
+
+ if (piName.equalsIgnoreCase("xml"))
{
- error(XSLTErrorResources.ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML);
//"processing-instruction name can not be 'xml'");
+ error(XSLTErrorResources.ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML);
//"processing-instruction name can not be 'xml'");
}
- else if(!isValidNCName(piName))
+ else if (!isValidNCName(piName))
{
- error(XSLTErrorResources.ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME, new
Object[] {piName}); //"processing-instruction name must be a valid NCName:
"+piName);
+ error(XSLTErrorResources.ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME,
+ new Object[]{ piName }); //"processing-instruction name must be
a valid NCName: "+piName);
}
-
+
// Note the content model is:
// <!ENTITY % instructions "
// %char-instructions;
@@ -152,49 +172,58 @@
// | xsl:element
// | xsl:attribute
// ">
- String data = transformer.transformToString(this,
- sourceNode, mode);
+ String data = transformer.transformToString(this, sourceNode, mode);
+
transformer.getResultTreeHandler().processingInstruction(piName, data);
}
-
+
/**
* Add a child to the child list.
+ *
+ * NEEDSDOC @param newChild
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws DOMException
*/
- public Node appendChild(Node newChild)
- throws DOMException
+ public Node appendChild(Node newChild) throws DOMException
{
- int type = ((ElemTemplateElement)newChild).getXSLToken();
- switch(type)
+
+ int type = ((ElemTemplateElement) newChild).getXSLToken();
+
+ switch (type)
{
- // char-instructions
- case Constants.ELEMNAME_TEXTLITERALRESULT:
- case Constants.ELEMNAME_APPLY_TEMPLATES:
- case Constants.ELEMNAME_APPLY_IMPORTS:
- case Constants.ELEMNAME_CALLTEMPLATE:
- case Constants.ELEMNAME_FOREACH:
- case Constants.ELEMNAME_VALUEOF:
- case Constants.ELEMNAME_COPY_OF:
- case Constants.ELEMNAME_NUMBER:
- case Constants.ELEMNAME_CHOOSE:
- case Constants.ELEMNAME_IF:
- case Constants.ELEMNAME_TEXT:
- case Constants.ELEMNAME_COPY:
- case Constants.ELEMNAME_VARIABLE:
- case Constants.ELEMNAME_MESSAGE:
-
+
+ // char-instructions
+ case Constants.ELEMNAME_TEXTLITERALRESULT :
+ case Constants.ELEMNAME_APPLY_TEMPLATES :
+ case Constants.ELEMNAME_APPLY_IMPORTS :
+ case Constants.ELEMNAME_CALLTEMPLATE :
+ case Constants.ELEMNAME_FOREACH :
+ case Constants.ELEMNAME_VALUEOF :
+ case Constants.ELEMNAME_COPY_OF :
+ case Constants.ELEMNAME_NUMBER :
+ case Constants.ELEMNAME_CHOOSE :
+ case Constants.ELEMNAME_IF :
+ case Constants.ELEMNAME_TEXT :
+ case Constants.ELEMNAME_COPY :
+ case Constants.ELEMNAME_VARIABLE :
+ case Constants.ELEMNAME_MESSAGE :
+
// instructions
// case Constants.ELEMNAME_PI:
// case Constants.ELEMNAME_COMMENT:
// case Constants.ELEMNAME_ELEMENT:
// case Constants.ELEMNAME_ATTRIBUTE:
-
break;
-
- default:
- error(XSLTErrorResources.ER_CANNOT_ADD, new Object[]
{newChild.getNodeName(), this.getNodeName()}); //"Can not add "
+((ElemTemplateElement)newChild).m_elemName +
- //" to " + this.m_elemName);
+ default :
+ error(XSLTErrorResources.ER_CANNOT_ADD,
+ new Object[]{ newChild.getNodeName(),
+ this.getNodeName() }); //"Can not add "
+((ElemTemplateElement)newChild).m_elemName +
+
+ //" to " + this.m_elemName);
}
+
return super.appendChild(newChild);
}
-
}
1.3 +42 -23
xml-xalan/java/src/org/apache/xalan/templates/ElemParam.java
Index: ElemParam.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemParam.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ElemParam.java 2000/07/05 14:40:14 1.2
+++ ElemParam.java 2000/10/30 18:49:54 1.3
@@ -57,7 +57,9 @@
package org.apache.xalan.templates;
import org.w3c.dom.*;
+
import org.xml.sax.*;
+
import org.apache.xpath.*;
import org.apache.xalan.trace.*;
import org.apache.xalan.utils.QName;
@@ -68,7 +70,7 @@
* Implement xsl:param.
* <pre>
* <!ELEMENT xsl:param %template;>
- * <!ATTLIST xsl:param
+ * <!ATTLIST xsl:param
* name %qname; #REQUIRED
* select %expr; #IMPLIED
* >
@@ -77,58 +79,75 @@
*/
public class ElemParam extends ElemVariable
{
- public ElemParam()
- {
- }
+
+ /**
+ * Constructor ElemParam
+ *
+ */
+ public ElemParam(){}
/**
* Get an int constant identifying the type of element.
* @see org.apache.xalan.templates.Constants
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public int getXSLToken()
{
return Constants.ELEMNAME_PARAMVARIABLE;
}
-
- /**
+
+ /**
* Return the node name.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public String getNodeName()
{
return Constants.ELEMNAME_PARAMVARIABLE_STRING;
}
-
+
/**
* Copy constructor.
+ *
+ * NEEDSDOC @param param
+ *
+ * @throws SAXException
*/
- public ElemParam (ElemParam param)
- throws SAXException
+ public ElemParam(ElemParam param) throws SAXException
{
super(param);
}
/**
- * Execute a parameter declaration. There are two elements that can
- * be used to bind variables: xsl:variable and xsl:param. The
- * difference is that the value specified on the xsl:param variable
- * is only a default value for the binding; when the template or
- * stylesheet within which the xsl:param element occurs is invoked,
+ * Execute a parameter declaration. There are two elements that can
+ * be used to bind variables: xsl:variable and xsl:param. The
+ * difference is that the value specified on the xsl:param variable
+ * is only a default value for the binding; when the template or
+ * stylesheet within which the xsl:param element occurs is invoked,
* parameters may be passed that are used in place of the default values.
+ *
+ * NEEDSDOC @param transformer
+ * NEEDSDOC @param sourceNode
+ * NEEDSDOC @param mode
+ *
+ * @throws SAXException
*/
- public void execute(TransformerImpl transformer,
- Node sourceNode,
- QName mode)
- throws SAXException
- {
- Object obj =
transformer.getXPathContext().getVarStack().getParamVariable(getName());
-
- if(null == obj)
+ public void execute(
+ TransformerImpl transformer, Node sourceNode, QName mode)
+ throws SAXException
+ {
+
+ Object obj =
+
transformer.getXPathContext().getVarStack().getParamVariable(getName());
+
+ if (null == obj)
{
super.execute(transformer, sourceNode, mode);
}
else
{
- if(TransformerImpl.S_DEBUG)
+ if (TransformerImpl.S_DEBUG)
transformer.getTraceManager().fireTraceEvent(sourceNode, mode, this);
}
}
1.4 +102 -68
xml-xalan/java/src/org/apache/xalan/templates/ElemSort.java
Index: ElemSort.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemSort.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ElemSort.java 2000/08/23 18:08:56 1.3
+++ ElemSort.java 2000/10/30 18:49:55 1.4
@@ -57,11 +57,13 @@
package org.apache.xalan.templates;
import org.w3c.dom.*;
+
import org.xml.sax.*;
+
import org.apache.xpath.*;
import org.apache.xalan.res.XSLTErrorResources;
import org.apache.xalan.transformer.TransformerImpl;
-
+
/**
* <meta name="usage" content="advanced"/>
* Implement xsl:sort.
@@ -81,58 +83,66 @@
*/
public class ElemSort extends ElemTemplateElement
{
+
/**
* xsl:sort has a select attribute whose value is an expression.
*/
private XPath m_selectExpression = null;
-
+
/**
- * Set the "select" attribute.
- * xsl:sort has a select attribute whose value is an expression.
- * For each node to be processed, the expression is evaluated
- * with that node as the current node and with the complete
- * list of nodes being processed in unsorted order as the current
- * node list. The resulting object is converted to a string as if
- * by a call to the string function; this string is used as the
- * sort key for that node. The default value of the select attribute
- * is ., which will cause the string-value of the current node to
+ * Set the "select" attribute.
+ * xsl:sort has a select attribute whose value is an expression.
+ * For each node to be processed, the expression is evaluated
+ * with that node as the current node and with the complete
+ * list of nodes being processed in unsorted order as the current
+ * node list. The resulting object is converted to a string as if
+ * by a call to the string function; this string is used as the
+ * sort key for that node. The default value of the select attribute
+ * is ., which will cause the string-value of the current node to
* be used as the sort key.
+ *
+ * NEEDSDOC @param v
*/
public void setSelect(XPath v)
{
- if (v.getPatternString().indexOf("{") < 0)
- m_selectExpression = v;
+
+ if (v.getPatternString().indexOf("{") < 0)
+ m_selectExpression = v;
else
error(XSLTErrorResources.ER_NO_CURLYBRACE, null);
}
/**
- * Get the "select" attribute.
- * xsl:sort has a select attribute whose value is an expression.
- * For each node to be processed, the expression is evaluated
- * with that node as the current node and with the complete
- * list of nodes being processed in unsorted order as the current
- * node list. The resulting object is converted to a string as if
- * by a call to the string function; this string is used as the
- * sort key for that node. The default value of the select attribute
- * is ., which will cause the string-value of the current node to
+ * Get the "select" attribute.
+ * xsl:sort has a select attribute whose value is an expression.
+ * For each node to be processed, the expression is evaluated
+ * with that node as the current node and with the complete
+ * list of nodes being processed in unsorted order as the current
+ * node list. The resulting object is converted to a string as if
+ * by a call to the string function; this string is used as the
+ * sort key for that node. The default value of the select attribute
+ * is ., which will cause the string-value of the current node to
* be used as the sort key.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public XPath getSelect()
{
return m_selectExpression;
}
-
+
/**
* lang specifies the language of the sort keys.
*/
private AVT m_lang_avt = null;
-
+
/**
- * Set the "lang" attribute.
- * lang specifies the language of the sort keys; it has the same
- * range of values as xml:lang [XML]; if no lang value is
+ * Set the "lang" attribute.
+ * lang specifies the language of the sort keys; it has the same
+ * range of values as xml:lang [XML]; if no lang value is
* specified, the language should be determined from the system
environment.
+ *
+ * NEEDSDOC @param v
*/
public void setLang(AVT v)
{
@@ -140,25 +150,26 @@
}
/**
- * Get the "lang" attribute.
- * lang specifies the language of the sort keys; it has the same
- * range of values as xml:lang [XML]; if no lang value is
+ * Get the "lang" attribute.
+ * lang specifies the language of the sort keys; it has the same
+ * range of values as xml:lang [XML]; if no lang value is
* specified, the language should be determined from the system
environment.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public AVT getLang()
{
return m_lang_avt;
}
-
-
+
/**
* data-type specifies the data type of the
* strings to be sorted.
*/
private AVT m_dataType_avt = null;
-
+
/**
- * Set the "data-type" attribute.
+ * Set the "data-type" attribute.
* <code>data-type</code> specifies the data type of the
* strings; the following values are allowed:
* <ul>
@@ -186,6 +197,8 @@
* <b>NOTE: </b>The XSL Working Group plans that future versions of XSLT
will
* leverage XML Schemas to define further values for this
* attribute.</blockquote>
+ *
+ * NEEDSDOC @param v
*/
public void setDataType(AVT v)
{
@@ -193,7 +206,7 @@
}
/**
- * Get the "data-type" attribute.
+ * Get the "data-type" attribute.
* <code>data-type</code> specifies the data type of the
* strings; the following values are allowed:
* <ul>
@@ -221,23 +234,27 @@
* <b>NOTE: </b>The XSL Working Group plans that future versions of XSLT
will
* leverage XML Schemas to define further values for this
* attribute.</blockquote>
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public AVT getDataType()
{
return m_dataType_avt;
}
-
+
/**
- * order specifies whether the strings should be sorted in ascending
+ * order specifies whether the strings should be sorted in ascending
* or descending order.
*/
private AVT m_order_avt = null;
-
+
/**
- * Set the "order" attribute.
- * order specifies whether the strings should be sorted in ascending
- * or descending order; ascending specifies ascending order; descending
+ * Set the "order" attribute.
+ * order specifies whether the strings should be sorted in ascending
+ * or descending order; ascending specifies ascending order; descending
* specifies descending order; the default is ascending.
+ *
+ * NEEDSDOC @param v
*/
public void setOrder(AVT v)
{
@@ -245,30 +262,34 @@
}
/**
- * Get the "order" attribute.
- * order specifies whether the strings should be sorted in ascending
- * or descending order; ascending specifies ascending order; descending
+ * Get the "order" attribute.
+ * order specifies whether the strings should be sorted in ascending
+ * or descending order; ascending specifies ascending order; descending
* specifies descending order; the default is ascending.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public AVT getOrder()
{
return m_order_avt;
}
-
+
/**
- * case-order has the value upper-first or lower-first.
+ * case-order has the value upper-first or lower-first.
* The default value is language dependent.
*/
private AVT m_caseorder_avt = null;
-
+
/**
- * Set the "case-order" attribute.
- * case-order has the value upper-first or lower-first; this applies
- * when data-type="text", and specifies that upper-case letters should
- * sort before lower-case letters or vice-versa respectively.
- * For example, if lang="en", then A a B b are sorted with
- * case-order="upper-first" and a A b B are sorted with
case-order="lower-first".
+ * Set the "case-order" attribute.
+ * case-order has the value upper-first or lower-first; this applies
+ * when data-type="text", and specifies that upper-case letters should
+ * sort before lower-case letters or vice-versa respectively.
+ * For example, if lang="en", then A a B b are sorted with
+ * case-order="upper-first" and a A b B are sorted with
case-order="lower-first".
* The default value is language dependent.
+ *
+ * NEEDSDOC @param v
*/
public void setCaseOrder(AVT v)
{
@@ -276,46 +297,59 @@
}
/**
- * Get the "case-order" attribute.
- * case-order has the value upper-first or lower-first; this applies
- * when data-type="text", and specifies that upper-case letters should
- * sort before lower-case letters or vice-versa respectively.
- * For example, if lang="en", then A a B b are sorted with
- * case-order="upper-first" and a A b B are sorted with
case-order="lower-first".
+ * Get the "case-order" attribute.
+ * case-order has the value upper-first or lower-first; this applies
+ * when data-type="text", and specifies that upper-case letters should
+ * sort before lower-case letters or vice-versa respectively.
+ * For example, if lang="en", then A a B b are sorted with
+ * case-order="upper-first" and a A b B are sorted with
case-order="lower-first".
* The default value is language dependent.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public AVT getCaseOrder()
{
return m_caseorder_avt;
}
-
/**
* Get an int constant identifying the type of element.
* @see org.apache.xalan.templates.Constants
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public int getXSLToken()
{
return Constants.ELEMNAME_SORT;
}
-
- /**
+
+ /**
* Return the node name.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public String getNodeName()
{
return Constants.ELEMNAME_SORT_STRING;
}
-
+
/**
* Add a child to the child list.
+ *
+ * NEEDSDOC @param newChild
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws DOMException
*/
- public Node appendChild(Node newChild)
- throws DOMException
+ public Node appendChild(Node newChild) throws DOMException
{
- error(XSLTErrorResources.ER_CANNOT_ADD, new Object[]
{newChild.getNodeName(), this.getNodeName()}); //"Can not add "
+((ElemTemplateElement)newChild).m_elemName +
- //" to " + this.m_elemName);
+
+ error(XSLTErrorResources.ER_CANNOT_ADD,
+ new Object[]{ newChild.getNodeName(),
+ this.getNodeName() }); //"Can not add "
+((ElemTemplateElement)newChild).m_elemName +
+
+ //" to " + this.m_elemName);
return null;
}
-
}
1.3 +117 -71
xml-xalan/java/src/org/apache/xalan/templates/ElemTemplate.java
Index: ElemTemplate.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemTemplate.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ElemTemplate.java 2000/07/05 14:40:18 1.2
+++ ElemTemplate.java 2000/10/30 18:49:56 1.3
@@ -57,7 +57,9 @@
package org.apache.xalan.templates;
import org.w3c.dom.*;
+
import org.xml.sax.*;
+
import org.apache.xpath.*;
import org.apache.xalan.utils.QName;
import org.apache.xalan.res.XSLTErrorResources;
@@ -71,9 +73,9 @@
* (#PCDATA
* %instructions;
* %result-elements;
- * | xsl:param)*
+ * | xsl:param)
* >
- *
+ *
* <!ATTLIST xsl:template
* match %pattern; #IMPLIED
* name %qname; #IMPLIED
@@ -86,9 +88,13 @@
*/
public class ElemTemplate extends ElemTemplateElement
{
+
+ /** NEEDSDOC Field m_publicId */
private String m_publicId;
+
+ /** NEEDSDOC Field m_systemId */
private String m_systemId;
-
+
/**
* Return the public identifier for the current document event.
* <p>This will be the public identifier
@@ -96,11 +102,11 @@
* null if none is available.
* @see #getSystemId
*/
- public String getPublicId ()
+ public String getPublicId()
{
return m_publicId;
}
-
+
/**
* Return the system identifier for the current document event.
*
@@ -111,22 +117,26 @@
* if none is available.
* @see #getPublicId
*/
- public String getSystemId ()
+ public String getSystemId()
{
return m_systemId;
}
-
+
/**
* Set the location information for this element.
+ *
+ * NEEDSDOC @param locator
*/
public void setLocaterInfo(Locator locator)
{
+
m_publicId = locator.getPublicId();
m_systemId = locator.getSystemId();
+
super.setLocaterInfo(locator);
}
-
- /**
+
+ /**
* The owning stylesheet.
* (Should this only be put on the template element, to
* conserve space?)
@@ -136,6 +146,8 @@
/**
* Get the owning stylesheet.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public StylesheetComposed getStylesheetComposed()
{
@@ -144,14 +156,18 @@
/**
* Get the owning stylesheet.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public Stylesheet getStylesheet()
{
return m_stylesheet;
}
-
+
/**
* Set the owning stylesheet.
+ *
+ * NEEDSDOC @param sheet
*/
public void setStylesheet(Stylesheet sheet)
{
@@ -160,26 +176,30 @@
/**
* Get the owning stylesheet.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public StylesheetRoot getStylesheetRoot()
{
return m_stylesheet.getStylesheetRoot();
}
-
+
/**
- * The match attribute is a Pattern that identifies the source
+ * The match attribute is a Pattern that identifies the source
* node or nodes to which the rule applies.
*/
private XPath m_matchPattern = null;
-
+
/**
- * Set the "match" attribute.
- * The match attribute is a Pattern that identifies the source
- * node or nodes to which the rule applies. The match attribute
- * is required unless the xsl:template element has a name
- * attribute (see [6 Named Templates]). It is an error for the
- * value of the match attribute to contain a VariableReference.
+ * Set the "match" attribute.
+ * The match attribute is a Pattern that identifies the source
+ * node or nodes to which the rule applies. The match attribute
+ * is required unless the xsl:template element has a name
+ * attribute (see [6 Named Templates]). It is an error for the
+ * value of the match attribute to contain a VariableReference.
* @see <a href="http://www.w3.org/TR/xslt#patterns">patterns in XSLT
Specification</a>
+ *
+ * NEEDSDOC @param v
*/
public void setMatch(XPath v)
{
@@ -187,30 +207,34 @@
}
/**
- * Get the "match" attribute.
- * The match attribute is a Pattern that identifies the source
- * node or nodes to which the rule applies. The match attribute
- * is required unless the xsl:template element has a name
- * attribute (see [6 Named Templates]). It is an error for the
- * value of the match attribute to contain a VariableReference.
+ * Get the "match" attribute.
+ * The match attribute is a Pattern that identifies the source
+ * node or nodes to which the rule applies. The match attribute
+ * is required unless the xsl:template element has a name
+ * attribute (see [6 Named Templates]). It is an error for the
+ * value of the match attribute to contain a VariableReference.
* @see <a href="http://www.w3.org/TR/xslt#patterns">patterns in XSLT
Specification</a>
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public XPath getMatch()
{
return m_matchPattern;
}
-
+
/**
* An xsl:template element with a name attribute specifies a named
template.
*/
private QName m_name = null;
-
+
/**
- * Set the "name" attribute.
+ * Set the "name" attribute.
* An xsl:template element with a name attribute specifies a named
template.
- * If an xsl:template element has a name attribute, it may, but need not,
- * also have a match attribute.
+ * If an xsl:template element has a name attribute, it may, but need not,
+ * also have a match attribute.
* @see <a
href="http://www.w3.org/TR/xslt#named-templates">named-templates in XSLT
Specification</a>
+ *
+ * NEEDSDOC @param v
*/
public void setName(QName v)
{
@@ -218,29 +242,33 @@
}
/**
- * Get the "name" attribute.
+ * Get the "name" attribute.
* An xsl:template element with a name attribute specifies a named
template.
- * If an xsl:template element has a name attribute, it may, but need not,
- * also have a match attribute.
+ * If an xsl:template element has a name attribute, it may, but need not,
+ * also have a match attribute.
* @see <a
href="http://www.w3.org/TR/xslt#named-templates">named-templates in XSLT
Specification</a>
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public QName getName()
{
return m_name;
}
-
+
/**
- * Modes allow an element to be processed multiple times,
+ * Modes allow an element to be processed multiple times,
* each time producing a different result.
*/
private QName m_mode;
-
+
/**
- * Set the "mode" attribute.
- * Modes allow an element to be processed multiple times,
- * each time producing a different result. If xsl:template
- * does not have a match attribute, it must not have a mode attribute.
+ * Set the "mode" attribute.
+ * Modes allow an element to be processed multiple times,
+ * each time producing a different result. If xsl:template
+ * does not have a match attribute, it must not have a mode attribute.
* @see <a href="http://www.w3.org/TR/xslt#modes">modes in XSLT
Specification</a>
+ *
+ * NEEDSDOC @param v
*/
public void setMode(QName v)
{
@@ -248,30 +276,34 @@
}
/**
- * Get the "mode" attribute.
- * Modes allow an element to be processed multiple times,
- * each time producing a different result. If xsl:template
- * does not have a match attribute, it must not have a mode attribute.
+ * Get the "mode" attribute.
+ * Modes allow an element to be processed multiple times,
+ * each time producing a different result. If xsl:template
+ * does not have a match attribute, it must not have a mode attribute.
* @see <a href="http://www.w3.org/TR/xslt#modes">modes in XSLT
Specification</a>
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public QName getMode()
{
return m_mode;
}
-
+
/**
- * The priority of a template rule is specified by the priority
+ * The priority of a template rule is specified by the priority
* attribute on the template rule.
*/
private double m_priority = XPath.MATCH_SCORE_NONE;
-
+
/**
- * Set the "priority" attribute.
- * The priority of a template rule is specified by the priority
- * attribute on the template rule. The value of this must be a
- * real number (positive or negative), matching the production
- * Number with an optional leading minus sign (-).
+ * Set the "priority" attribute.
+ * The priority of a template rule is specified by the priority
+ * attribute on the template rule. The value of this must be a
+ * real number (positive or negative), matching the production
+ * Number with an optional leading minus sign (-).
* @see <a href="http://www.w3.org/TR/xslt#conflict">conflict in XSLT
Specification</a>
+ *
+ * NEEDSDOC @param v
*/
public void setPriority(double v)
{
@@ -279,12 +311,14 @@
}
/**
- * Get the "priority" attribute.
- * The priority of a template rule is specified by the priority
- * attribute on the template rule. The value of this must be a
- * real number (positive or negative), matching the production
- * Number with an optional leading minus sign (-).
+ * Get the "priority" attribute.
+ * The priority of a template rule is specified by the priority
+ * attribute on the template rule. The value of this must be a
+ * real number (positive or negative), matching the production
+ * Number with an optional leading minus sign (-).
* @see <a href="http://www.w3.org/TR/xslt#conflict">conflict in XSLT
Specification</a>
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public double getPriority()
{
@@ -294,14 +328,18 @@
/**
* Get an int constant identifying the type of element.
* @see org.apache.xalan.templates.Constants
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public int getXSLToken()
{
return Constants.ELEMNAME_TEMPLATE;
}
-
- /**
+
+ /**
* Return the node name.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public String getNodeName()
{
@@ -310,25 +348,33 @@
/**
* Copy the template contents into the result tree.
- * The content of the xsl:template element is the template
+ * The content of the xsl:template element is the template
* that is instantiated when the template rule is applied.
+ *
+ * NEEDSDOC @param transformer
+ * NEEDSDOC @param sourceNode
+ * NEEDSDOC @param mode
+ *
+ * @throws SAXException
*/
- public void execute(TransformerImpl transformer,
- Node sourceNode,
- QName mode)
- throws SAXException
- {
- if(TransformerImpl.S_DEBUG)
+ public void execute(
+ TransformerImpl transformer, Node sourceNode, QName mode)
+ throws SAXException
+ {
+
+ if (TransformerImpl.S_DEBUG)
transformer.getTraceManager().fireTraceEvent(sourceNode, mode, this);
- if(null != sourceNode)
- {
+ if (null != sourceNode)
+ {
transformer.executeChildTemplates(this, sourceNode, mode);
}
- else // if(null == sourceNode)
+ else // if(null == sourceNode)
{
- transformer.getMsgMgr().error(this, sourceNode,
-
XSLTErrorResources.ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES);
+ transformer.getMsgMgr().error(
+ this, sourceNode,
+ XSLTErrorResources.ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES);
+
//"sourceNode is null in handleApplyTemplatesInstruction!");
}
}
1.17 +456 -299
xml-xalan/java/src/org/apache/xalan/templates/ElemTemplateElement.java
Index: ElemTemplateElement.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemTemplateElement.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- ElemTemplateElement.java 2000/10/18 16:25:10 1.16
+++ ElemTemplateElement.java 2000/10/30 18:49:56 1.17
@@ -57,7 +57,9 @@
package org.apache.xalan.templates;
import java.lang.InstantiationException;
+
import java.io.Serializable;
+
import java.util.Enumeration;
import java.util.Vector;
@@ -67,14 +69,11 @@
import org.apache.xalan.utils.PrefixResolver;
import org.apache.xalan.utils.QName;
import org.apache.xalan.utils.StringToStringTable;
-
import org.apache.xalan.res.XSLTErrorResources;
import org.apache.xalan.res.XSLMessages;
-
import org.apache.xalan.transformer.TransformerImpl;
import org.apache.xalan.transformer.ResultNameSpace;
import org.apache.xalan.transformer.ResultTreeHandler;
-
import org.apache.xpath.VariableStack;
// TRaX imports
@@ -95,7 +94,7 @@
import org.xml.sax.SAXException;
import org.xml.sax.helpers.NamespaceSupport;
-/**
+/**
* <meta name="usage" content="advanced"/>
* An instance of this class represents an element inside
* an xsl:template class. It has a single "execute" method
@@ -105,14 +104,16 @@
* Element interface, but is not a full implementation
* of that interface... it only implements enough for
* basic traversal of the tree.
- *
+ *
* @see Stylesheet
*/
-public class ElemTemplateElement extends UnImplNode
- implements PrefixResolver, Serializable, Locator
-{
- /** Construct a template element instance.
- *
+public class ElemTemplateElement extends UnImplNode
+ implements PrefixResolver, Serializable, Locator
+{
+
+ /**
+ * Construct a template element instance.
+ *
* @param transformer The XSLT Processor.
* @param stylesheetTree The owning stylesheet.
* @param name The name of the element.
@@ -121,22 +122,22 @@
* @param columnNumber The column index in the XSLT file that the element
occurs on.
* @exception SAXException Never.
*/
- public ElemTemplateElement()
- {
- }
-
+ public ElemTemplateElement(){}
+
/**
* Tell if this template is a compiled template.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public boolean isCompiledTemplate()
{
return false;
}
-
- /**
+
+ /**
* Get an integer representation of the element type.
- *
- * @return An integer representation of the element, defined in the
+ *
+ * @return An integer representation of the element, defined in the
* Constants class.
* @see org.apache.xalan.templates.Constants
*/
@@ -144,52 +145,51 @@
{
return Constants.ELEMNAME_UNDEFINED;
}
-
- /**
+
+ /**
* Return the node name.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public String getNodeName()
{
return "Unknown XSLT Element";
}
-
- /**
- * This function will be called on top-level elements
+
+ /**
+ * This function will be called on top-level elements
* only, just before the transform begins.
- *
+ *
* @param transformer The XSLT Processor.
+ *
+ * @throws SAXException
*/
- public void runtimeInit(TransformerImpl transformer)
- throws SAXException
- {
- }
+ public void runtimeInit(TransformerImpl transformer) throws SAXException{}
-
- /** Execute the element's primary function. Subclasses of this
+ /**
+ * Execute the element's primary function. Subclasses of this
* function may recursivly execute down the element tree.
- *
- * @exception XSLProcessorException
- * @exception java.net.MalformedURLException
- * @exception java.io.FileNotFoundException
- * @exception java.io.IOException
- * @exception SAXException
+ *
+ * @exception XSLProcessorException
+ * @exception java.net.MalformedURLException
+ * @exception java.io.FileNotFoundException
+ * @exception java.io.IOException
+ * @exception SAXException
* @param transformer The XSLT Processor.
* @param sourceNode The current context node.
* @param mode The current mode.
*/
- public void execute(TransformerImpl transformer,
- Node sourceNode,
- QName mode)
- throws SAXException
- {
- }
+ public void execute(
+ TransformerImpl transformer, Node sourceNode, QName mode)
+ throws SAXException{}
-
/**
- * Get the owning "composed" stylesheet. This looks up the
+ * Get the owning "composed" stylesheet. This looks up the
* inheritance chain until it calls getStylesheetComposed
- * on a Stylesheet object, which will Get the owning
+ * on a Stylesheet object, which will Get the owning
* aggregated stylesheet, or that stylesheet if it is aggregated.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public StylesheetComposed getStylesheetComposed()
{
@@ -197,9 +197,11 @@
}
/**
- * Get the owning stylesheet. This looks up the
+ * Get the owning stylesheet. This looks up the
* inheritance chain until it calls getStylesheet
* on a Stylesheet object, which will return itself.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public Stylesheet getStylesheet()
{
@@ -207,121 +209,146 @@
}
/**
- * Get the owning root stylesheet. This looks up the
+ * Get the owning root stylesheet. This looks up the
* inheritance chain until it calls StylesheetRoot
- * on a Stylesheet object, which will return a reference
+ * on a Stylesheet object, which will return a reference
* to the root stylesheet.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public StylesheetRoot getStylesheetRoot()
{
return m_parentNode.getStylesheetRoot();
- }
-
+ }
+
/**
- * This function is called after everything else has been
- * recomposed, and allows the template to set remaining
- * values that may be based on some other property that
+ * This function is called after everything else has been
+ * recomposed, and allows the template to set remaining
+ * values that may be based on some other property that
* depends on recomposition.
*/
- public void compose()
- {
- }
-
- /**
+ public void compose(){}
+
+ /**
* Validate that the string is an NCName.
- *
+ *
* @param s The name in question.
* @return True if the string is a valid NCName according to XML rules.
* @see <a href="http://www.w3.org/TR/REC-xml-names#NT-NCName">XXX in XSLT
Specification</a>
*/
protected boolean isValidNCName(String s)
{
+
int len = s.length();
char c = s.charAt(0);
- if(!(Character.isLetter(c) || (c == '_')))
+
+ if (!(Character.isLetter(c) || (c == '_')))
return false;
- if(len > 0)
+
+ if (len > 0)
{
- for(int i = 1; i < len; i++)
+ for (int i = 1; i < len; i++)
{
c = s.charAt(i);
- if(!(Character.isLetterOrDigit(c) || (c == '_') || (c == '-') || (c
== '.')))
+
+ if (!(Character.isLetterOrDigit(c) || (c == '_') || (c == '-')
+ || (c == '.')))
return false;
}
}
+
return true;
}
-
- /**
+
+ /**
* Throw a template element runtime error. (Note: should we throw a
SAXException instead?)
- *
+ *
* @param msg Description of the error that occured.
+ * NEEDSDOC @param args
*/
public void error(int msg, Object[] args)
{
- String themsg = XSLMessages.createMessage(msg, args);
- throw new
RuntimeException(XSLMessages.createMessage(XSLTErrorResources.ER_ELEMTEMPLATEELEM_ERR,
new Object[] {themsg})); //"ElemTemplateElement error: "+msg);
+
+ String themsg = XSLMessages.createMessage(msg, args);
+
+ throw new RuntimeException(
+ XSLMessages.createMessage(
+ XSLTErrorResources.ER_ELEMTEMPLATEELEM_ERR, new Object[]{ themsg
})); //"ElemTemplateElement error: "+msg);
}
-
+
// Implemented DOM Element methods.
-
- /**
+
+ /**
* Add a child to the child list.
* NOTE: This presumes the child did not previously have a parent.
* Making that assumption makes this a less expensive operation -- but
* requires that if you *do* want to reparent a node, you use removeChild()
* first to remove it from its previous context. Failing to do so will
* damage the tree.
- *
- * @exception DOMException
- * @param newChild
+ *
+ *
+ * NEEDSDOC ($objectName$) @return
+ * @exception DOMException
+ * @param newChild
*/
- public Node appendChild(Node newChild)
- throws DOMException
+ public Node appendChild(Node newChild) throws DOMException
{
- if(null == newChild)
+
+ if (null == newChild)
{
- error(XSLTErrorResources.ER_NULL_CHILD, null); //"Trying to add a null
child!");
+ error(XSLTErrorResources.ER_NULL_CHILD, null); //"Trying to add a
null child!");
}
- ElemTemplateElement elem = (ElemTemplateElement)newChild;
- if(null == m_firstChild)
+
+ ElemTemplateElement elem = (ElemTemplateElement) newChild;
+
+ if (null == m_firstChild)
{
m_firstChild = elem;
}
else
{
- ElemTemplateElement last = (ElemTemplateElement)getLastChild();
+ ElemTemplateElement last = (ElemTemplateElement) getLastChild();
+
last.m_nextSibling = elem;
}
+
elem.m_parentNode = this;
-
+
return newChild;
}
-
- /**
+
+ /**
* Tell if there are child nodes.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
- public boolean hasChildNodes()
+ public boolean hasChildNodes()
{
return (null != m_firstChild);
}
-
- /**
+
+ /**
* Get the type of the node.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
- public short getNodeType()
+ public short getNodeType()
{
return Node.ELEMENT_NODE;
}
-
- /** Return the nodelist (same reference).
+
+ /**
+ * Return the nodelist (same reference).
+ *
+ * NEEDSDOC ($objectName$) @return
*/
- public NodeList getChildNodes()
+ public NodeList getChildNodes()
{
return this;
}
-
- /** Remove a child.
+
+ /**
+ * Remove a child.
* ADDED 9/8/200 to support compilation.
* TODO: ***** Alternative is "removeMe() from my parent if any"
* ... which is less well checked, but more convenient in some cases.
@@ -329,129 +356,155 @@
* be preferable. It's less DOMish, though.
* @param oldChild The child to remove. This operation is a no-op
* if oldChild is not a child of this node.
+ *
+ * NEEDSDOC @param childETE
* @return the removed child, or null if the specified
* node was not a child of this element.
+ *
+ * @throws DOMException
+ */
+ public Node removeChild(ElemTemplateElement childETE) throws DOMException
+ {
+
+ if (childETE == null || childETE.m_parentNode != this)
+ return null;
+
+ // Pointers to the child
+ if (childETE == m_firstChild)
+ m_firstChild = childETE.m_nextSibling;
+ else
+ {
+ ElemTemplateElement prev =
+ (ElemTemplateElement) (childETE.getPreviousSibling());
+
+ prev.m_nextSibling = childETE.m_nextSibling;
+ }
+
+ // Pointers from the child
+ childETE.m_parentNode = null;
+ childETE.m_nextSibling = null;
+
+ return childETE;
+ }
+
+ /**
+ * Replace the old child with a new child.
+ *
+ * NEEDSDOC @param newChild
+ * NEEDSDOC @param oldChild
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws DOMException
*/
- public Node removeChild(ElemTemplateElement childETE)
- throws DOMException
+ public Node replaceChild(Node newChild, Node oldChild) throws DOMException
{
- if(childETE==null || childETE.m_parentNode!=this)
- return null;
-
- // Pointers to the child
- if(childETE==m_firstChild)
- m_firstChild=childETE.m_nextSibling;
- else
- {
- ElemTemplateElement
prev=(ElemTemplateElement)(childETE.getPreviousSibling());
- prev.m_nextSibling=childETE.m_nextSibling;
- }
-
- // Pointers from the child
- childETE.m_parentNode = null;
- childETE.m_nextSibling = null;
- return childETE;
- }
-
- /** Replace the old child with a new child.
- */
- public Node replaceChild(Node newChild,
- Node oldChild)
- throws DOMException
- {
- if(oldChild==null || oldChild.getParentNode()!=this)
- return null;
-
- ElemTemplateElement newChildElem
- = ((ElemTemplateElement)newChild);
- ElemTemplateElement oldChildElem
- = ((ElemTemplateElement)oldChild);
+
+ if (oldChild == null || oldChild.getParentNode() != this)
+ return null;
+
+ ElemTemplateElement newChildElem = ((ElemTemplateElement) newChild);
+ ElemTemplateElement oldChildElem = ((ElemTemplateElement) oldChild);
// Fix up previous sibling.
- ElemTemplateElement prev
- = (ElemTemplateElement)oldChildElem.getPreviousSibling();
- if(null != prev)
+ ElemTemplateElement prev =
+ (ElemTemplateElement) oldChildElem.getPreviousSibling();
+
+ if (null != prev)
prev.m_nextSibling = newChildElem;
// Fix up parent (this)
- if(m_firstChild == oldChildElem)
+ if (m_firstChild == oldChildElem)
m_firstChild = newChildElem;
newChildElem.m_parentNode = this;
oldChildElem.m_parentNode = null;
-
newChildElem.m_nextSibling = oldChildElem.m_nextSibling;
oldChildElem.m_nextSibling = null;
// newChildElem.m_stylesheet = oldChildElem.m_stylesheet;
// oldChildElem.m_stylesheet = null;
-
return newChildElem;
}
-
- /**
+
+ /**
* NodeList method: Count the immediate children of this node
- *
+ *
* @return int
*/
- public int getLength()
+ public int getLength()
{
// It is assumed that the getChildNodes call synchronized
// the children. Therefore, we can access the first child
// reference directly.
int count = 0;
- for (ElemTemplateElement node = m_firstChild; node != null; node =
node.m_nextSibling)
+
+ for (ElemTemplateElement node = m_firstChild; node != null;
+ node = node.m_nextSibling)
{
count++;
}
+
return count;
+ } // getLength():int
- } // getLength():int
-
- /**
+ /**
* NodeList method: Return the Nth immediate child of this node, or
* null if the index is out of bounds.
- *
- * @param index
+ *
+ * @param index
* @return org.w3c.dom.Node
*/
- public Node item(int index)
+ public Node item(int index)
{
+
// It is assumed that the getChildNodes call synchronized
// the children. Therefore, we can access the first child
// reference directly.
ElemTemplateElement node = m_firstChild;
- for (int i = 0; i < index && node != null; i++)
+
+ for (int i = 0; i < index && node != null; i++)
{
node = node.m_nextSibling;
}
+
return node;
+ } // item(int):Node
- } // item(int):Node
-
- /** Get the stylesheet owner.
+ /**
+ * Get the stylesheet owner.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
- public Document getOwnerDocument()
+ public Document getOwnerDocument()
{
return getStylesheet();
}
-
- /** Return the element name.
+
+ /**
+ * Return the element name.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public String getTagName()
{
return getNodeName();
}
-
- /** Return the base identifier.
+
+ /**
+ * Return the base identifier.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public String getBaseIdentifier()
{
+
// Should this always be absolute?
return this.getSystemId();
}
-
+
+ /** NEEDSDOC Field m_lineNumber */
private int m_lineNumber;
/**
@@ -461,11 +514,12 @@
* @return The line number, or -1 if none is available.
* @see #getColumnNumber
*/
- public int getLineNumber ()
+ public int getLineNumber()
{
return m_lineNumber;
}
-
+
+ /** NEEDSDOC Field m_columnNumber */
private int m_columnNumber;
/**
@@ -476,11 +530,11 @@
* @return The column number, or -1 if none is available.
* @see #getLineNumber
*/
- public int getColumnNumber ()
+ public int getColumnNumber()
{
return m_columnNumber;
}
-
+
/**
* Return the public identifier for the current document event.
* <p>This will be the public identifier
@@ -488,11 +542,11 @@
* null if none is available.
* @see #getSystemId
*/
- public String getPublicId ()
+ public String getPublicId()
{
return (null != m_parentNode) ? m_parentNode.getPublicId() : null;
}
-
+
/**
* Return the system identifier for the current document event.
*
@@ -503,14 +557,15 @@
* if none is available.
* @see #getPublicId
*/
- public String getSystemId ()
+ public String getSystemId()
{
return this.getStylesheet().getHref();
}
-
/**
* Set the location information for this element.
+ *
+ * NEEDSDOC @param locator
*/
public void setLocaterInfo(Locator locator)
{
@@ -518,21 +573,22 @@
m_columnNumber = locator.getColumnNumber();
}
-
- /**
+ /**
* Tell if this element has the default space handling
* turned off or on according to the xml:space attribute.
* @serial
*/
private boolean m_defaultSpace = true;
-
+
/**
- * Set the "xml:space" attribute.
- * A text node is preserved if an ancestor element of the text node
- * has an xml:space attribute with a value of preserve, and
+ * Set the "xml:space" attribute.
+ * A text node is preserved if an ancestor element of the text node
+ * has an xml:space attribute with a value of preserve, and
* no closer ancestor element has xml:space with a value of default.
* @see <a href="http://www.w3.org/TR/xslt#strip">strip in XSLT
Specification</a>
* @see <a
href="http://www.w3.org/TR/xslt#section-Creating-Text">section-Creating-Text in
XSLT Specification</a>
+ *
+ * NEEDSDOC @param v
*/
public void setXmlSpace(boolean v)
{
@@ -540,368 +596,468 @@
}
/**
- * Get the "xml:space" attribute.
- * A text node is preserved if an ancestor element of the text node
- * has an xml:space attribute with a value of preserve, and
+ * Get the "xml:space" attribute.
+ * A text node is preserved if an ancestor element of the text node
+ * has an xml:space attribute with a value of preserve, and
* no closer ancestor element has xml:space with a value of default.
* @see <a href="http://www.w3.org/TR/xslt#strip">strip in XSLT
Specification</a>
* @see <a
href="http://www.w3.org/TR/xslt#section-Creating-Text">section-Creating-Text in
XSLT Specification</a>
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public boolean getXmlSpace()
{
return m_defaultSpace;
}
-
- /**
+
+ /**
* The list of namespace declarations for this element only.
* @serial
*/
private Vector m_declaredPrefixes;
-
+
/**
- * Return a table that contains all prefixes available
+ * Return a table that contains all prefixes available
* within this element context.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public Vector getDeclaredPrefixes()
{
return m_declaredPrefixes;
}
-
+
/**
- * From the SAX2 helper class, set the namespace table for
+ * From the SAX2 helper class, set the namespace table for
* this element. Take care to call resolveInheritedNamespaceDecls.
* after all namespace declarations have been added.
+ *
+ * NEEDSDOC @param nsSupport
+ *
+ * @throws SAXException
*/
- public void setPrefixes(NamespaceSupport nsSupport)
- throws SAXException
+ public void setPrefixes(NamespaceSupport nsSupport) throws SAXException
{
setPrefixes(nsSupport, false);
}
-
+
/**
- * From the SAX2 helper class, set the namespace table for
+ * From the SAX2 helper class, set the namespace table for
* this element. Take care to call resolveInheritedNamespaceDecls.
* after all namespace declarations have been added.
+ *
+ * NEEDSDOC @param nsSupport
+ * NEEDSDOC @param excludeXSLDecl
+ *
+ * @throws SAXException
*/
public void setPrefixes(NamespaceSupport nsSupport, boolean excludeXSLDecl)
- throws SAXException
+ throws SAXException
{
- Enumeration decls = nsSupport.getDeclaredPrefixes ();
- while(decls.hasMoreElements())
+
+ Enumeration decls = nsSupport.getDeclaredPrefixes();
+
+ while (decls.hasMoreElements())
{
- String prefix = (String)decls.nextElement();
- if(null == m_declaredPrefixes)
+ String prefix = (String) decls.nextElement();
+
+ if (null == m_declaredPrefixes)
m_declaredPrefixes = new Vector();
+
String uri = nsSupport.getURI(prefix);
- if(excludeXSLDecl && uri.equals(Constants.S_XSLNAMESPACEURL))
+
+ if (excludeXSLDecl && uri.equals(Constants.S_XSLNAMESPACEURL))
continue;
+
// System.out.println("setPrefixes - "+prefix+", "+uri);
XMLNSDecl decl = new XMLNSDecl(prefix, uri, false);
+
m_declaredPrefixes.addElement(decl);
}
}
-
- /**
+
+ /**
* Fullfill the PrefixResolver interface. Calling this will throw an
error.
+ *
+ * NEEDSDOC @param prefix
+ * NEEDSDOC @param context
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public String getNamespaceForPrefix(String prefix, org.w3c.dom.Node
context)
{
+
this.error(XSLTErrorResources.ER_CANT_RESOLVE_NSPREFIX, null);
+
return null;
}
-
- /**
+
+ /**
* Given a namespace, get the corrisponding prefix.
* 9/15/00: This had been iteratively examining the m_declaredPrefixes
* field for this node and its parents. That makes life difficult for
* the compilation experiment, which doesn't have a static vector of
* local declarations. Replaced a recursive solution, which permits
* easier subclassing/overriding.
+ *
+ * NEEDSDOC @param prefix
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public String getNamespaceForPrefix(String prefix)
{
+
Vector nsDecls = m_declaredPrefixes;
- if(null != nsDecls)
+
+ if (null != nsDecls)
+ {
+ int n = nsDecls.size();
+
+ for (int i = 0; i < n; i++)
{
- int n = nsDecls.size();
- for(int i = 0; i < n; i++)
- {
- XMLNSDecl decl = (XMLNSDecl)nsDecls.elementAt(i);
- if(prefix.equals(decl.getPrefix()))
- return decl.getURI();
- }
+ XMLNSDecl decl = (XMLNSDecl) nsDecls.elementAt(i);
+
+ if (prefix.equals(decl.getPrefix()))
+ return decl.getURI();
}
+ }
// Not found; ask our ancestors
- if(null!=m_parentNode)
+ if (null != m_parentNode)
return m_parentNode.getNamespaceForPrefix(prefix);
// No parent, so no definition
return null;
}
- /**
- * The table of namespace declarations for this element
+ /**
+ * The table of namespace declarations for this element
* and all parent elements, screened for excluded prefixes.
* @serial
*/
Vector m_prefixTable;
/**
- * Return a table that contains all prefixes available
+ * Return a table that contains all prefixes available
* within this element context.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public Vector getPrefixes()
{
return m_prefixTable;
}
-
+
/**
- * Tell if the result namespace decl should be excluded. Should be called
before
+ * Tell if the result namespace decl should be excluded. Should be called
before
* namespace aliasing (I think).
+ *
+ * NEEDSDOC @param prefix
+ * NEEDSDOC @param uri
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws SAXException
*/
private boolean excludeResultNSDecl(String prefix, String uri)
- throws SAXException
+ throws SAXException
{
+
if (uri != null)
- {
- if(uri.equals(Constants.S_XSLNAMESPACEURL)
- || getStylesheet().containsExtensionElementURI(uri)
- || uri.equals("http://xml.apache.org/xslt")
- || uri.equals("http://xsl.lotus.com/")
- || uri.equals("http://xsl.lotus.com"))
- return true;
-
- if(getStylesheet().containsExcludeResultPrefix(prefix))
+ {
+ if (uri.equals(Constants.S_XSLNAMESPACEURL)
+ || getStylesheet().containsExtensionElementURI(uri)
+ || uri.equals("http://xml.apache.org/xslt")
+ || uri.equals("http://xsl.lotus.com/")
+ || uri.equals("http://xsl.lotus.com"))
+ return true;
+
+ if (getStylesheet().containsExcludeResultPrefix(prefix))
return true;
}
+
return false;
}
-
/**
- * Combine the parent's namespaces with this namespace
- * for fast processing, taking care to reference the
+ * Combine the parent's namespaces with this namespace
+ * for fast processing, taking care to reference the
* parent's namespace if this namespace adds nothing new.
- * (Recursive method, walking the elements depth-first,
+ * (Recursive method, walking the elements depth-first,
* processing parents before children).
+ *
+ * @throws SAXException
*/
- public void resolvePrefixTables()
- throws SAXException
+ public void resolvePrefixTables() throws SAXException
{
+
// Always start with a fresh prefix table!
m_prefixTable = null;
-
+
// If we have declared declarations, then we look for
// a parent that has namespace decls, and add them
// to this element's decls. Otherwise we just point
// to the parent that has decls.
- if(null != this.m_declaredPrefixes)
+ if (null != this.m_declaredPrefixes)
{
+
// Add this element's declared prefixes to the
// prefix table.
int n = m_declaredPrefixes.size();
- for(int i = 0; i < n; i++)
+
+ for (int i = 0; i < n; i++)
{
- XMLNSDecl decl = (XMLNSDecl)m_declaredPrefixes.elementAt(i);
+ XMLNSDecl decl = (XMLNSDecl) m_declaredPrefixes.elementAt(i);
String prefix = decl.getPrefix();
String uri = decl.getURI();
boolean shouldExclude = excludeResultNSDecl(prefix, uri);
+
// Create a new prefix table if one has not already been created.
- if(null == m_prefixTable)
+ if (null == m_prefixTable)
m_prefixTable = new Vector();
+
m_prefixTable.addElement(new XMLNSDecl(prefix, uri, shouldExclude));
}
}
-
- ElemTemplateElement parent = (ElemTemplateElement)this.getParentNode();
- if(null != parent)
+
+ ElemTemplateElement parent = (ElemTemplateElement) this.getParentNode();
+
+ if (null != parent)
{
+
// The prefix table of the parent should never be null!
Vector prefixes = parent.m_prefixTable;
- if(null == m_prefixTable)
+
+ if (null == m_prefixTable)
{
+
// Nothing to combine, so just use parent's table!
this.m_prefixTable = parent.m_prefixTable;
}
else
{
+
// Add the prefixes from the parent's prefix table.
int n = prefixes.size();
- for(int i = 0; i < n; i++)
+
+ for (int i = 0; i < n; i++)
{
- XMLNSDecl decl = (XMLNSDecl)prefixes.elementAt(i);
- boolean shouldExclude
- = excludeResultNSDecl(decl.getPrefix(), decl.getURI());
- if(shouldExclude != decl.getIsExcluded())
+ XMLNSDecl decl = (XMLNSDecl) prefixes.elementAt(i);
+ boolean shouldExclude = excludeResultNSDecl(decl.getPrefix(),
+ decl.getURI());
+
+ if (shouldExclude != decl.getIsExcluded())
{
- decl = new XMLNSDecl(decl.getPrefix(), decl.getURI(),
shouldExclude);
+ decl = new XMLNSDecl(decl.getPrefix(), decl.getURI(),
+ shouldExclude);
}
m_prefixTable.addElement(decl);
}
-
}
}
- else if(null == m_prefixTable)
+ else if (null == m_prefixTable)
{
+
// Must be stylesheet element without any result prefixes!
m_prefixTable = new Vector();
}
-
+
// Resolve the children's prefix tables.
- for(ElemTemplateElement child = m_firstChild;
- child != null; child = child.m_nextSibling)
+ for (ElemTemplateElement child = m_firstChild; child != null;
+ child = child.m_nextSibling)
{
child.resolvePrefixTables();
}
}
-
+
/**
- * Send startPrefixMapping events to the result tree handler
+ * Send startPrefixMapping events to the result tree handler
* for all declared prefix mappings in the stylesheet.
+ *
+ * NEEDSDOC @param transformer
+ *
+ * @throws SAXException
*/
- void executeNSDecls(TransformerImpl transformer)
- throws SAXException
+ void executeNSDecls(TransformerImpl transformer) throws SAXException
{
- ResultTreeHandler rhandler = transformer.getResultTreeHandler();
- int n = m_prefixTable.size();
- for(int i = n-1; i >= 0; i--)
+
+ if (null != m_prefixTable)
{
- XMLNSDecl decl = (XMLNSDecl)m_prefixTable.elementAt(i);
- if(!decl.getIsExcluded())
+ ResultTreeHandler rhandler = transformer.getResultTreeHandler();
+ int n = m_prefixTable.size();
+
+ for (int i = n - 1; i >= 0; i--)
{
- rhandler.startPrefixMapping(decl.getPrefix(), decl.getURI(), true);
+ XMLNSDecl decl = (XMLNSDecl) m_prefixTable.elementAt(i);
+
+ if (!decl.getIsExcluded())
+ {
+ rhandler.startPrefixMapping(decl.getPrefix(), decl.getURI(), true);
+ }
}
- }
+ }
}
-
+
/**
- * Send startPrefixMapping events to the result tree handler
+ * Send startPrefixMapping events to the result tree handler
* for all declared prefix mappings in the stylesheet.
+ *
+ * NEEDSDOC @param transformer
+ *
+ * @throws SAXException
*/
- void unexecuteNSDecls(TransformerImpl transformer)
- throws SAXException
+ void unexecuteNSDecls(TransformerImpl transformer) throws SAXException
{
- ResultTreeHandler rhandler = transformer.getResultTreeHandler();
- int n = m_prefixTable.size();
- for(int i = 0; i < n; i++)
+
+ if (null != m_prefixTable)
{
- XMLNSDecl decl = (XMLNSDecl)m_prefixTable.elementAt(i);
- if(!decl.getIsExcluded())
+ ResultTreeHandler rhandler = transformer.getResultTreeHandler();
+ int n = m_prefixTable.size();
+
+ for (int i = 0; i < n; i++)
{
- rhandler.endPrefixMapping(decl.getPrefix());
+ XMLNSDecl decl = (XMLNSDecl) m_prefixTable.elementAt(i);
+
+ if (!decl.getIsExcluded())
+ {
+ rhandler.endPrefixMapping(decl.getPrefix());
+ }
}
- }
+ }
}
-
- /**
+ /**
* Parent node.
* @serial
*/
protected ElemTemplateElement m_parentNode;
- /**
+ /**
* Get the parent as a Node.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public Node getParentNode()
{
return m_parentNode;
}
- /**
+ /**
* Get the parent as an ElemTemplateElement.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public ElemTemplateElement getParentElem()
{
return m_parentNode;
}
- /**
+ /**
* Next sibling.
* @serial
*/
- protected ElemTemplateElement m_nextSibling;
-
- /**
+ ElemTemplateElement m_nextSibling;
+
+ /**
* Get the next sibling (as a Node) or return null.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public Node getNextSibling()
{
return m_nextSibling;
}
-
- /**
+
+ /**
* Get the previous sibling (as a Node) or return null.
* Note that this may be expensive if the parent has many kids;
* we accept that price in exchange for avoiding the prev pointer
* TODO: If we were sure parents and sibs are always ElemTemplateElements,
* we could hit the fields directly rather than thru accessors.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public Node getPreviousSibling()
{
- Node walker=getParentNode(),prev=null;
- if(walker!=null)
- for(walker=walker.getFirstChild();
- walker!=null;
- prev=walker,walker=walker.getNextSibling())
- if(walker==this)
- return prev;
+
+ Node walker = getParentNode(), prev = null;
+
+ if (walker != null)
+ for (walker = walker.getFirstChild(); walker != null;
+ prev = walker, walker = walker.getNextSibling())
+ {
+ if (walker == this)
+ return prev;
+ }
+
return null;
}
-
-
- /**
+ /**
* Get the next sibling (as a ElemTemplateElement) or return null.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public ElemTemplateElement getNextSiblingElem()
{
return m_nextSibling;
}
-
- /**
+
+ /**
* First child.
* @serial
*/
- protected ElemTemplateElement m_firstChild;
-
- /**
+ ElemTemplateElement m_firstChild;
+
+ /**
* Get the first child as a Node.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public Node getFirstChild()
{
return m_firstChild;
}
-
- /**
+
+ /**
* Get the first child as a ElemTemplateElement.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public ElemTemplateElement getFirstChildElem()
{
return m_firstChild;
}
-
- /** Get the last child.
+
+ /**
+ * Get the last child.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
- public Node getLastChild()
+ public Node getLastChild()
{
+
ElemTemplateElement lastChild = null;
- for (ElemTemplateElement node = m_firstChild;
- node != null; node = node.m_nextSibling)
+
+ for (ElemTemplateElement node = m_firstChild; node != null;
+ node = node.m_nextSibling)
{
lastChild = node;
}
+
return lastChild;
}
-
+
+ /** NEEDSDOC Field m_DOMBackPointer */
private Node m_DOMBackPointer;
-
+
/**
- * If this stylesheet was created from a DOM, get the
+ * If this stylesheet was created from a DOM, get the
* DOM backpointer that this element originated from.
* For tooling use.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public Node getDOMBackPointer()
{
@@ -909,13 +1065,14 @@
}
/**
- * If this stylesheet was created from a DOM, set the
+ * If this stylesheet was created from a DOM, set the
* DOM backpointer that this element originated from.
* For tooling use.
+ *
+ * NEEDSDOC @param n
*/
public void setDOMBackPointer(Node n)
{
m_DOMBackPointer = n;
}
-
}
1.2 +68 -51
xml-xalan/java/src/org/apache/xalan/templates/ElemText.java
Index: ElemText.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemText.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ElemText.java 2000/06/19 16:52:50 1.1
+++ ElemText.java 2000/10/30 18:49:57 1.2
@@ -57,17 +57,20 @@
package org.apache.xalan.templates;
import org.w3c.dom.*;
+
import org.xml.sax.*;
+
import org.apache.xalan.res.XSLTErrorResources;
import org.apache.xalan.transformer.TransformerImpl;
import java.io.*;
+
import java.util.*;
/**
* <meta name="usage" content="advanced"/>
* Implement xsl:template.
- * This primarily acts as a marker on the element
+ * This primarily acts as a marker on the element
* stack to signal that whitespace should be preserved.
* <pre>
* <!ELEMENT xsl:text (#PCDATA)>
@@ -79,28 +82,31 @@
*/
public class ElemText extends ElemTemplateElement
{
+
/**
* Tells if this element should disable escaping.
*/
private boolean m_disableOutputEscaping = false;
-
+
/**
- * Set the "disable-output-escaping" attribute.
- * Normally, the xml output method escapes & and < (and
- * possibly other characters) when outputting text nodes.
- * This ensures that the output is well-formed XML. However,
- * it is sometimes convenient to be able to produce output
- * that is almost, but not quite well-formed XML; for
- * example, the output may include ill-formed sections
- * which are intended to be transformed into well-formed
- * XML by a subsequent non-XML aware process. For this reason,
- * XSLT provides a mechanism for disabling output escaping.
- * An xsl:value-of or xsl:text element may have a
- * disable-output-escaping attribute; the allowed values
- * are yes or no; the default is no; if the value is yes,
- * then a text node generated by instantiating the xsl:value-of
- * or xsl:text element should be output without any escaping.
+ * Set the "disable-output-escaping" attribute.
+ * Normally, the xml output method escapes & and < (and
+ * possibly other characters) when outputting text nodes.
+ * This ensures that the output is well-formed XML. However,
+ * it is sometimes convenient to be able to produce output
+ * that is almost, but not quite well-formed XML; for
+ * example, the output may include ill-formed sections
+ * which are intended to be transformed into well-formed
+ * XML by a subsequent non-XML aware process. For this reason,
+ * XSLT provides a mechanism for disabling output escaping.
+ * An xsl:value-of or xsl:text element may have a
+ * disable-output-escaping attribute; the allowed values
+ * are yes or no; the default is no; if the value is yes,
+ * then a text node generated by instantiating the xsl:value-of
+ * or xsl:text element should be output without any escaping.
* @see <a
href="http://www.w3.org/TR/xslt#disable-output-escaping">disable-output-escaping
in XSLT Specification</a>
+ *
+ * NEEDSDOC @param v
*/
public void setDisableOutputEscaping(boolean v)
{
@@ -108,32 +114,34 @@
}
/**
- * Get the "disable-output-escaping" attribute.
- * Normally, the xml output method escapes & and < (and
- * possibly other characters) when outputting text nodes.
- * This ensures that the output is well-formed XML. However,
- * it is sometimes convenient to be able to produce output
- * that is almost, but not quite well-formed XML; for
- * example, the output may include ill-formed sections
- * which are intended to be transformed into well-formed
- * XML by a subsequent non-XML aware process. For this reason,
- * XSLT provides a mechanism for disabling output escaping.
- * An xsl:value-of or xsl:text element may have a
- * disable-output-escaping attribute; the allowed values
- * are yes or no; the default is no; if the value is yes,
- * then a text node generated by instantiating the xsl:value-of
- * or xsl:text element should be output without any escaping.
+ * Get the "disable-output-escaping" attribute.
+ * Normally, the xml output method escapes & and < (and
+ * possibly other characters) when outputting text nodes.
+ * This ensures that the output is well-formed XML. However,
+ * it is sometimes convenient to be able to produce output
+ * that is almost, but not quite well-formed XML; for
+ * example, the output may include ill-formed sections
+ * which are intended to be transformed into well-formed
+ * XML by a subsequent non-XML aware process. For this reason,
+ * XSLT provides a mechanism for disabling output escaping.
+ * An xsl:value-of or xsl:text element may have a
+ * disable-output-escaping attribute; the allowed values
+ * are yes or no; the default is no; if the value is yes,
+ * then a text node generated by instantiating the xsl:value-of
+ * or xsl:text element should be output without any escaping.
* @see <a
href="http://www.w3.org/TR/xslt#disable-output-escaping">disable-output-escaping
in XSLT Specification</a>
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public boolean getDisableOutputEscaping()
{
return m_disableOutputEscaping;
}
-
- /**
+
+ /**
* Get an integer representation of the element type.
- *
- * @return An integer representation of the element, defined in the
+ *
+ * @return An integer representation of the element, defined in the
* Constants class.
* @see org.apache.xalan.templates.Constants
*/
@@ -141,34 +149,43 @@
{
return Constants.ELEMNAME_TEXT;
}
-
- /**
+
+ /**
* Return the node name.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public String getNodeName()
{
return Constants.ELEMNAME_TEXT_STRING;
}
-
+
/**
* Add a child to the child list.
+ *
+ * NEEDSDOC @param newChild
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws DOMException
*/
- public Node appendChild(Node newChild)
- throws DOMException
+ public Node appendChild(Node newChild) throws DOMException
{
- int type = ((ElemTemplateElement)newChild).getXSLToken();
- switch(type)
- {
- case Constants.ELEMNAME_TEXTLITERALRESULT:
+ int type = ((ElemTemplateElement) newChild).getXSLToken();
+
+ switch (type)
+ {
+ case Constants.ELEMNAME_TEXTLITERALRESULT :
break;
-
- default:
- error(XSLTErrorResources.ER_CANNOT_ADD, new
Object[]{newChild.getNodeName(), this.getNodeName()}); //"Can not add "
+((ElemTemplateElement)newChild).m_elemName +
- //" to " + this.m_elemName);
+ default :
+ error(XSLTErrorResources.ER_CANNOT_ADD,
+ new Object[]{ newChild.getNodeName(),
+ this.getNodeName() }); //"Can not add "
+((ElemTemplateElement)newChild).m_elemName +
+
+ //" to " + this.m_elemName);
}
+
return super.appendChild(newChild);
}
-
-
}
1.3 +78 -52
xml-xalan/java/src/org/apache/xalan/templates/ElemTextLiteral.java
Index: ElemTextLiteral.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemTextLiteral.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ElemTextLiteral.java 2000/10/02 02:43:07 1.2
+++ ElemTextLiteral.java 2000/10/30 18:49:57 1.3
@@ -57,7 +57,9 @@
package org.apache.xalan.templates;
import org.w3c.dom.*;
+
import org.xml.sax.*;
+
import org.apache.xalan.utils.QName;
import org.apache.xalan.transformer.TransformerImpl;
@@ -67,14 +69,17 @@
* @see <a
href="http://www.w3.org/TR/xslt#section-Creating-Text">section-Creating-Text in
XSLT Specification</a>
*/
public class ElemTextLiteral extends ElemTemplateElement
-{
+{
+
/**
* Tell if space should be preserved.
*/
private boolean m_preserveSpace;
-
+
/**
* Set whether or not space should be preserved.
+ *
+ * NEEDSDOC @param v
*/
public void setPreserveSpace(boolean v)
{
@@ -83,19 +88,23 @@
/**
* Get whether or not space should be preserved.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public boolean getPreserveSpace()
{
return m_preserveSpace;
}
-
+
/**
* The character array.
*/
private char m_ch[];
-
+
/**
- * Set the characters that will be output to the result tree..
+ * Set the characters that will be output to the result tree..
+ *
+ * NEEDSDOC @param v
*/
public void setChars(char[] v)
{
@@ -103,35 +112,39 @@
}
/**
- * Get the characters that will be output to the result tree..
+ * Get the characters that will be output to the result tree..
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public char[] getChars()
{
return m_ch;
}
-
+
/**
* Tells if this element should disable escaping.
*/
private boolean m_disableOutputEscaping = false;
-
+
/**
- * Set the "disable-output-escaping" attribute.
- * Normally, the xml output method escapes & and < (and
- * possibly other characters) when outputting text nodes.
- * This ensures that the output is well-formed XML. However,
- * it is sometimes convenient to be able to produce output
- * that is almost, but not quite well-formed XML; for
- * example, the output may include ill-formed sections
- * which are intended to be transformed into well-formed
- * XML by a subsequent non-XML aware process. For this reason,
- * XSLT provides a mechanism for disabling output escaping.
- * An xsl:value-of or xsl:text element may have a
- * disable-output-escaping attribute; the allowed values
- * are yes or no; the default is no; if the value is yes,
- * then a text node generated by instantiating the xsl:value-of
- * or xsl:text element should be output without any escaping.
+ * Set the "disable-output-escaping" attribute.
+ * Normally, the xml output method escapes & and < (and
+ * possibly other characters) when outputting text nodes.
+ * This ensures that the output is well-formed XML. However,
+ * it is sometimes convenient to be able to produce output
+ * that is almost, but not quite well-formed XML; for
+ * example, the output may include ill-formed sections
+ * which are intended to be transformed into well-formed
+ * XML by a subsequent non-XML aware process. For this reason,
+ * XSLT provides a mechanism for disabling output escaping.
+ * An xsl:value-of or xsl:text element may have a
+ * disable-output-escaping attribute; the allowed values
+ * are yes or no; the default is no; if the value is yes,
+ * then a text node generated by instantiating the xsl:value-of
+ * or xsl:text element should be output without any escaping.
* @see <a
href="http://www.w3.org/TR/xslt#disable-output-escaping">disable-output-escaping
in XSLT Specification</a>
+ *
+ * NEEDSDOC @param v
*/
public void setDisableOutputEscaping(boolean v)
{
@@ -139,32 +152,34 @@
}
/**
- * Get the "disable-output-escaping" attribute.
- * Normally, the xml output method escapes & and < (and
- * possibly other characters) when outputting text nodes.
- * This ensures that the output is well-formed XML. However,
- * it is sometimes convenient to be able to produce output
- * that is almost, but not quite well-formed XML; for
- * example, the output may include ill-formed sections
- * which are intended to be transformed into well-formed
- * XML by a subsequent non-XML aware process. For this reason,
- * XSLT provides a mechanism for disabling output escaping.
- * An xsl:value-of or xsl:text element may have a
- * disable-output-escaping attribute; the allowed values
- * are yes or no; the default is no; if the value is yes,
- * then a text node generated by instantiating the xsl:value-of
- * or xsl:text element should be output without any escaping.
+ * Get the "disable-output-escaping" attribute.
+ * Normally, the xml output method escapes & and < (and
+ * possibly other characters) when outputting text nodes.
+ * This ensures that the output is well-formed XML. However,
+ * it is sometimes convenient to be able to produce output
+ * that is almost, but not quite well-formed XML; for
+ * example, the output may include ill-formed sections
+ * which are intended to be transformed into well-formed
+ * XML by a subsequent non-XML aware process. For this reason,
+ * XSLT provides a mechanism for disabling output escaping.
+ * An xsl:value-of or xsl:text element may have a
+ * disable-output-escaping attribute; the allowed values
+ * are yes or no; the default is no; if the value is yes,
+ * then a text node generated by instantiating the xsl:value-of
+ * or xsl:text element should be output without any escaping.
* @see <a
href="http://www.w3.org/TR/xslt#disable-output-escaping">disable-output-escaping
in XSLT Specification</a>
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public boolean getDisableOutputEscaping()
{
return m_disableOutputEscaping;
}
- /**
+ /**
* Get an integer representation of the element type.
- *
- * @return An integer representation of the element, defined in the
+ *
+ * @return An integer representation of the element, defined in the
* Constants class.
* @see org.apache.xalan.templates.Constants
*/
@@ -172,31 +187,42 @@
{
return Constants.ELEMNAME_TEXTLITERALRESULT;
}
-
- /**
+
+ /**
* Return the node name.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public String getNodeName()
{
return "#Text";
}
-
+
/**
* Copy the text literal to the result tree.
- */
- public void execute(TransformerImpl transformer,
- Node sourceNode,
- QName mode)
- throws SAXException
+ *
+ * NEEDSDOC @param transformer
+ * NEEDSDOC @param sourceNode
+ * NEEDSDOC @param mode
+ *
+ * @throws SAXException
+ */
+ public void execute(
+ TransformerImpl transformer, Node sourceNode, QName mode)
+ throws SAXException
{
- if(TransformerImpl.S_DEBUG)
+
+ if (TransformerImpl.S_DEBUG)
transformer.getTraceManager().fireTraceEvent(sourceNode, mode, this);
- if(m_disableOutputEscaping)
+
+ if (m_disableOutputEscaping)
{
transformer.getResultTreeHandler().startNonEscaping();
}
+
transformer.getResultTreeHandler().characters(m_ch, 0, m_ch.length);
- if(m_disableOutputEscaping)
+
+ if (m_disableOutputEscaping)
{
transformer.getResultTreeHandler().endNonEscaping();
}
1.2 +15 -12
xml-xalan/java/src/org/apache/xalan/templates/ElemUnknown.java
Index: ElemUnknown.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemUnknown.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ElemUnknown.java 2000/10/04 23:23:20 1.1
+++ ElemUnknown.java 2000/10/30 18:49:58 1.2
@@ -57,9 +57,12 @@
package org.apache.xalan.templates;
import org.w3c.dom.*;
+
import org.xml.sax.*;
import org.xml.sax.helpers.*;
+
import java.util.StringTokenizer;
+
import org.apache.xalan.utils.QName;
import org.apache.xalan.utils.NameSpace;
import org.apache.xpath.XPathContext;
@@ -71,26 +74,26 @@
import org.apache.xalan.transformer.ResultTreeHandler;
import java.io.*;
-import java.util.*;
+import java.util.*;
/**
* <meta name="usage" content="advanced"/>
* Implement a Literal Result Element.
*/
public class ElemUnknown extends ElemLiteralResult
-{
+{
/**
* Copy an unknown element to the result tree
- * */
- public void execute(TransformerImpl transformer,
- Node sourceNode,
- QName mode)
- throws SAXException
- {
- }
-
-
-
+ *
+ * NEEDSDOC @param transformer
+ * NEEDSDOC @param sourceNode
+ * NEEDSDOC @param mode
+ *
+ * @throws SAXException
+ */
+ public void execute(
+ TransformerImpl transformer, Node sourceNode, QName mode)
+ throws SAXException{}
}
1.4 +89 -60
xml-xalan/java/src/org/apache/xalan/templates/ElemUse.java
Index: ElemUse.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemUse.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ElemUse.java 2000/08/28 20:04:32 1.3
+++ ElemUse.java 2000/10/30 18:49:59 1.4
@@ -57,104 +57,130 @@
package org.apache.xalan.templates;
import java.util.Vector;
+
import org.w3c.dom.Node;
+
import org.xml.sax.SAXException;
+
import org.apache.xpath.*;
import org.apache.xalan.utils.QName;
+
import java.util.StringTokenizer;
+
import org.apache.xalan.transformer.TransformerImpl;
/**
* <meta name="usage" content="advanced"/>
* Implement xsl:use.
* This acts as a superclass for ElemCopy, ElemAttributeSet,
- * ElemElement, and ElemLiteralResult, on order to implement
+ * ElemElement, and ElemLiteralResult, on order to implement
* shared behavior the use-attribute-sets attribute.
* @see <a href="http://www.w3.org/TR/xslt#attribute-sets">attribute-sets in
XSLT Specification</a>
*/
public class ElemUse extends ElemTemplateElement
{
+
/**
* The value of the "use-attribute-sets" attribute.
*/
private QName m_attributeSetsNames[] = null;
/**
- * Set the "use-attribute-sets" attribute.
- * Attribute sets are used by specifying a use-attribute-sets
- * attribute on xsl:element, xsl:copy (see [7.5 Copying]) or
- * xsl:attribute-set elements. The value of the use-attribute-sets
- * attribute is a whitespace-separated list of names of attribute
- * sets. Each name is specified as a QName, which is expanded as
- * described in [2.4 Qualified Names].
+ * Set the "use-attribute-sets" attribute.
+ * Attribute sets are used by specifying a use-attribute-sets
+ * attribute on xsl:element, xsl:copy (see [7.5 Copying]) or
+ * xsl:attribute-set elements. The value of the use-attribute-sets
+ * attribute is a whitespace-separated list of names of attribute
+ * sets. Each name is specified as a QName, which is expanded as
+ * described in [2.4 Qualified Names].
+ *
+ * NEEDSDOC @param v
*/
- public void setUseAttributeSets (Vector v)
+ public void setUseAttributeSets(Vector v)
{
+
int n = v.size();
+
m_attributeSetsNames = new QName[n];
- for(int i = 0; i < n; i++)
+
+ for (int i = 0; i < n; i++)
{
- m_attributeSetsNames[i] = (QName)v.elementAt(i);
+ m_attributeSetsNames[i] = (QName) v.elementAt(i);
}
}
-
+
/**
- * Set the "use-attribute-sets" attribute.
- * Attribute sets are used by specifying a use-attribute-sets
- * attribute on xsl:element, xsl:copy (see [7.5 Copying]) or
- * xsl:attribute-set elements. The value of the use-attribute-sets
- * attribute is a whitespace-separated list of names of attribute
- * sets. Each name is specified as a QName, which is expanded as
- * described in [2.4 Qualified Names].
+ * Set the "use-attribute-sets" attribute.
+ * Attribute sets are used by specifying a use-attribute-sets
+ * attribute on xsl:element, xsl:copy (see [7.5 Copying]) or
+ * xsl:attribute-set elements. The value of the use-attribute-sets
+ * attribute is a whitespace-separated list of names of attribute
+ * sets. Each name is specified as a QName, which is expanded as
+ * described in [2.4 Qualified Names].
+ *
+ * NEEDSDOC @param v
*/
- public void setUseAttributeSets (QName[] v)
+ public void setUseAttributeSets(QName[] v)
{
m_attributeSetsNames = v;
}
/**
- * Get the "use-attribute-sets" attribute.
- * Attribute sets are used by specifying a use-attribute-sets
- * attribute on xsl:element, xsl:copy (see [7.5 Copying]) or
+ * Get the "use-attribute-sets" attribute.
+ * Attribute sets are used by specifying a use-attribute-sets
+ * attribute on xsl:element, xsl:copy (see [7.5 Copying]) or
* xsl:attribute-set elements, or a xsl:use-attribute-sets attribute on
- * Literal Result Elements.
- * The value of the use-attribute-sets
- * attribute is a whitespace-separated list of names of attribute
- * sets. Each name is specified as a QName, which is expanded as
- * described in [2.4 Qualified Names].
+ * Literal Result Elements.
+ * The value of the use-attribute-sets
+ * attribute is a whitespace-separated list of names of attribute
+ * sets. Each name is specified as a QName, which is expanded as
+ * described in [2.4 Qualified Names].
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public QName[] getUseAttributeSets()
{
return m_attributeSetsNames;
}
-
+
/**
* Add the attributes from the named attribute sets to the attribute list.
* TODO: Error handling for: "It is an error if there are two attribute
sets
* with the same expanded-name and with equal import precedence and that
both
* contain the same attribute unless there is a definition of the attribute
* set with higher import precedence that also contains the attribute."
- */
- private void applyAttrSets(TransformerImpl transformer,
- StylesheetComposed stylesheet,
- QName attributeSetsNames[],
- Node sourceNode,
- QName mode)
- throws SAXException
+ *
+ * NEEDSDOC @param transformer
+ * NEEDSDOC @param stylesheet
+ * NEEDSDOC @param attributeSetsNames
+ * NEEDSDOC @param sourceNode
+ * NEEDSDOC @param mode
+ *
+ * @throws SAXException
+ */
+ private void applyAttrSets(
+ TransformerImpl transformer, StylesheetComposed stylesheet, QName
attributeSetsNames[], Node sourceNode, QName mode)
+ throws SAXException
{
- if(null != attributeSetsNames)
+
+ if (null != attributeSetsNames)
{
int nNames = attributeSetsNames.length;
- for(int i = 0; i < nNames; i++)
+
+ for (int i = 0; i < nNames; i++)
{
QName qname = attributeSetsNames[i];
Vector attrSets = stylesheet.getAttributeSetComposed(qname);
+
if (null != attrSets)
- {
+ {
int nSets = attrSets.size();
- for(int k = 0; k < nSets; k++)
+
+ for (int k = 0; k < nSets; k++)
{
- ElemAttributeSet attrSet =
(ElemAttributeSet)attrSets.elementAt(k);
+ ElemAttributeSet attrSet =
+ (ElemAttributeSet) attrSets.elementAt(k);
+
attrSet.execute(transformer, sourceNode, mode);
}
}
@@ -162,32 +188,35 @@
}
}
-
/**
* Copy attributes specified by use-attribute-sets to the result tree.
- * Specifying a use-attribute-sets attribute is equivalent to adding
- * xsl:attribute elements for each of the attributes in each of the
- * named attribute sets to the beginning of the content of the element
- * with the use-attribute-sets attribute, in the same order in which
- * the names of the attribute sets are specified in the use-attribute-sets
- * attribute. It is an error if use of use-attribute-sets attributes
- * on xsl:attribute-set elements causes an attribute set to directly
+ * Specifying a use-attribute-sets attribute is equivalent to adding
+ * xsl:attribute elements for each of the attributes in each of the
+ * named attribute sets to the beginning of the content of the element
+ * with the use-attribute-sets attribute, in the same order in which
+ * the names of the attribute sets are specified in the use-attribute-sets
+ * attribute. It is an error if use of use-attribute-sets attributes
+ * on xsl:attribute-set elements causes an attribute set to directly
* or indirectly use itself.
- */
- public void execute(TransformerImpl transformer,
- Node sourceNode,
- QName mode)
- throws SAXException
+ *
+ * NEEDSDOC @param transformer
+ * NEEDSDOC @param sourceNode
+ * NEEDSDOC @param mode
+ *
+ * @throws SAXException
+ */
+ public void execute(
+ TransformerImpl transformer, Node sourceNode, QName mode)
+ throws SAXException
{
- if(TransformerImpl.S_DEBUG)
+
+ if (TransformerImpl.S_DEBUG)
transformer.getTraceManager().fireTraceEvent(sourceNode, mode, this);
- if(null != m_attributeSetsNames)
+ if (null != m_attributeSetsNames)
{
- applyAttrSets(transformer,
- getStylesheetRoot().getStylesheetComposed(),
- m_attributeSetsNames,
- sourceNode, mode);
+ applyAttrSets(transformer, getStylesheetRoot().getStylesheetComposed(),
+ m_attributeSetsNames, sourceNode, mode);
}
}
}
1.6 +101 -72
xml-xalan/java/src/org/apache/xalan/templates/ElemValueOf.java
Index: ElemValueOf.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemValueOf.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ElemValueOf.java 2000/10/18 20:29:24 1.5
+++ ElemValueOf.java 2000/10/30 18:50:00 1.6
@@ -57,7 +57,9 @@
package org.apache.xalan.templates;
import org.w3c.dom.*;
+
import org.xml.sax.*;
+
import org.apache.xpath.*;
import org.apache.xpath.objects.XString;
import org.apache.xpath.objects.XObject;
@@ -81,16 +83,19 @@
*/
public class ElemValueOf extends ElemTemplateElement
{
+
/**
* The select expression to be executed.
*/
private XPath m_selectExpression = null;
-
+
/**
- * Set the "select" attribute.
- * The required select attribute is an expression; this expression
- * is evaluated and the resulting object is converted to a
- * string as if by a call to the string function.
+ * Set the "select" attribute.
+ * The required select attribute is an expression; this expression
+ * is evaluated and the resulting object is converted to a
+ * string as if by a call to the string function.
+ *
+ * NEEDSDOC @param v
*/
public void setSelect(XPath v)
{
@@ -98,38 +103,42 @@
}
/**
- * Get the "select" attribute.
- * The required select attribute is an expression; this expression
- * is evaluated and the resulting object is converted to a
- * string as if by a call to the string function.
+ * Get the "select" attribute.
+ * The required select attribute is an expression; this expression
+ * is evaluated and the resulting object is converted to a
+ * string as if by a call to the string function.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public XPath getSelect()
{
return m_selectExpression;
}
-
+
/**
* Tells if this element should disable escaping.
*/
private boolean m_disableOutputEscaping = false;
-
+
/**
- * Set the "disable-output-escaping" attribute.
- * Normally, the xml output method escapes & and < (and
- * possibly other characters) when outputting text nodes.
- * This ensures that the output is well-formed XML. However,
- * it is sometimes convenient to be able to produce output
- * that is almost, but not quite well-formed XML; for
- * example, the output may include ill-formed sections
- * which are intended to be transformed into well-formed
- * XML by a subsequent non-XML aware process. For this reason,
- * XSLT provides a mechanism for disabling output escaping.
- * An xsl:value-of or xsl:text element may have a
- * disable-output-escaping attribute; the allowed values
- * are yes or no; the default is no; if the value is yes,
- * then a text node generated by instantiating the xsl:value-of
- * or xsl:text element should be output without any escaping.
+ * Set the "disable-output-escaping" attribute.
+ * Normally, the xml output method escapes & and < (and
+ * possibly other characters) when outputting text nodes.
+ * This ensures that the output is well-formed XML. However,
+ * it is sometimes convenient to be able to produce output
+ * that is almost, but not quite well-formed XML; for
+ * example, the output may include ill-formed sections
+ * which are intended to be transformed into well-formed
+ * XML by a subsequent non-XML aware process. For this reason,
+ * XSLT provides a mechanism for disabling output escaping.
+ * An xsl:value-of or xsl:text element may have a
+ * disable-output-escaping attribute; the allowed values
+ * are yes or no; the default is no; if the value is yes,
+ * then a text node generated by instantiating the xsl:value-of
+ * or xsl:text element should be output without any escaping.
* @see <a
href="http://www.w3.org/TR/xslt#disable-output-escaping">disable-output-escaping
in XSLT Specification</a>
+ *
+ * NEEDSDOC @param v
*/
public void setDisableOutputEscaping(boolean v)
{
@@ -137,32 +146,34 @@
}
/**
- * Get the "disable-output-escaping" attribute.
- * Normally, the xml output method escapes & and < (and
- * possibly other characters) when outputting text nodes.
- * This ensures that the output is well-formed XML. However,
- * it is sometimes convenient to be able to produce output
- * that is almost, but not quite well-formed XML; for
- * example, the output may include ill-formed sections
- * which are intended to be transformed into well-formed
- * XML by a subsequent non-XML aware process. For this reason,
- * XSLT provides a mechanism for disabling output escaping.
- * An xsl:value-of or xsl:text element may have a
- * disable-output-escaping attribute; the allowed values
- * are yes or no; the default is no; if the value is yes,
- * then a text node generated by instantiating the xsl:value-of
- * or xsl:text element should be output without any escaping.
+ * Get the "disable-output-escaping" attribute.
+ * Normally, the xml output method escapes & and < (and
+ * possibly other characters) when outputting text nodes.
+ * This ensures that the output is well-formed XML. However,
+ * it is sometimes convenient to be able to produce output
+ * that is almost, but not quite well-formed XML; for
+ * example, the output may include ill-formed sections
+ * which are intended to be transformed into well-formed
+ * XML by a subsequent non-XML aware process. For this reason,
+ * XSLT provides a mechanism for disabling output escaping.
+ * An xsl:value-of or xsl:text element may have a
+ * disable-output-escaping attribute; the allowed values
+ * are yes or no; the default is no; if the value is yes,
+ * then a text node generated by instantiating the xsl:value-of
+ * or xsl:text element should be output without any escaping.
* @see <a
href="http://www.w3.org/TR/xslt#disable-output-escaping">disable-output-escaping
in XSLT Specification</a>
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public boolean getDisableOutputEscaping()
{
return m_disableOutputEscaping;
}
-
- /**
+
+ /**
* Get an integer representation of the element type.
- *
- * @return An integer representation of the element, defined in the
+ *
+ * @return An integer representation of the element, defined in the
* Constants class.
* @see org.apache.xalan.templates.Constants
*/
@@ -170,9 +181,11 @@
{
return Constants.ELEMNAME_VALUEOF;
}
-
- /**
+
+ /**
* Return the node name.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public String getNodeName()
{
@@ -180,36 +193,44 @@
}
/**
- * Execute the string expression and copy the text to the
+ * Execute the string expression and copy the text to the
* result tree.
- * The required select attribute is an expression; this expression
- * is evaluated and the resulting object is converted to a string
- * as if by a call to the string function. The string specifies
- * the string-value of the created text node. If the string is
- * empty, no text node will be created. The created text node will
+ * The required select attribute is an expression; this expression
+ * is evaluated and the resulting object is converted to a string
+ * as if by a call to the string function. The string specifies
+ * the string-value of the created text node. If the string is
+ * empty, no text node will be created. The created text node will
* be merged with any adjacent text nodes.
* @see <a href="http://www.w3.org/TR/xslt#value-of">value-of in XSLT
Specification</a>
- */
- public void execute(TransformerImpl transformer,
- Node sourceNode,
- QName mode)
- throws SAXException
- {
- if(TransformerImpl.S_DEBUG)
+ *
+ * NEEDSDOC @param transformer
+ * NEEDSDOC @param sourceNode
+ * NEEDSDOC @param mode
+ *
+ * @throws SAXException
+ */
+ public void execute(
+ TransformerImpl transformer, Node sourceNode, QName mode)
+ throws SAXException
+ {
+
+ if (TransformerImpl.S_DEBUG)
transformer.getTraceManager().fireTraceEvent(sourceNode, mode, this);
- XObject value =
m_selectExpression.execute(transformer.getXPathContext(),
+ XObject value = m_selectExpression.execute(transformer.getXPathContext(),
sourceNode, this);
-
- if(TransformerImpl.S_DEBUG)
- transformer.getTraceManager().fireSelectedEvent(sourceNode,
- this, "select",
m_selectExpression, value);
+
+ if (TransformerImpl.S_DEBUG)
+ transformer.getTraceManager().fireSelectedEvent(sourceNode, this,
+ "select", m_selectExpression, value);
+
String s = value.str();
int len = (null != s) ? s.length() : 0;
if(len > 0)
{
ResultTreeHandler hth = transformer.getResultTreeHandler();
- if(m_disableOutputEscaping)
+
+ if (m_disableOutputEscaping)
{
hth.startNonEscaping();
hth.characters(s.toCharArray(), 0, len);
@@ -219,16 +240,24 @@
hth.characters(s.toCharArray(), 0, len);
}
}
-
+
/**
* Add a child to the child list.
- */
- public Node appendChild(Node newChild)
- throws DOMException
+ *
+ * NEEDSDOC @param newChild
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws DOMException
+ */
+ public Node appendChild(Node newChild) throws DOMException
{
- error(XSLTErrorResources.ER_CANNOT_ADD, new Object[]
{newChild.getNodeName(), this.getNodeName()}); //"Can not add "
+((ElemTemplateElement)newChild).m_elemName +
+
+ error(XSLTErrorResources.ER_CANNOT_ADD,
+ new Object[]{ newChild.getNodeName(),
+ this.getNodeName() }); //"Can not add "
+((ElemTemplateElement)newChild).m_elemName +
+
//" to " + this.m_elemName);
return null;
}
-
}
1.4 +92 -51
xml-xalan/java/src/org/apache/xalan/templates/ElemVariable.java
Index: ElemVariable.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemVariable.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ElemVariable.java 2000/10/17 20:30:29 1.3
+++ ElemVariable.java 2000/10/30 18:50:00 1.4
@@ -8,7 +8,7 @@
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
@@ -57,7 +57,9 @@
package org.apache.xalan.templates;
import org.w3c.dom.*;
+
import org.xml.sax.*;
+
import org.apache.xpath.*;
import org.apache.xpath.objects.XObject;
import org.apache.xpath.objects.XString;
@@ -72,7 +74,7 @@
* Implement xsl:variable.
* <pre>
* <!ELEMENT xsl:variable %template;>
- * <!ATTLIST xsl:variable
+ * <!ATTLIST xsl:variable
* name %qname; #REQUIRED
* select %expr; #IMPLIED
* >
@@ -81,22 +83,27 @@
*/
public class ElemVariable extends ElemTemplateElement
{
- public ElemVariable()
- {
- }
+
+ /**
+ * Constructor ElemVariable
+ *
+ */
+ public ElemVariable(){}
/**
* The value of the "select" attribute.
*/
private XPath m_selectPattern;
-
+
/**
- * Set the "select" attribute.
- * If the variable-binding element has a select attribute,
- * then the value of the attribute must be an expression and
- * the value of the variable is the object that results from
+ * Set the "select" attribute.
+ * If the variable-binding element has a select attribute,
+ * then the value of the attribute must be an expression and
+ * the value of the variable is the object that results from
* evaluating the expression. In this case, the content
* of the variable must be empty.
+ *
+ * NEEDSDOC @param v
*/
public void setSelect(XPath v)
{
@@ -104,30 +111,34 @@
}
/**
- * Get the "select" attribute.
- * If the variable-binding element has a select attribute,
- * then the value of the attribute must be an expression and
- * the value of the variable is the object that results from
+ * Get the "select" attribute.
+ * If the variable-binding element has a select attribute,
+ * then the value of the attribute must be an expression and
+ * the value of the variable is the object that results from
* evaluating the expression. In this case, the content
* of the variable must be empty.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public XPath getSelect()
{
return m_selectPattern;
}
-
+
/**
* The value of the "name" attribute.
*/
private QName m_qname;
-
+
/**
- * Set the "name" attribute.
- * Both xsl:variable and xsl:param have a required name
- * attribute, which specifies the name of the variable. The
- * value of the name attribute is a QName, which is expanded
+ * Set the "name" attribute.
+ * Both xsl:variable and xsl:param have a required name
+ * attribute, which specifies the name of the variable. The
+ * value of the name attribute is a QName, which is expanded
* as described in [2.4 Qualified Names].
* @see <a href="http://www.w3.org/TR/xslt#qname">qname in XSLT
Specification</a>
+ *
+ * NEEDSDOC @param v
*/
public void setName(QName v)
{
@@ -135,26 +146,30 @@
}
/**
- * Get the "name" attribute.
- * Both xsl:variable and xsl:param have a required name
- * attribute, which specifies the name of the variable. The
- * value of the name attribute is a QName, which is expanded
+ * Get the "name" attribute.
+ * Both xsl:variable and xsl:param have a required name
+ * attribute, which specifies the name of the variable. The
+ * value of the name attribute is a QName, which is expanded
* as described in [2.4 Qualified Names].
* @see <a href="http://www.w3.org/TR/xslt#qname">qname in XSLT
Specification</a>
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public QName getName()
{
return m_qname;
}
-
+
/**
* Tells if this is a top-level variable or param, or not.
*/
private boolean m_isTopLevel = false;
-
+
/**
* Set if this is a top-level variable or param, or not.
* @see <a
href="http://www.w3.org/TR/xslt#top-level-variables">top-level-variables in
XSLT Specification</a>
+ *
+ * NEEDSDOC @param v
*/
public void setIsTopLevel(boolean v)
{
@@ -164,16 +179,18 @@
/**
* Get if this is a top-level variable or param, or not.
* @see <a
href="http://www.w3.org/TR/xslt#top-level-variables">top-level-variables in
XSLT Specification</a>
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public boolean getIsTopLevel()
{
return m_isTopLevel;
}
-
- /**
+
+ /**
* Get an integer representation of the element type.
- *
- * @return An integer representation of the element, defined in the
+ *
+ * @return An integer representation of the element, defined in the
* Constants class.
* @see org.apache.xalan.templates.Constants
*/
@@ -181,57 +198,78 @@
{
return Constants.ELEMNAME_VARIABLE;
}
-
-
- /**
+
+ /**
* Return the node name.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public String getNodeName()
{
return Constants.ELEMNAME_VARIABLE_STRING;
}
-
/**
* Copy constructor.
+ *
+ * NEEDSDOC @param param
+ *
+ * @throws SAXException
*/
- public ElemVariable (ElemVariable param)
- throws SAXException
+ public ElemVariable(ElemVariable param) throws SAXException
{
+
m_selectPattern = param.m_selectPattern;
m_qname = param.m_qname;
m_isTopLevel = param.m_isTopLevel;
+
// m_value = param.m_value;
// m_varContext = param.m_varContext;
}
-
+
/**
* Execute a variable declaration and push it onto the variable stack.
* @see <a href="http://www.w3.org/TR/xslt#variables">variables in XSLT
Specification</a>
- */
- public void execute(TransformerImpl transformer,
- Node sourceNode,
- QName mode)
- throws SAXException
- {
- if(TransformerImpl.S_DEBUG)
+ *
+ * NEEDSDOC @param transformer
+ * NEEDSDOC @param sourceNode
+ * NEEDSDOC @param mode
+ *
+ * @throws SAXException
+ */
+ public void execute(
+ TransformerImpl transformer, Node sourceNode, QName mode)
+ throws SAXException
+ {
+
+ if (TransformerImpl.S_DEBUG)
transformer.getTraceManager().fireTraceEvent(sourceNode, mode, this);
XObject var = getValue(transformer, sourceNode);
+
transformer.getXPathContext().getVarStack().pushVariable(m_qname, var);
}
-
+
/**
* Get the XObject representation of the variable.
+ *
+ * NEEDSDOC @param transformer
+ * NEEDSDOC @param sourceNode
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws SAXException
*/
- public XObject getValue(TransformerImpl transformer,
- Node sourceNode)
- throws SAXException
+ public XObject getValue(TransformerImpl transformer, Node sourceNode)
+ throws SAXException
{
+
XObject var;
- if(null != m_selectPattern)
+
+ if (null != m_selectPattern)
{
XPathContext xctxt = transformer.getXPathContext();
+
var = m_selectPattern.execute(xctxt, sourceNode, this);
if(TransformerImpl.S_DEBUG)
transformer.getTraceManager().fireSelectedEvent(sourceNode, this,
@@ -243,11 +281,14 @@
}
else
{
+
// Use result tree fragment
- DocumentFragment df = transformer.transformToRTF(getStylesheet(),
this,
- sourceNode, null);
+ DocumentFragment df = transformer.transformToRTF(this, sourceNode,
+ null);
+
var = new XRTreeFrag(df);
}
+
return var;
}
}
1.3 +27 -17
xml-xalan/java/src/org/apache/xalan/templates/ElemWhen.java
Index: ElemWhen.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemWhen.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ElemWhen.java 2000/07/05 14:40:23 1.2
+++ ElemWhen.java 2000/10/30 18:50:01 1.3
@@ -57,7 +57,9 @@
package org.apache.xalan.templates;
import org.w3c.dom.*;
+
import org.xml.sax.*;
+
import org.apache.xpath.*;
import org.apache.xalan.res.XSLTErrorResources;
import org.apache.xalan.transformer.TransformerImpl;
@@ -76,16 +78,19 @@
*/
public class ElemWhen extends ElemTemplateElement
{
+
/**
- * Each xsl:when element has a single attribute, test,
- * which specifies an expression.
+ * Each xsl:when element has a single attribute, test,
+ * which specifies an expression.
*/
private XPath m_test;
/**
- * Set the "test" attribute.
- * Each xsl:when element has a single attribute, test,
- * which specifies an expression.
+ * Set the "test" attribute.
+ * Each xsl:when element has a single attribute, test,
+ * which specifies an expression.
+ *
+ * NEEDSDOC @param v
*/
public void setTest(XPath v)
{
@@ -93,19 +98,21 @@
}
/**
- * Get the "test" attribute.
- * Each xsl:when element has a single attribute, test,
- * which specifies an expression.
+ * Get the "test" attribute.
+ * Each xsl:when element has a single attribute, test,
+ * which specifies an expression.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public XPath getTest()
{
return m_test;
}
- /**
+ /**
* Get an integer representation of the element type.
- *
- * @return An integer representation of the element, defined in the
+ *
+ * @return An integer representation of the element, defined in the
* Constants class.
* @see org.apache.xalan.templates.Constants
*/
@@ -113,17 +120,20 @@
{
return Constants.ELEMNAME_WHEN;
}
-
- /**
+
+ /**
* Return the node name.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public String getNodeName()
{
return Constants.ELEMNAME_WHEN_STRING;
}
- public ElemWhen()
- {
- }
-
+ /**
+ * Constructor ElemWhen
+ *
+ */
+ public ElemWhen(){}
}
1.3 +35 -23
xml-xalan/java/src/org/apache/xalan/templates/ElemWithParam.java
Index: ElemWithParam.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/ElemWithParam.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ElemWithParam.java 2000/07/05 14:40:23 1.2
+++ ElemWithParam.java 2000/10/30 18:50:01 1.3
@@ -57,7 +57,9 @@
package org.apache.xalan.templates;
import org.w3c.dom.*;
+
import org.xml.sax.*;
+
import org.apache.xpath.*;
import org.apache.xalan.utils.QName;
import org.apache.xalan.res.XSLTErrorResources;
@@ -65,7 +67,7 @@
/**
* <meta name="usage" content="advanced"/>
- * Implement xsl:with-param. xsl:with-param is allowed within
+ * Implement xsl:with-param. xsl:with-param is allowed within
* both xsl:call-template and xsl:apply-templates.
* <pre>
* <!ELEMENT xsl:with-param %template;>
@@ -78,16 +80,19 @@
*/
public class ElemWithParam extends ElemTemplateElement
{
+
/**
- * The "select" attribute, which specifies the value of the
+ * The "select" attribute, which specifies the value of the
* argument, if element content is not specified.
*/
private XPath m_selectPattern = null;
-
+
/**
- * Set the "select" attribute.
- * The "select" attribute specifies the value of the
+ * Set the "select" attribute.
+ * The "select" attribute specifies the value of the
* argument, if element content is not specified.
+ *
+ * NEEDSDOC @param v
*/
public void setSelect(XPath v)
{
@@ -95,26 +100,30 @@
}
/**
- * Get the "select" attribute.
- * The "select" attribute specifies the value of the
+ * Get the "select" attribute.
+ * The "select" attribute specifies the value of the
* argument, if element content is not specified.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public XPath getSelect()
{
return m_selectPattern;
}
-
+
/**
- * The required name attribute specifies the name of the
- * parameter (the variable the value of whose binding is
- * to be replaced). The value of the name attribute is a QName,
- * which is expanded as described in [2.4 Qualified Names].
+ * The required name attribute specifies the name of the
+ * parameter (the variable the value of whose binding is
+ * to be replaced). The value of the name attribute is a QName,
+ * which is expanded as described in [2.4 Qualified Names].
*/
private QName m_qname = null;
/**
- * Set the "name" attribute.
- * DJD
+ * Set the "name" attribute.
+ * DJD
+ *
+ * NEEDSDOC @param v
*/
public void setName(QName v)
{
@@ -122,18 +131,20 @@
}
/**
- * Get the "name" attribute.
- * DJD
+ * Get the "name" attribute.
+ * DJD
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public QName getName()
{
return m_qname;
}
-
- /**
+
+ /**
* Get an integer representation of the element type.
- *
- * @return An integer representation of the element, defined in the
+ *
+ * @return An integer representation of the element, defined in the
* Constants class.
* @see org.apache.xalan.templates.Constants
*/
@@ -141,13 +152,14 @@
{
return Constants.ELEMNAME_WITHPARAM;
}
-
- /**
+
+ /**
* Return the node name.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public String getNodeName()
{
return Constants.ELEMNAME_WITHPARAM_STRING;
}
-
}
1.11 +204 -128
xml-xalan/java/src/org/apache/xalan/templates/FuncDocument.java
Index: FuncDocument.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/FuncDocument.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- FuncDocument.java 2000/10/13 02:33:12 1.10
+++ FuncDocument.java 2000/10/30 18:50:02 1.11
@@ -57,8 +57,10 @@
package org.apache.xalan.templates;
import java.util.Vector;
+
import java.io.StringWriter;
import java.io.PrintWriter;
+
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.traversal.NodeIterator;
@@ -74,12 +76,10 @@
import org.apache.xpath.DOMHelper;
import org.apache.xpath.SourceTreeManager;
import org.apache.xpath.Expression;
-
import org.apache.xpath.XPathContext;
import org.apache.xalan.res.XSLMessages;
import org.apache.xalan.res.XSLTErrorResources;
import org.apache.xpath.XPathContext;
-
import org.apache.xalan.transformer.TransformerImpl;
import org.xml.sax.ErrorHandler;
@@ -93,68 +93,78 @@
/**
* <meta name="usage" content="advanced"/>
* Execute the Doc() function.
- *
- * When the document function has exactly one argument and the argument
- * is a node-set, then the result is the union, for each node in the
- * argument node-set, of the result of calling the document function with
- * the first argument being the string-value of the node, and the second
- * argument being a node-set with the node as its only member. When the
- * document function has two arguments and the first argument is a node-set,
- * then the result is the union, for each node in the argument node-set,
- * of the result of calling the document function with the first argument
- * being the string-value of the node, and with the second argument being
+ *
+ * When the document function has exactly one argument and the argument
+ * is a node-set, then the result is the union, for each node in the
+ * argument node-set, of the result of calling the document function with
+ * the first argument being the string-value of the node, and the second
+ * argument being a node-set with the node as its only member. When the
+ * document function has two arguments and the first argument is a node-set,
+ * then the result is the union, for each node in the argument node-set,
+ * of the result of calling the document function with the first argument
+ * being the string-value of the node, and with the second argument being
* the second argument passed to the document function.
*/
public class FuncDocument extends Function2Args
{
+
/**
- * Execute the function. The function must return
+ * Execute the function. The function must return
* a valid object.
* @param xctxt The current execution context.
* @return A valid XObject.
+ *
+ * @throws org.xml.sax.SAXException
*/
- public XObject execute(XPathContext xctxt)
- throws org.xml.sax.SAXException
- {
+ public XObject execute(XPathContext xctxt) throws org.xml.sax.SAXException
+ {
+
Node context = xctxt.getCurrentNode();
- Document docContext = (Node.DOCUMENT_NODE == context.getNodeType())
- ? (Document)context : context.getOwnerDocument();
- XObject arg = (XObject)this.getArg0().execute(xctxt);
+ Document docContext = (Node.DOCUMENT_NODE == context.getNodeType())
+ ? (Document) context : context.getOwnerDocument();
+ XObject arg = (XObject) this.getArg0().execute(xctxt);
String base = "";
Expression arg1Expr = this.getArg1();
- if(null != arg1Expr)
+
+ if (null != arg1Expr)
{
+
// The URI reference may be relative. The base URI (see [3.2 Base
URI])
// of the node in the second argument node-set that is first in
document
// order is used as the base URI for resolving the
// relative URI into an absolute URI.
XObject arg2 = arg1Expr.execute(xctxt);
- if(XObject.CLASS_NODESET == arg2.getType())
+
+ if (XObject.CLASS_NODESET == arg2.getType())
{
Node baseNode = arg2.nodeset().nextNode();
-
+
if (baseNode == null)
- warn(xctxt, XSLTErrorResources.WG_EMPTY_SECOND_ARG, null);
-
- Document baseDoc = (baseNode == null ? null : (Node.DOCUMENT_NODE ==
baseNode.getNodeType()) ?
- (Document)baseNode : baseNode.getOwnerDocument());
-
- if(baseDoc == null || baseDoc instanceof Stylesheet)
+ warn(xctxt, XSLTErrorResources.WG_EMPTY_SECOND_ARG, null);
+
+ Document baseDoc = (baseNode == null
+ ? null
+ : (Node.DOCUMENT_NODE == baseNode.getNodeType())
+ ? (Document) baseNode
+ : baseNode.getOwnerDocument());
+
+ if (baseDoc == null || baseDoc instanceof Stylesheet)
{
+
// base = ((Stylesheet)baseDoc).getBaseIdentifier();
- base = xctxt.getNamespaceContext().getBaseIdentifier();
+ base = xctxt.getNamespaceContext().getBaseIdentifier();
}
else
base = xctxt.getSourceTreeManager().findURIFromDoc(baseDoc);
}
- else
+ else
{
base = arg2.str();
}
-
}
else
{
+
// If the second argument is omitted, then it defaults to
// the node in the stylesheet that contains the expression that
// includes the call to the document function. Note that a
@@ -166,23 +176,26 @@
// was the initial source document.
base = xctxt.getNamespaceContext().getBaseIdentifier();
}
-
+
XNodeSet nodes = new XNodeSet();
NodeSet mnl = nodes.mutableNodeset();
- NodeIterator iterator = (XObject.CLASS_NODESET == arg.getType()) ?
- arg.nodeset() : null;
+ NodeIterator iterator = (XObject.CLASS_NODESET == arg.getType())
+ ? arg.nodeset() : null;
Node pos = null;
- while((null == iterator) || (null != (pos = iterator.nextNode())))
+
+ while ((null == iterator) || (null != (pos = iterator.nextNode())))
{
String ref = (null != iterator)
- ? DOMHelper.getNodeData(pos) : arg.str();
- if(null == ref)
+ ? DOMHelper.getNodeData(pos) : arg.str();
+
+ if (null == ref)
continue;
- if(null == docContext)
+
+ if (null == docContext)
{
- error(xctxt, XSLTErrorResources.ER_NO_CONTEXT_OWNERDOC, null);
//"context does not have an owner document!");
+ error(xctxt, XSLTErrorResources.ER_NO_CONTEXT_OWNERDOC, null);
//"context does not have an owner document!");
}
-
+
// From http://www.ics.uci.edu/pub/ietf/uri/rfc1630.txt
// A partial form can be distinguished from an absolute form in that
the
// latter must have a colon and that colon must occur before any slash
@@ -191,182 +204,245 @@
// will still work, but confusion may result.
int indexOfColon = ref.indexOf(':');
int indexOfSlash = ref.indexOf('/');
- if((indexOfColon != -1) && (indexOfSlash != -1) && (indexOfColon <
indexOfSlash))
+
+ if ((indexOfColon != -1) && (indexOfSlash != -1)
+ && (indexOfColon < indexOfSlash))
{
+
// The url (or filename, for that matter) is absolute.
base = null;
}
-
+
Node newDoc = getDoc(xctxt, context, ref, base);
+
// nodes.mutableNodeset().addNode(newDoc);
- if(null != newDoc)
+ if (null != newDoc)
{
+
// TODO: mnl.addNodeInDocOrder(newDoc, true, xctxt); ??
- mnl.addElement(newDoc);
+ if (!mnl.contains(newDoc))
+ mnl.addElement(newDoc);
}
-
- if(null == iterator)
+
+ if (null == iterator)
break;
}
+
return nodes;
}
-
+
/**
* HandleDocExpr
+ *
+ * NEEDSDOC @param xctxt
+ * NEEDSDOC @param context
+ * NEEDSDOC @param uri
+ * NEEDSDOC @param base
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws org.xml.sax.SAXException
*/
Node getDoc(XPathContext xctxt, Node context, String uri, String base)
- throws org.xml.sax.SAXException
+ throws org.xml.sax.SAXException
{
+
// System.out.println("base: "+base+", uri: "+uri);
SourceTreeManager treeMgr = xctxt.getSourceTreeManager();
Node newDoc = treeMgr.findNodeFromURL(base, uri, xctxt.getSAXLocator());
- if(null != newDoc)
+
+ if (null != newDoc)
return newDoc;
// If the uri length is zero, get the uri of the stylesheet.
- if(uri.length() == 0)
+ if (uri.length() == 0)
uri = xctxt.getNamespaceContext().getBaseIdentifier();
-
+
String diagnosticsString = null;
+
try
{
- if((null != uri) && (uri.toString().length() > 0))
+ if ((null != uri) && (uri.toString().length() > 0))
{
newDoc = treeMgr.getSourceTree(base, uri, xctxt.getSAXLocator());
+
// System.out.println("newDoc:
"+((Document)newDoc).getDocumentElement().getNodeName());
}
else
- warn(xctxt, XSLTErrorResources.WG_CANNOT_MAKE_URL_FROM, new
Object[]{((base == null) ? "" : base )+uri}); //"Can not make URL from:
"+((base == null) ? "" : base )+uri);
+ warn(xctxt, XSLTErrorResources.WG_CANNOT_MAKE_URL_FROM,
+ new Object[]{ ((base == null) ? "" : base) + uri }); //"Can
not make URL from: "+((base == null) ? "" : base )+uri);
}
- catch(Throwable throwable)
+ catch (Throwable throwable)
{
+
+ // throwable.printStackTrace();
newDoc = null;
+
// path.warn(XSLTErrorResources.WG_ENCODING_NOT_SUPPORTED_USING_JAVA,
new Object[]{((base == null) ? "" : base )+uri}); //"Can not load requested
doc: "+((base == null) ? "" : base )+uri);
- while(throwable instanceof
org.apache.xalan.utils.WrappedRuntimeException)
- throwable =
((org.apache.xalan.utils.WrappedRuntimeException)throwable).getException();
+ while (throwable
+ instanceof org.apache.xalan.utils.WrappedRuntimeException)
+ {
+ throwable =
+ ((org.apache.xalan.utils.WrappedRuntimeException)
throwable).getException();
+ }
- if((throwable instanceof NullPointerException) ||
- (throwable instanceof ClassCastException)
- )
- {
- throw new
org.apache.xalan.utils.WrappedRuntimeException((Exception)throwable);
- }
-
- StringWriter sw = new StringWriter();
- PrintWriter diagnosticsWriter = new PrintWriter(sw);
- if(throwable instanceof SAXException)
+ if ((throwable instanceof NullPointerException)
+ || (throwable instanceof ClassCastException))
+ {
+ throw new org.apache.xalan.utils.WrappedRuntimeException(
+ (Exception) throwable);
+ }
+
+ StringWriter sw = new StringWriter();
+ PrintWriter diagnosticsWriter = new PrintWriter(sw);
+
+ if (throwable instanceof SAXException)
+ {
+ SAXException spe = (SAXException) throwable;
+
{
- SAXException spe = (SAXException)throwable;
+ Exception e = spe;
+
+ while (null != e)
{
- Exception e = spe;
- while(null != e)
+ if (null != e.getMessage())
{
- if(null != e.getMessage())
- {
- diagnosticsWriter.println(" ("+e.getClass().getName()+"): "
- + e.getMessage());
- }
- if(e instanceof SAXParseException)
- {
- SAXParseException spe2 = (SAXParseException)e;
- if(null != spe2.getSystemId())
- diagnosticsWriter.println(" ID: "+spe2.getSystemId()
- +" Line #"+spe2.getLineNumber()
- +" Column
#"+spe2.getColumnNumber());
- e = spe2.getException();
- if(e instanceof
org.apache.xalan.utils.WrappedRuntimeException)
- e =
((org.apache.xalan.utils.WrappedRuntimeException)e).getException();
- }
- else
- e = null;
+ diagnosticsWriter.println(" (" + e.getClass().getName() + "): "
+ + e.getMessage());
}
+
+ if (e instanceof SAXParseException)
+ {
+ SAXParseException spe2 = (SAXParseException) e;
+
+ if (null != spe2.getSystemId())
+ diagnosticsWriter.println(" ID: " + spe2.getSystemId()
+ + " Line #" + spe2.getLineNumber()
+ + " Column #"
+ + spe2.getColumnNumber());
+
+ e = spe2.getException();
+
+ if (e instanceof
org.apache.xalan.utils.WrappedRuntimeException)
+ e = ((org.apache.xalan.utils.WrappedRuntimeException)
e).getException();
+ }
+ else
+ e = null;
}
- }
- else
- {
- diagnosticsWriter.println(" ("+throwable.getClass().getName()+"):
"
- + throwable.getMessage());
}
- diagnosticsString = sw.toString();
+ }
+ else
+ {
+ diagnosticsWriter.println(" (" + throwable.getClass().getName()
+ + "): " + throwable.getMessage());
+ }
+
+ diagnosticsString = sw.toString();
}
- if(null == newDoc)
+
+ if (null == newDoc)
{
+
// System.out.println("what?: "+base+", uri: "+uri);
- if(null != diagnosticsString)
+ if (null != diagnosticsString)
{
- warn(xctxt, XSLTErrorResources.WG_CANNOT_LOAD_REQUESTED_DOC, new
Object[]{diagnosticsString}); //"Can not load requested doc: "+((base == null)
? "" : base )+uri);
+ warn(xctxt, XSLTErrorResources.WG_CANNOT_LOAD_REQUESTED_DOC,
+ new Object[]{ diagnosticsString }); //"Can not load requested
doc: "+((base == null) ? "" : base )+uri);
}
else
- warn(xctxt, XSLTErrorResources.WG_CANNOT_LOAD_REQUESTED_DOC, new
Object[]{uri== null ?((base == null) ? "" : base)+uri : uri.toString()});
//"Can not load requested doc: "+((base == null) ? "" : base )+uri);
+ warn(xctxt, XSLTErrorResources.WG_CANNOT_LOAD_REQUESTED_DOC,
+ new Object[]{
+ uri == null
+ ? ((base == null) ? "" : base) + uri : uri.toString() });
//"Can not load requested doc: "+((base == null) ? "" : base )+uri);
}
else
{
+
// TBD: What to do about XLocator?
// xctxt.getSourceTreeManager().associateXLocatorToNode(newDoc, url,
null);
}
+
return newDoc;
}
-
+
/**
* Tell the user of an error, and probably throw an
* exception.
+ *
+ * NEEDSDOC @param xctxt
+ * NEEDSDOC @param msg
+ * NEEDSDOC @param args
* @exception XSLProcessorException thrown if the active ProblemListener
and XPathContext decide
* the error condition is severe enough to halt processing.
+ *
+ * @throws org.xml.sax.SAXException
*/
public void error(XPathContext xctxt, int msg, Object args[])
- throws org.xml.sax.SAXException
- {
- String formattedMsg = XSLMessages.createMessage(msg, args);
-
+ throws org.xml.sax.SAXException
+ {
+
+ String formattedMsg = XSLMessages.createMessage(msg, args);
ErrorHandler errHandler = xctxt.getPrimaryReader().getErrorHandler();
- TransformException te = new TransformException(formattedMsg,
- xctxt.getSAXLocator());
-
- if(null != errHandler)
+ TransformException te = new TransformException(formattedMsg,
+ xctxt.getSAXLocator());
+
+ if (null != errHandler)
errHandler.error(te);
else
{
- System.out.println(te.getMessage()
- +"; file "+te.getSystemId()
- +"; line "+te.getLineNumber()
- +"; column "+te.getColumnNumber());
+ System.out.println(te.getMessage() + "; file " + te.getSystemId()
+ + "; line " + te.getLineNumber() + "; column "
+ + te.getColumnNumber());
}
}
-
+
/**
* Warn the user of a problem.
+ *
+ * NEEDSDOC @param xctxt
+ * NEEDSDOC @param msg
+ * NEEDSDOC @param args
* @exception XSLProcessorException thrown if the active ProblemListener
and XPathContext decide
* the error condition is severe enough to halt processing.
+ *
+ * @throws org.xml.sax.SAXException
*/
public void warn(XPathContext xctxt, int msg, Object args[])
- throws org.xml.sax.SAXException
+ throws org.xml.sax.SAXException
{
+
String formattedMsg = XSLMessages.createWarning(msg, args);
-
- ErrorHandler errHandler = (null != xctxt.getPrimaryReader()) ?
- xctxt.getPrimaryReader().getErrorHandler() :
null;
- TransformException te = new TransformException(formattedMsg,
- xctxt.getSAXLocator());
-
- if(null != errHandler)
+ ErrorHandler errHandler = (null != xctxt.getPrimaryReader())
+ ? xctxt.getPrimaryReader().getErrorHandler()
+ : null;
+ TransformException te = new TransformException(formattedMsg,
+ xctxt.getSAXLocator());
+
+ if (null != errHandler)
errHandler.warning(te);
else
{
- System.out.println(te.getMessage()
- +"; file "+te.getSystemId()
- +"; line "+te.getLineNumber()
- +"; column "+te.getColumnNumber());
+ System.out.println(te.getMessage() + "; file " + te.getSystemId()
+ + "; line " + te.getLineNumber() + "; column "
+ + te.getColumnNumber());
}
}
-
+
/*
* Overide the superclass method to allow one or two arguments.
*/
- public void checkNumberArgs(int argNum)
- throws WrongNumberArgsException
+
+ /**
+ * NEEDSDOC Method checkNumberArgs
+ *
+ *
+ * NEEDSDOC @param argNum
+ *
+ * @throws WrongNumberArgsException
+ */
+ public void checkNumberArgs(int argNum) throws WrongNumberArgsException
{
- if(argNum < 1 && argNum > 2)
+ if (argNum < 1 && argNum > 2)
throw new WrongNumberArgsException("2");
}
-
}
1.7 +63 -33
xml-xalan/java/src/org/apache/xalan/templates/FuncFormatNumb.java
Index: FuncFormatNumb.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/FuncFormatNumb.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- FuncFormatNumb.java 2000/10/13 02:33:12 1.6
+++ FuncFormatNumb.java 2000/10/30 18:50:02 1.7
@@ -2,7 +2,7 @@
* The Apache Software License, Version 1.1
*
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -10,7 +10,7 @@
* are met:
*
* 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
+ * notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
@@ -18,7 +18,7 @@
* distribution.
*
* 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
+ * if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
@@ -26,7 +26,7 @@
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
- * software without prior written permission. For written
+ * software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
@@ -59,7 +59,6 @@
import java.util.Vector;
import org.apache.xalan.utils.QName;
-
import org.apache.xpath.functions.Function;
import org.apache.xpath.functions.Function3Args;
import org.apache.xpath.XPathContext;
@@ -68,7 +67,6 @@
import org.apache.xpath.XPath;
import org.apache.xpath.Expression;
import org.apache.xpath.functions.WrongNumberArgsException;
-
import org.apache.xalan.res.XSLMessages;
import org.apache.xalan.res.XSLTErrorResources;
@@ -78,112 +76,144 @@
import org.apache.trax.TransformException;
-
/**
* <meta name="usage" content="advanced"/>
* Execute the FormatNumber() function.
*/
public class FuncFormatNumb extends Function3Args
{
+
/**
- * Execute the function. The function must return
+ * Execute the function. The function must return
* a valid object.
* @param xctxt The current execution context.
* @return A valid XObject.
+ *
+ * @throws org.xml.sax.SAXException
*/
- public XObject execute(XPathContext xctxt)
- throws org.xml.sax.SAXException
- {
+ public XObject execute(XPathContext xctxt) throws org.xml.sax.SAXException
+ {
+
// A bit of an ugly hack to get our context.
- ElemTemplateElement templElem =
(ElemTemplateElement)xctxt.getNamespaceContext();
+ ElemTemplateElement templElem =
+ (ElemTemplateElement) xctxt.getNamespaceContext();
StylesheetComposed ss = templElem.getStylesheetComposed();
-
java.text.DecimalFormat formatter = null;
java.text.DecimalFormatSymbols dfs = null;
double num = getArg0().execute(xctxt).num();
String patternStr = getArg1().execute(xctxt).str();
+
// TODO: what should be the behavior here??
- if (patternStr.indexOf(0x00A4)> 0)
- ss.error(XSLTErrorResources.ER_CURRENCY_SIGN_ILLEGAL); // currency
sign not allowed
+ if (patternStr.indexOf(0x00A4) > 0)
+ ss.error(XSLTErrorResources.ER_CURRENCY_SIGN_ILLEGAL); // currency
sign not allowed
// this third argument is not a locale name. It is the name of a
// decimal-format declared in the stylesheet!(xsl:decimal-format
try
{
Expression arg2Expr = getArg2();
- if(null != arg2Expr)
+
+ if (null != arg2Expr)
{
String dfName = arg2Expr.execute(xctxt).str();
QName qname = new QName(dfName, xctxt.getNamespaceContext());
+
dfs = ss.getDecimalFormatComposed(qname);
+
if (null == dfs)
{
- warn(xctxt, XSLTErrorResources.WG_NO_DECIMALFORMAT_DECLARATION,
new Object[]{dfName}); //"not found!!!
+ warn(xctxt, XSLTErrorResources.WG_NO_DECIMALFORMAT_DECLARATION,
+ new Object[]{ dfName }); //"not found!!!
+
//formatter = new java.text.DecimalFormat(patternStr);
}
else
{
+
//formatter = new java.text.DecimalFormat(patternStr, dfs);
formatter = new java.text.DecimalFormat();
+
formatter.setDecimalFormatSymbols(dfs);
formatter.applyLocalizedPattern(patternStr);
}
-
}
+
//else
if (null == formatter)
{
+
// look for a possible default decimal-format
- if (ss.getDecimalFormatCount() >0)
+ if (ss.getDecimalFormatCount() > 0)
dfs = ss.getDecimalFormatComposed(new QName(""));
+
if (dfs != null)
{
formatter = new java.text.DecimalFormat();
+
formatter.setDecimalFormatSymbols(dfs);
formatter.applyLocalizedPattern(patternStr);
- }
- else
+ }
+ else
{
dfs = new java.text.DecimalFormatSymbols();
+
dfs.setInfinity(Constants.ATTRVAL_INFINITY);
dfs.setNaN(Constants.ATTRVAL_NAN);
+
formatter = new java.text.DecimalFormat();
+
formatter.setDecimalFormatSymbols(dfs);
-
+
if (null != patternStr)
formatter.applyLocalizedPattern(patternStr);
- }
+ }
}
+
return new XString(formatter.format(num));
}
- catch(Exception iae)
+ catch (Exception iae)
{
- templElem.error(XSLTErrorResources.ER_MALFORMED_FORMAT_STRING, new
Object[]{patternStr});
+ templElem.error(XSLTErrorResources.ER_MALFORMED_FORMAT_STRING,
+ new Object[]{ patternStr });
+
return XString.EMPTYSTRING;
+
//throw new XSLProcessorException(iae);
}
}
/**
* Warn the user of a problem.
+ *
+ * NEEDSDOC @param xctxt
+ * NEEDSDOC @param msg
+ * NEEDSDOC @param args
* @exception XSLProcessorException thrown if the active ProblemListener
and XPathContext decide
* the error condition is severe enough to halt processing.
+ *
+ * @throws org.xml.sax.SAXException
*/
public void warn(XPathContext xctxt, int msg, Object args[])
- throws org.xml.sax.SAXException
+ throws org.xml.sax.SAXException
{
- String formattedMsg = XSLMessages.createWarning(msg, args);
+ String formattedMsg = XSLMessages.createWarning(msg, args);
ErrorHandler errHandler = xctxt.getPrimaryReader().getErrorHandler();
+
errHandler.warning(new TransformException(formattedMsg));
}
-
- public void checkNumberArgs(int argNum)
- throws WrongNumberArgsException
+
+ /**
+ * NEEDSDOC Method checkNumberArgs
+ *
+ *
+ * NEEDSDOC @param argNum
+ *
+ * @throws WrongNumberArgsException
+ */
+ public void checkNumberArgs(int argNum) throws WrongNumberArgsException
{
- if((argNum > 3) || (argNum < 2))
+ if ((argNum > 3) || (argNum < 2))
throw new WrongNumberArgsException("3");
}
-
-
}
1.4 +42 -27
xml-xalan/java/src/org/apache/xalan/templates/FuncKey.java
Index: FuncKey.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/FuncKey.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- FuncKey.java 2000/08/04 22:26:26 1.3
+++ FuncKey.java 2000/10/30 18:50:03 1.4
@@ -8,13 +8,13 @@
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
+ * the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
@@ -71,7 +71,6 @@
import org.apache.xalan.utils.QName;
import org.apache.xalan.transformer.TransformerImpl;
import org.apache.xalan.transformer.KeyManager;
-
import org.apache.xpath.res.XPATHErrorResources;
import org.apache.xpath.XPathContext;
@@ -80,81 +79,97 @@
import org.w3c.dom.NodeList;
import org.w3c.dom.traversal.NodeIterator;
-
/**
* <meta name="usage" content="advanced"/>
* Execute the Key() function.
*/
public class FuncKey extends Function2Args
{
+
+ /** NEEDSDOC Field ISTRUE */
static private Boolean ISTRUE = new Boolean(true);
-
+
/**
- * Execute the function. The function must return
+ * Execute the function. The function must return
* a valid object.
* @param xctxt The current execution context.
* @return A valid XObject.
+ *
+ * @throws org.xml.sax.SAXException
*/
- public XObject execute(XPathContext xctxt)
- throws org.xml.sax.SAXException
- {
+ public XObject execute(XPathContext xctxt) throws org.xml.sax.SAXException
+ {
+
// TransformerImpl transformer = (TransformerImpl)xctxt;
- TransformerImpl transformer = (TransformerImpl)xctxt.getOwnerObject();
+ TransformerImpl transformer = (TransformerImpl) xctxt.getOwnerObject();
XNodeSet nodes = null;
Node context = xctxt.getCurrentNode();
- Document docContext = (Node.DOCUMENT_NODE == context.getNodeType())
- ? (Document)context : context.getOwnerDocument();
- if(null == docContext)
+ Document docContext = (Node.DOCUMENT_NODE == context.getNodeType())
+ ? (Document) context : context.getOwnerDocument();
+
+ if (null == docContext)
{
+
// path.error(context,
XPATHErrorResources.ER_CONTEXT_HAS_NO_OWNERDOC); //"context does not have an
owner document!");
}
+
String xkeyname = getArg0().execute(xctxt).str();
QName keyname = new QName(xkeyname, xctxt.getNamespaceContext());
XObject arg = getArg1().execute(xctxt);
boolean argIsNodeSet = (XObject.CLASS_NODESET == arg.getType());
-
KeyManager kmgr = transformer.getKeyManager();
- if(argIsNodeSet)
+
+ if (argIsNodeSet)
{
Hashtable usedrefs = null;
NodeIterator ni = arg.nodeset();
Node pos;
UnionPathIterator upi = new UnionPathIterator();
- while(null != (pos = ni.nextNode()))
+
+ while (null != (pos = ni.nextNode()))
{
String ref = DOMHelper.getNodeData(pos);
- if(null == ref)
+
+ if (null == ref)
continue;
- if(null == usedrefs)
+
+ if (null == usedrefs)
usedrefs = new Hashtable();
- if(usedrefs.get(ref) != null)
+ if (usedrefs.get(ref) != null)
{
- continue; // We already have 'em.
+ continue; // We already have 'em.
}
else
{
+
// ISTRUE being used as a dummy value.
usedrefs.put(ref, ISTRUE);
}
-
- LocPathIterator nl = kmgr.getNodeSetByKey(xctxt, docContext,
- keyname, ref,
- xctxt.getNamespaceContext());
+
+ LocPathIterator nl =
+ kmgr.getNodeSetByKey(xctxt, docContext, keyname, ref,
+ xctxt.getNamespaceContext());
+
upi.addIterator(nl);
+
//mnodeset.addNodesInDocOrder(nl, xctxt); needed??
}
+
upi.initContext(xctxt);
+
nodes = new XNodeSet(upi);
}
else
{
String ref = arg.str();
- LocPathIterator nl = kmgr.getNodeSetByKey(xctxt, docContext,
- keyname, ref,
- xctxt.getNamespaceContext());
+ LocPathIterator nl = kmgr.getNodeSetByKey(xctxt, docContext, keyname,
+ ref,
+ xctxt.getNamespaceContext());
+
nodes = new XNodeSet(nl);
}
+
return nodes;
}
}
1.3 +57 -36
xml-xalan/java/src/org/apache/xalan/templates/KeyDeclaration.java
Index: KeyDeclaration.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/KeyDeclaration.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- KeyDeclaration.java 2000/07/05 14:40:26 1.2
+++ KeyDeclaration.java 2000/10/30 18:50:03 1.3
@@ -62,21 +62,27 @@
/**
* <meta name="usage" content="internal"/>
* Holds the attribute declarations for the xsl:keys element.
- * A stylesheet declares a set of keys for each document using
- * the xsl:key element. When this set of keys contains a member
- * with node x, name y and value z, we say that node x has a key
+ * A stylesheet declares a set of keys for each document using
+ * the xsl:key element. When this set of keys contains a member
+ * with node x, name y and value z, we say that node x has a key
* with name y and value z.
* @see <a href="http://www.w3.org/TR/xslt#key">key in XSLT Specification</a>
- */
public class KeyDeclaration extends ElemTemplateElement
{
+ */
+public class KeyDeclaration extends ElemTemplateElement
+{
+
/**
* The "name" property.
- */
private QName m_name;
-
+ */
+ private QName m_name;
+
/**
- * Set the "name" attribute.
- * The name attribute specifies the name of the key. The value
- * of the name attribute is a QName, which is expanded as
- * described in [2.4 Qualified Names].
+ * Set the "name" attribute.
+ * The name attribute specifies the name of the key. The value
+ * of the name attribute is a QName, which is expanded as
+ * described in [2.4 Qualified Names].
+ *
+ * NEEDSDOC @param name
*/
public void setName(QName name)
{
@@ -85,26 +91,30 @@
/**
* Get the "name" attribute.
- * The name attribute specifies the name of the key. The value
- * of the name attribute is a QName, which is expanded as
- * described in [2.4 Qualified Names].
+ * The name attribute specifies the name of the key. The value
+ * of the name attribute is a QName, which is expanded as
+ * described in [2.4 Qualified Names].
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public QName getName()
{
return m_name;
}
-
+
/**
* The "match" attribute.
*/
private XPath m_matchPattern = null;
-
+
/**
* Set the "match" attribute.
- * The match attribute is a Pattern; an xsl:key element gives
- * information about the keys of any node that matches the
- * pattern specified in the match attribute.
+ * The match attribute is a Pattern; an xsl:key element gives
+ * information about the keys of any node that matches the
+ * pattern specified in the match attribute.
* @see <a href="http://www.w3.org/TR/xslt#patterns">patterns in XSLT
Specification</a>
+ *
+ * NEEDSDOC @param v
*/
public void setMatch(XPath v)
{
@@ -112,27 +122,31 @@
}
/**
- * Get the "match" attribute.
- * The match attribute is a Pattern; an xsl:key element gives
- * information about the keys of any node that matches the
- * pattern specified in the match attribute.
+ * Get the "match" attribute.
+ * The match attribute is a Pattern; an xsl:key element gives
+ * information about the keys of any node that matches the
+ * pattern specified in the match attribute.
* @see <a href="http://www.w3.org/TR/xslt#patterns">patterns in XSLT
Specification</a>
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public XPath getMatch()
{
return m_matchPattern;
}
-
+
/**
* The "use" attribute.
*/
private XPath m_use;
-
+
/**
- * Set the "use" attribute.
- * The use attribute is an expression specifying the values
- * of the key; the expression is evaluated once for each node
- * that matches the pattern.
+ * Set the "use" attribute.
+ * The use attribute is an expression specifying the values
+ * of the key; the expression is evaluated once for each node
+ * that matches the pattern.
+ *
+ * NEEDSDOC @param v
*/
public void setUse(XPath v)
{
@@ -140,22 +154,30 @@
}
/**
- * Get the "use" attribute.
- * The use attribute is an expression specifying the values
- * of the key; the expression is evaluated once for each node
- * that matches the pattern.
+ * Get the "use" attribute.
+ * The use attribute is an expression specifying the values
+ * of the key; the expression is evaluated once for each node
+ * that matches the pattern.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public XPath getUse()
{
return m_use;
}
-
+
+ /** NEEDSDOC Field UNBUILT */
public static int UNBUILT = -1;
+
+ /** NEEDSDOC Field BUILDING */
public static int BUILDING = 0;
+
+ /** NEEDSDOC Field BUILT */
public static int BUILT = 1;
-
+
+ /** NEEDSDOC Field m_buildState */
private int m_buildState = UNBUILT;
-
+
/**
* Set the state of the build for this key.
* @param state One of UNBUILT, BUILDING, BUILT.
@@ -173,5 +195,4 @@
{
return m_buildState;
}
-
}
1.2 +19 -11
xml-xalan/java/src/org/apache/xalan/templates/NamespaceAlias.java
Index: NamespaceAlias.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/NamespaceAlias.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- NamespaceAlias.java 2000/06/19 16:52:51 1.1
+++ NamespaceAlias.java 2000/10/30 18:50:04 1.2
@@ -8,13 +8,13 @@
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
+ * the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
@@ -58,19 +58,22 @@
/**
* Object to hold an xsl:namespace element.
- * A stylesheet can use the xsl:namespace-alias element to declare
- * that one namespace URI is an alias for another namespace URI.
+ * A stylesheet can use the xsl:namespace-alias element to declare
+ * that one namespace URI is an alias for another namespace URI.
* @see <a
href="http://www.w3.org/TR/xslt#literal-result-element">literal-result-element
in XSLT Specification</a>
*/
public class NamespaceAlias
{
+
/**
* The "stylesheet-prefix" attribute
*/
private String m_StylesheetPrefix;
-
+
/**
- * Set the "stylesheet-prefix" attribute.
+ * Set the "stylesheet-prefix" attribute.
+ *
+ * NEEDSDOC @param v
*/
public void setStylesheetPrefix(String v)
{
@@ -78,7 +81,9 @@
}
/**
- * Get the "stylesheet-prefix" attribute.
+ * Get the "stylesheet-prefix" attribute.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public String getStylesheetPrefix()
{
@@ -89,9 +94,11 @@
* The "result-prefix" attribute
*/
private String m_ResultPrefix;
-
+
/**
- * Set the "result-prefix" attribute.
+ * Set the "result-prefix" attribute.
+ *
+ * NEEDSDOC @param v
*/
public void setResultPrefix(String v)
{
@@ -99,11 +106,12 @@
}
/**
- * Get the "result-prefix" attribute.
+ * Get the "result-prefix" attribute.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public String getResultPrefix()
{
return m_ResultPrefix;
}
-
}
1.9 +340 -123
xml-xalan/java/src/org/apache/xalan/templates/OutputFormatExtended.java
Index: OutputFormatExtended.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/OutputFormatExtended.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- OutputFormatExtended.java 2000/10/23 15:23:50 1.8
+++ OutputFormatExtended.java 2000/10/30 18:50:04 1.9
@@ -8,13 +8,13 @@
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
+ * the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
@@ -57,125 +57,292 @@
package org.apache.xalan.templates;
import org.apache.serialize.OutputFormat;
+
import java.util.Vector;
+
import org.w3c.dom.Document;
import org.apache.xalan.utils.QName;
/**
- * This class extends OutputFormat to act as a bean that
- * has methods that match the algorithmically generated
- * method signatures of the processor. It also has flags
- * that tell if a given method has been set or not by the
+ * This class extends OutputFormat to act as a bean that
+ * has methods that match the algorithmically generated
+ * method signatures of the processor. It also has flags
+ * that tell if a given method has been set or not by the
* stylesheet.
*/
public class OutputFormatExtended extends OutputFormat
implements java.io.Serializable
{
+
// Flag to tell us when to record that an attribute
// has been set.
+
+ /** NEEDSDOC Field m_shouldRecordHasBeenSet */
private boolean m_shouldRecordHasBeenSet;
-
+
+ /** NEEDSDOC Field m_methodHasBeenSet */
private boolean m_methodHasBeenSet = false;
- public boolean methodHasBeenSet() { return m_methodHasBeenSet; }
+
+ /**
+ * NEEDSDOC Method methodHasBeenSet
+ *
+ *
+ * NEEDSDOC (methodHasBeenSet) @return
+ */
+ public boolean methodHasBeenSet()
+ {
+ return m_methodHasBeenSet;
+ }
+
+ /** NEEDSDOC Field m_versionHasBeenSet */
private boolean m_versionHasBeenSet = false;
- public boolean versionHasBeenSet() { return m_versionHasBeenSet; }
+
+ /**
+ * NEEDSDOC Method versionHasBeenSet
+ *
+ *
+ * NEEDSDOC (versionHasBeenSet) @return
+ */
+ public boolean versionHasBeenSet()
+ {
+ return m_versionHasBeenSet;
+ }
+
+ /** NEEDSDOC Field m_indentHasBeenSet */
private boolean m_indentHasBeenSet = false;
- public boolean indentHasBeenSet() { return m_indentHasBeenSet; }
+
+ /**
+ * NEEDSDOC Method indentHasBeenSet
+ *
+ *
+ * NEEDSDOC (indentHasBeenSet) @return
+ */
+ public boolean indentHasBeenSet()
+ {
+ return m_indentHasBeenSet;
+ }
+
+ /** NEEDSDOC Field m_encodingHasBeenSet */
private boolean m_encodingHasBeenSet = false;
- public boolean encodingHasBeenSet() { return m_encodingHasBeenSet; }
+
+ /**
+ * NEEDSDOC Method encodingHasBeenSet
+ *
+ *
+ * NEEDSDOC (encodingHasBeenSet) @return
+ */
+ public boolean encodingHasBeenSet()
+ {
+ return m_encodingHasBeenSet;
+ }
+
+ /** NEEDSDOC Field m_mediaTypeHasBeenSet */
private boolean m_mediaTypeHasBeenSet;
- public boolean mediaTypeHasBeenSet() { return m_mediaTypeHasBeenSet; }
+
+ /**
+ * NEEDSDOC Method mediaTypeHasBeenSet
+ *
+ *
+ * NEEDSDOC (mediaTypeHasBeenSet) @return
+ */
+ public boolean mediaTypeHasBeenSet()
+ {
+ return m_mediaTypeHasBeenSet;
+ }
+
+ /** NEEDSDOC Field m_doctypeSystemHasBeenSet */
private boolean m_doctypeSystemHasBeenSet;
- public boolean doctypeSystemHasBeenSet() { return
m_doctypeSystemHasBeenSet; }
+
+ /**
+ * NEEDSDOC Method doctypeSystemHasBeenSet
+ *
+ *
+ * NEEDSDOC (doctypeSystemHasBeenSet) @return
+ */
+ public boolean doctypeSystemHasBeenSet()
+ {
+ return m_doctypeSystemHasBeenSet;
+ }
+
+ /** NEEDSDOC Field m_doctypePublicHasBeenSet */
private boolean m_doctypePublicHasBeenSet;
- public boolean doctypePublicHasBeenSet() { return
m_doctypePublicHasBeenSet; }
+
+ /**
+ * NEEDSDOC Method doctypePublicHasBeenSet
+ *
+ *
+ * NEEDSDOC (doctypePublicHasBeenSet) @return
+ */
+ public boolean doctypePublicHasBeenSet()
+ {
+ return m_doctypePublicHasBeenSet;
+ }
+
+ /** NEEDSDOC Field m_omitXmlDeclarationHasBeenSet */
private boolean m_omitXmlDeclarationHasBeenSet = false;
- public boolean omitXmlDeclarationHasBeenSet() { return
m_omitXmlDeclarationHasBeenSet; }
+
+ /**
+ * NEEDSDOC Method omitXmlDeclarationHasBeenSet
+ *
+ *
+ * NEEDSDOC (omitXmlDeclarationHasBeenSet) @return
+ */
+ public boolean omitXmlDeclarationHasBeenSet()
+ {
+ return m_omitXmlDeclarationHasBeenSet;
+ }
+
+ /** NEEDSDOC Field m_standaloneHasBeenSet */
private boolean m_standaloneHasBeenSet = false;
- public boolean standaloneHasBeenSet() { return m_standaloneHasBeenSet; }
+
+ /**
+ * NEEDSDOC Method standaloneHasBeenSet
+ *
+ *
+ * NEEDSDOC (standaloneHasBeenSet) @return
+ */
+ public boolean standaloneHasBeenSet()
+ {
+ return m_standaloneHasBeenSet;
+ }
+
+ /** NEEDSDOC Field m_cdataElementsHasBeenSet */
private boolean m_cdataElementsHasBeenSet = false;
- public boolean cdataElementsHasBeenSet() { return
m_cdataElementsHasBeenSet; }
+
+ /**
+ * NEEDSDOC Method cdataElementsHasBeenSet
+ *
+ *
+ * NEEDSDOC (cdataElementsHasBeenSet) @return
+ */
+ public boolean cdataElementsHasBeenSet()
+ {
+ return m_cdataElementsHasBeenSet;
+ }
+
+ /** NEEDSDOC Field m_nonEscapingElementsHasBeenSet */
private boolean m_nonEscapingElementsHasBeenSet = false;
- public boolean nonEscapingElementsHasBeenSet() { return
m_nonEscapingElementsHasBeenSet; }
+
+ /**
+ * NEEDSDOC Method nonEscapingElementsHasBeenSet
+ *
+ *
+ * NEEDSDOC (nonEscapingElementsHasBeenSet) @return
+ */
+ public boolean nonEscapingElementsHasBeenSet()
+ {
+ return m_nonEscapingElementsHasBeenSet;
+ }
/**
* Constructs a new output format with the default values.
*/
public OutputFormatExtended()
{
+
super();
+
m_shouldRecordHasBeenSet = true;
+
setPreserveSpace(true);
}
-
+
+ /**
+ * NEEDSDOC Method copyFrom
+ *
+ *
+ * NEEDSDOC @param of
+ */
void copyFrom(OutputFormatExtended of)
{
- setPreserveSpace(true);
- if(of.methodHasBeenSet())
- setMethod(of.getMethod());
- else
- super.setMethod(of.getMethod());
- if(of.cdataElementsHasBeenSet())
- setCDataElements(of.getCDataElements());
- else
- super.setCDataElements(of.getCDataElements());
- if(of.doctypePublicHasBeenSet())
- setDoctypePublicId(of.getDoctypePublicId());
- else
- super.setDoctypePublicId(of.getDoctypePublicId());
-
- if(of.doctypeSystemHasBeenSet())
- setDoctypeSystemId(of.getDoctypeSystemId());
- else
- super.setDoctypeSystemId(of.getDoctypeSystemId());
- if(of.encodingHasBeenSet())
- setEncoding(of.getEncoding());
- else
- super.setEncoding(of.getEncoding());
- boolean indent = of.getIndent();
- if(of.indentHasBeenSet())
- {
- setIndent(indent);
- setPreserveSpace(!indent);
- }
- else
- {
- super.setIndent(indent);
- super.setPreserveSpace(!indent);
- }
- if(of.mediaTypeHasBeenSet())
- setMediaType(of.getMediaType());
- else
- super.setMediaType(of.getMediaType());
- if(of.nonEscapingElementsHasBeenSet())
- setNonEscapingElements(of.getNonEscapingElements());
- else
- super.setNonEscapingElements(of.getNonEscapingElements());
- if(of.omitXmlDeclarationHasBeenSet())
- setOmitXMLDeclaration(of.getOmitXMLDeclaration());
- else
- super.setOmitXMLDeclaration(of.getOmitXMLDeclaration());
- if(of.standaloneHasBeenSet())
- setStandalone(of.getStandalone());
- else
- super.setStandalone(of.getStandalone());
- if(of.versionHasBeenSet())
- setVersion(of.getVersion());
- else
- super.setVersion(of.getVersion());
+
+ setPreserveSpace(true);
+
+ if (of.methodHasBeenSet())
+ setMethod(of.getMethod());
+ else
+ super.setMethod(of.getMethod());
+
+ if (of.cdataElementsHasBeenSet())
+ setCDataElements(of.getCDataElements());
+ else
+ super.setCDataElements(of.getCDataElements());
+
+ if (of.doctypePublicHasBeenSet())
+ setDoctypePublicId(of.getDoctypePublicId());
+ else
+ super.setDoctypePublicId(of.getDoctypePublicId());
+
+ if (of.doctypeSystemHasBeenSet())
+ setDoctypeSystemId(of.getDoctypeSystemId());
+ else
+ super.setDoctypeSystemId(of.getDoctypeSystemId());
+
+ if (of.encodingHasBeenSet())
+ setEncoding(of.getEncoding());
+ else
+ super.setEncoding(of.getEncoding());
+
+ boolean indent = of.getIndent();
+
+ if (of.indentHasBeenSet())
+ {
+ setIndent(indent);
+ setPreserveSpace(!indent);
+ }
+ else
+ {
+ super.setIndent(indent);
+ super.setPreserveSpace(!indent);
+ }
+
+ if (of.mediaTypeHasBeenSet())
+ setMediaType(of.getMediaType());
+ else
+ super.setMediaType(of.getMediaType());
+
+ if (of.nonEscapingElementsHasBeenSet())
+ setNonEscapingElements(of.getNonEscapingElements());
+ else
+ super.setNonEscapingElements(of.getNonEscapingElements());
+
+ if (of.omitXmlDeclarationHasBeenSet())
+ setOmitXMLDeclaration(of.getOmitXMLDeclaration());
+ else
+ super.setOmitXMLDeclaration(of.getOmitXMLDeclaration());
+
+ if (of.standaloneHasBeenSet())
+ setStandalone(of.getStandalone());
+ else
+ super.setStandalone(of.getStandalone());
+
+ if (of.versionHasBeenSet())
+ setVersion(of.getVersion());
+ else
+ super.setVersion(of.getVersion());
}
-
+
+ /**
+ * NEEDSDOC Method copyFrom
+ *
+ *
+ * NEEDSDOC @param of
+ */
void copyFrom(OutputFormat of)
{
+
setPreserveSpace(true);
setCDataElements(of.getCDataElements());
setDoctypePublicId(of.getDoctypePublicId());
+
// setDoctype(of.getDoctypePublic(), of.getDoctypeSystem());
setEncoding(of.getEncoding());
+
// System.out.println("getOutputFormat - of.getIndent(): "+
of.getIndent());
// setIndent(of.getIndent());
setIndent(of.getIndent());
+
// setLineSeparator(of.getLineSeparator());
// setLineWidth(of.getLineWidth());
setMediaType(of.getMediaType());
@@ -187,111 +354,146 @@
setVersion(of.getVersion());
}
-
/**
* The doctype-public attribute.
+ *
+ * NEEDSDOC @param publicId
*/
- public void setDoctypePublic ( String publicId )
+ public void setDoctypePublic(String publicId)
{
- if(m_shouldRecordHasBeenSet)
+
+ if (m_shouldRecordHasBeenSet)
m_doctypePublicHasBeenSet = true;
+
super.setDoctypePublicId(publicId);
+
// super.setDoctype(publicId, this.getDoctypeSystem());
}
/**
* The doctype-system attribute.
+ *
+ * NEEDSDOC @param systemId
*/
- public void setDoctypeSystem ( String systemId )
+ public void setDoctypeSystem(String systemId)
{
- if(m_shouldRecordHasBeenSet)
+
+ if (m_shouldRecordHasBeenSet)
m_doctypeSystemHasBeenSet = true;
+
// super.setDoctype(this.getDoctypePublic(), systemId);
super.setDoctypeSystemId(systemId);
}
-
+
/**
* The omit-xml-declaration attribute.
+ *
+ * NEEDSDOC @param omit
*/
- public void setOmitXmlDeclaration( boolean omit )
+ public void setOmitXmlDeclaration(boolean omit)
{
- if(m_shouldRecordHasBeenSet)
+
+ if (m_shouldRecordHasBeenSet)
m_omitXmlDeclarationHasBeenSet = true;
+
super.setOmitXMLDeclaration(omit);
}
-
+
/**
* The cdata-section-elements attribute.
+ *
+ * NEEDSDOC @param elements
*/
public void setCdataSectionElements(Vector elements)
{
- if(m_shouldRecordHasBeenSet)
+
+ if (m_shouldRecordHasBeenSet)
m_cdataElementsHasBeenSet = true;
+
int n = elements.size();
org.apache.serialize.QName[] qnames = new QName[n];
- for(int i = 0; i < n; i++)
+
+ for (int i = 0; i < n; i++)
{
- qnames[i] = (QName)elements.elementAt(i);
+ qnames[i] = (QName) elements.elementAt(i);
}
+
super.setCDataElements(qnames);
}
-
+
/**
* The cdata-section-elements attribute.
+ *
+ * NEEDSDOC @param elements
*/
public void setCdataSectionElements(org.apache.serialize.QName[] elements)
{
- if(m_shouldRecordHasBeenSet)
+
+ if (m_shouldRecordHasBeenSet)
m_cdataElementsHasBeenSet = true;
+
super.setCDataElements(elements);
}
-
+
/**
* Sets the method for this output format.
*
* @see #getMethod
* @param method The output method, or null
*/
- public void setMethod( String method )
+ public void setMethod(String method)
{
+
// System.out.println("Setting the method to: "+method);
- if(m_shouldRecordHasBeenSet)
+ if (m_shouldRecordHasBeenSet)
m_methodHasBeenSet = true;
+
super.setMethod(method);
-
- if((null != method) && method.equalsIgnoreCase("html"))
+
+ if ((null != method) && method.equalsIgnoreCase("html"))
{
+
// System.out.println("m_indentHasBeenSet: "+m_indentHasBeenSet);
- if(!this.m_indentHasBeenSet)
+ if (!this.m_indentHasBeenSet)
{
+
// System.out.println("Setting indent to true");
setIndent(true);
+
this.m_indentHasBeenSet = false;
}
}
}
-
+
/**
* Sets the method for this output format.
*
* @see #getMethod
* @param method The output method, or null
*/
- public void setMethod( QName method )
+ public void setMethod(QName method)
{
- if(m_shouldRecordHasBeenSet)
+
+ if (m_shouldRecordHasBeenSet)
m_methodHasBeenSet = true;
+
// TODO: Work with Assaf on this.
String meth = method.getLocalPart();
- super.setMethod(meth);;
- if((null != method) && (method.getNamespaceURI() == null)
- && method.getLocalName().equalsIgnoreCase("html"))
+
+ super.setMethod(meth);
+ ;
+
+ if ((null != method) && (method.getNamespaceURI() == null)
+ && method.getLocalName().equalsIgnoreCase("html"))
{
+
// System.out.println("m_indentHasBeenSet: "+m_indentHasBeenSet);
- if(!this.m_indentHasBeenSet)
+ if (!this.m_indentHasBeenSet)
{
+
// System.out.println("Setting indent to true");
setIndent(true);
+
this.m_indentHasBeenSet = false;
}
}
@@ -305,11 +507,14 @@
* @see #getVersion
* @param version The output method version, or null
*/
- public void setVersion( String version )
+ public void setVersion(String version)
{
- if(m_shouldRecordHasBeenSet)
+
+ if (m_shouldRecordHasBeenSet)
m_versionHasBeenSet = true;
- super.setVersion(version);;
+
+ super.setVersion(version);
+ ;
}
/**
@@ -318,21 +523,24 @@
* (see [EMAIL PROTECTED] #DEFAULT_INDENT} and [EMAIL PROTECTED]
#DEFAULT_LINE_WIDTH}).
* To specify a different indentation level or line wrapping,
* use [EMAIL PROTECTED] #setIndent} and [EMAIL PROTECTED] #setLineWidth}.
- *
+ *
* <p>This method signature is required by the
- * [EMAIL PROTECTED]
org.apache.xalan.processor.XSLTAttributeDef#getSetterMethodName()
- * getSetterMethodName}
- * method. See also
- * the [EMAIL PROTECTED] org.apache.xalan.processor.XSLTSchema
+ * [EMAIL PROTECTED]
org.apache.xalan.processor.XSLTAttributeDef#getSetterMethodName()
+ * getSetterMethodName}
+ * method. See also
+ * the [EMAIL PROTECTED] org.apache.xalan.processor.XSLTSchema
* XSLTSchema} class.</p>
*
* @param on True if indentation should be on
+ *
+ * NEEDSDOC @param indent
*/
- public void setIndent( boolean indent )
+ public void setIndent(boolean indent)
{
- if(m_shouldRecordHasBeenSet)
+
+ if (m_shouldRecordHasBeenSet)
m_indentHasBeenSet = true;
-
+
// System.out.println("setIndent( "+indent+" )");
setPreserveSpace(!indent);
super.setIndent(indent);
@@ -347,24 +555,27 @@
* @see #getEncoding
* @param encoding The encoding, or null
*/
- public void setEncoding( String encoding )
+ public void setEncoding(String encoding)
{
- if(m_shouldRecordHasBeenSet)
+
+ if (m_shouldRecordHasBeenSet)
m_encodingHasBeenSet = true;
+
super.setEncoding(encoding);
}
-
/**
* Sets the media type.
*
* @see #getMediaType
* @param mediaType The specified media type
*/
- public void setMediaType( String mediaType )
+ public void setMediaType(String mediaType)
{
- if(m_shouldRecordHasBeenSet)
+
+ if (m_shouldRecordHasBeenSet)
m_mediaTypeHasBeenSet = true;
+
super.setMediaType(mediaType);
}
@@ -373,10 +584,12 @@
*
* @param omit True if XML declaration should be ommited
*/
- public void setOmitXMLDeclaration( boolean omit )
+ public void setOmitXMLDeclaration(boolean omit)
{
- if(m_shouldRecordHasBeenSet)
+
+ if (m_shouldRecordHasBeenSet)
m_omitXmlDeclarationHasBeenSet = true;
+
super.setOmitXMLDeclaration(omit);
}
@@ -387,10 +600,12 @@
*
* @param standalone True if document DTD is standalone
*/
- public void setStandalone( boolean standalone )
+ public void setStandalone(boolean standalone)
{
- if(m_shouldRecordHasBeenSet)
+
+ if (m_shouldRecordHasBeenSet)
m_standaloneHasBeenSet = true;
+
super.setStandalone(standalone);
}
@@ -400,12 +615,14 @@
*
* @param nonEscapingElements List of unescaped element tag names
*/
- public void setNonEscapingElements( org.apache.serialize.QName[]
nonEscapingElements )
+ public void setNonEscapingElements(
+ org.apache.serialize.QName[] nonEscapingElements)
{
+
// TODO: Need to work on this.
- if(m_shouldRecordHasBeenSet)
+ if (m_shouldRecordHasBeenSet)
m_nonEscapingElementsHasBeenSet = true;
+
super.setNonEscapingElements(nonEscapingElements);
}
-
}
1.9 +539 -254
xml-xalan/java/src/org/apache/xalan/templates/Stylesheet.java
Index: Stylesheet.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/Stylesheet.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- Stylesheet.java 2000/10/11 22:11:01 1.8
+++ Stylesheet.java 2000/10/30 18:50:05 1.9
@@ -2,7 +2,7 @@
* The Apache Software License, Version 1.1
*
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -10,7 +10,7 @@
* are met:
*
* 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
+ * notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
@@ -18,7 +18,7 @@
* distribution.
*
* 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
+ * if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
@@ -26,7 +26,7 @@
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
- * software without prior written permission. For written
+ * software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
@@ -54,14 +54,15 @@
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
-
package org.apache.xalan.templates;
// Java imports
import java.io.ObjectInputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
+
import java.text.DecimalFormatSymbols;
+
import java.util.Hashtable;
import java.util.Stack;
import java.util.Vector;
@@ -70,7 +71,6 @@
import org.apache.xalan.utils.SystemIDResolver;
import org.apache.xalan.utils.QName;
import org.apache.xalan.utils.StringVector;
-
import org.apache.xpath.XPath;
// DOM Imports
@@ -83,10 +83,10 @@
/**
* Represents a stylesheet element.
- * <p>All properties in this class have a fixed form of bean-style property
- * accessors for all properties that represent XSL attributes or elements.
- * These properties have setter method names accessed generically by the
- * processor, and so these names must be fixed according to the system
+ * <p>All properties in this class have a fixed form of bean-style property
+ * accessors for all properties that represent XSL attributes or elements.
+ * These properties have setter method names accessed generically by the
+ * processor, and so these names must be fixed according to the system
* defined in the <a
href="XSLTAttributeDef#getSetterMethodName">getSetterMethodName</a>
* function.</p>
* <p><pre>
@@ -105,7 +105,7 @@
* | xsl:namespace-alias
* %non-xsl-top-level;)*)
* ">
- *
+ *
* <!ENTITY % top-level-atts '
* extension-element-prefixes CDATA #IMPLIED
* exclude-result-prefixes CDATA #IMPLIED
@@ -114,36 +114,40 @@
* xmlns:xsl CDATA #FIXED "http://www.w3.org/1999/XSL/Transform"
* %space-att;
* '>
- *
+ *
* <!ELEMENT xsl:stylesheet %top-level;>
* <!ATTLIST xsl:stylesheet %top-level-atts;>
- *
+ *
* <!ELEMENT xsl:transform %top-level;>
* <!ATTLIST xsl:transform %top-level-atts;>
- *
+ *
* </p></pre>
* @see <a
href="http://www.w3.org/TR/xslt#section-Stylesheet-Structure">section-Stylesheet-Structure
in XSLT Specification</a>
*/
-public class Stylesheet extends ElemTemplateElement
- implements java.io.Serializable, Document
+public class Stylesheet extends ElemTemplateElement
+ implements java.io.Serializable, Document
{
+
/**
* Constructor for a Stylesheet.
* @param parent The including or importing stylesheet.
*/
public Stylesheet(Stylesheet parent)
{
- if(null != parent)
+
+ if (null != parent)
{
m_stylesheetParent = parent;
m_stylesheetRoot = parent.getStylesheetRoot();
}
}
-
+
/**
- * Get the owning stylesheet. This looks up the
+ * Get the owning stylesheet. This looks up the
* inheritance chain until it calls getStylesheet
* on a Stylesheet object, which will return itself.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public Stylesheet getStylesheet()
{
@@ -151,22 +155,26 @@
}
/**
- * Tell if this can be cast to a StylesheetComposed, meaning, you
+ * Tell if this can be cast to a StylesheetComposed, meaning, you
* can ask questions from getXXXComposed functions.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public boolean isAggregatedType()
{
return false;
}
-
+
/**
* Tell if this is the root of the stylesheet tree.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public boolean isRoot()
{
return false;
}
-
+
/**
* Extension to be used when serializing to disk.
*/
@@ -174,49 +182,69 @@
/**
* Read the stylesheet from a serialization stream.
+ *
+ * NEEDSDOC @param stream
+ *
+ * @throws IOException
+ * @throws SAXException
*/
private void readObject(ObjectInputStream stream)
- throws IOException, SAXException
+ throws IOException, SAXException
{
+
// System.out.println("Reading Stylesheet");
try
{
stream.defaultReadObject();
}
- catch(ClassNotFoundException cnfe)
+ catch (ClassNotFoundException cnfe)
{
throw new SAXException(cnfe);
}
+
// System.out.println("Done reading Stylesheet");
}
- private void writeObject(ObjectOutputStream stream)
- throws IOException
+ /**
+ * NEEDSDOC Method writeObject
+ *
+ *
+ * NEEDSDOC @param stream
+ *
+ * @throws IOException
+ */
+ private void writeObject(ObjectOutputStream stream) throws IOException
{
+
// System.out.println("Writing Stylesheet");
stream.defaultWriteObject();
+
// System.out.println("Done writing Stylesheet");
}
//============== XSLT Properties =================
-
+
/**
- * The "xmlns:xsl" property.
+ * The "xmlns:xsl" property.
*/
private String m_XmlnsXsl;
/**
- * Set the "xmlns:xsl" property.
+ * Set the "xmlns:xsl" property.
* @see <a href="http://www.w3.org/TR/xslt#xslt-namespace">xslt-namespace
in XSLT Specification</a>
+ *
+ * NEEDSDOC @param v
*/
- public void setXmlnsXsl (String v)
+ public void setXmlnsXsl(String v)
{
m_XmlnsXsl = v;
}
/**
- * Get the "xmlns:xsl" property.
+ * Get the "xmlns:xsl" property.
* @see <a href="http://www.w3.org/TR/xslt#xslt-namespace">xslt-namespace
in XSLT Specification</a>
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public String getXmlnsXsl()
{
@@ -224,49 +252,67 @@
}
/**
- * The "extension-element-prefixes" property, actually contains URIs.
+ * The "extension-element-prefixes" property, actually contains URIs.
*/
private StringVector m_ExtensionElementURIs;
/**
- * Set the "extension-element-prefixes" property.
+ * Set the "extension-element-prefixes" property.
* @see <a
href="http://www.w3.org/TR/xslt#extension-element">extension-element in XSLT
Specification</a>
+ *
+ * NEEDSDOC @param v
*/
- public void setExtensionElementPrefixes (StringVector v)
+ public void setExtensionElementPrefixes(StringVector v)
{
m_ExtensionElementURIs = v;
}
/**
- * Get and "extension-element-prefix" property.
+ * Get and "extension-element-prefix" property.
* @see <a
href="http://www.w3.org/TR/xslt#extension-element">extension-element in XSLT
Specification</a>
+ *
+ * NEEDSDOC @param i
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws ArrayIndexOutOfBoundsException
*/
public String getExtensionElementPrefix(int i)
- throws ArrayIndexOutOfBoundsException
+ throws ArrayIndexOutOfBoundsException
{
- if(null == m_ExtensionElementURIs)
+
+ if (null == m_ExtensionElementURIs)
throw new ArrayIndexOutOfBoundsException();
+
return m_ExtensionElementURIs.elementAt(i);
}
-
+
/**
- * Get the number of "extension-element-prefixes" Strings.
+ * Get the number of "extension-element-prefixes" Strings.
* @see <a
href="http://www.w3.org/TR/xslt#extension-element">extension-element in XSLT
Specification</a>
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public int getExtensionElementPrefixCount()
{
- return (null != m_ExtensionElementURIs)
+ return (null != m_ExtensionElementURIs)
? m_ExtensionElementURIs.size() : 0;
}
-
+
/**
- * Get and "extension-element-prefix" property.
+ * Get and "extension-element-prefix" property.
* @see <a
href="http://www.w3.org/TR/xslt#extension-element">extension-element in XSLT
Specification</a>
+ *
+ * NEEDSDOC @param uri
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public boolean containsExtensionElementURI(String uri)
{
- if(null == m_ExtensionElementURIs)
+
+ if (null == m_ExtensionElementURIs)
return false;
+
return m_ExtensionElementURIs.contains(uri);
}
@@ -276,79 +322,102 @@
private StringVector m_ExcludeResultPrefixs;
/**
- * Set the "exclude-result-prefixes" property.
- * The designation of a namespace as an excluded namespace is
- * effective within the subtree of the stylesheet rooted at
- * the element bearing the exclude-result-prefixes or
- * xsl:exclude-result-prefixes attribute; a subtree rooted
- * at an xsl:stylesheet element does not include any stylesheets
+ * Set the "exclude-result-prefixes" property.
+ * The designation of a namespace as an excluded namespace is
+ * effective within the subtree of the stylesheet rooted at
+ * the element bearing the exclude-result-prefixes or
+ * xsl:exclude-result-prefixes attribute; a subtree rooted
+ * at an xsl:stylesheet element does not include any stylesheets
* imported or included by children of that xsl:stylesheet element.
* @see <a
href="http://www.w3.org/TR/xslt#literal-result-element">literal-result-element
in XSLT Specification</a>
+ *
+ * NEEDSDOC @param v
*/
- public void setExcludeResultPrefixes (StringVector v)
+ public void setExcludeResultPrefixes(StringVector v)
{
m_ExcludeResultPrefixs = v;
}
/**
- * Get an "exclude-result-prefix" property.
- * The designation of a namespace as an excluded namespace is
- * effective within the subtree of the stylesheet rooted at
- * the element bearing the exclude-result-prefixes or
- * xsl:exclude-result-prefixes attribute; a subtree rooted
- * at an xsl:stylesheet element does not include any stylesheets
+ * Get an "exclude-result-prefix" property.
+ * The designation of a namespace as an excluded namespace is
+ * effective within the subtree of the stylesheet rooted at
+ * the element bearing the exclude-result-prefixes or
+ * xsl:exclude-result-prefixes attribute; a subtree rooted
+ * at an xsl:stylesheet element does not include any stylesheets
* imported or included by children of that xsl:stylesheet element.
* @see <a
href="http://www.w3.org/TR/xslt#literal-result-element">literal-result-element
in XSLT Specification</a>
+ *
+ * NEEDSDOC @param i
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws ArrayIndexOutOfBoundsException
*/
public String getExcludeResultPrefix(int i)
- throws ArrayIndexOutOfBoundsException
+ throws ArrayIndexOutOfBoundsException
{
- if(null == m_ExcludeResultPrefixs)
+
+ if (null == m_ExcludeResultPrefixs)
throw new ArrayIndexOutOfBoundsException();
+
return m_ExcludeResultPrefixs.elementAt(i);
}
-
+
/**
- * Get the number of "extension-element-prefixes" Strings.
+ * Get the number of "extension-element-prefixes" Strings.
* @see <a
href="http://www.w3.org/TR/xslt#extension-element">extension-element in XSLT
Specification</a>
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public int getExcludeResultPrefixCount()
{
- return (null != m_ExcludeResultPrefixs)
+ return (null != m_ExcludeResultPrefixs)
? m_ExcludeResultPrefixs.size() : 0;
}
/**
* Get whether or not the passed URL is contained flagged by
- * the "extension-element-prefixes" property.
+ * the "extension-element-prefixes" property.
* @see <a
href="http://www.w3.org/TR/xslt#extension-element">extension-element in XSLT
Specification</a>
+ *
+ * NEEDSDOC @param prefix
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public boolean containsExcludeResultPrefix(String prefix)
{
- if(null == m_ExcludeResultPrefixs)
+
+ if (null == m_ExcludeResultPrefixs)
return false;
+
if (prefix.length() == 0)
prefix = Constants.ATTRVAL_DEFAULT_PREFIX;
+
return m_ExcludeResultPrefixs.contains(prefix);
}
/**
- * The "id" property.
+ * The "id" property.
*/
private String m_Id;
/**
- * Set the "id" property.
+ * Set the "id" property.
* @see <a
href="http://www.w3.org/TR/xslt#section-Embedding-Stylesheets">section-Embedding-Stylesheets
in XSLT Specification</a>
+ *
+ * NEEDSDOC @param v
*/
- public void setId (String v)
+ public void setId(String v)
{
m_Id = v;
}
/**
- * Get the "id" property.
+ * Get the "id" property.
* @see <a
href="http://www.w3.org/TR/xslt#section-Embedding-Stylesheets">section-Embedding-Stylesheets
in XSLT Specification</a>
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public String getId()
{
@@ -356,22 +425,26 @@
}
/**
- * The "version" property.
+ * The "version" property.
*/
private String m_Version;
/**
- * Set the "version" property.
+ * Set the "version" property.
* @see <a href="http://www.w3.org/TR/xslt#forwards">forwards in XSLT
Specification</a>
+ *
+ * NEEDSDOC @param v
*/
- public void setVersion (String v)
+ public void setVersion(String v)
{
m_Version = v;
}
/**
- * Get the "version" property.
+ * Get the "version" property.
* @see <a href="http://www.w3.org/TR/xslt#forwards">forwards in XSLT
Specification</a>
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public String getVersion()
{
@@ -379,22 +452,26 @@
}
/**
- * The "xml:space" property.
+ * The "xml:space" property.
*/
private boolean m_XmlSpace;
/**
- * Set the "xml:space" property.
+ * Set the "xml:space" property.
* @see <a href="http://www.w3.org/TR/xslt#strip">strip in XSLT
Specification</a>
+ *
+ * NEEDSDOC @param v
*/
- public void setXmlSpace (boolean v)
+ public void setXmlSpace(boolean v)
{
m_XmlSpace = v;
}
/**
- * Get the "xml:space" property.
+ * Get the "xml:space" property.
* @see <a href="http://www.w3.org/TR/xslt#strip">strip in XSLT
Specification</a>
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public boolean getXmlSpace()
{
@@ -402,82 +479,108 @@
}
/**
- * The "xsl:import" list.
+ * The "xsl:import" list.
*/
private Vector m_imports;
/**
- * Add a stylesheet to the "import" list.
+ * Add a stylesheet to the "import" list.
* @see <a href="http://www.w3.org/TR/xslt#import">import in XSLT
Specification</a>
+ *
+ * NEEDSDOC @param v
*/
- public void setImport (StylesheetComposed v)
+ public void setImport(StylesheetComposed v)
{
- if(null == m_imports)
+
+ if (null == m_imports)
m_imports = new Vector();
-
+
// I'm going to insert the elements in backwards order,
// so I can walk them 0 to n.
m_imports.addElement(v);
}
/**
- * Get a stylesheet from the "import" list.
+ * Get a stylesheet from the "import" list.
* @see <a href="http://www.w3.org/TR/xslt#import">import in XSLT
Specification</a>
+ *
+ * NEEDSDOC @param i
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws ArrayIndexOutOfBoundsException
*/
public StylesheetComposed getImport(int i)
- throws ArrayIndexOutOfBoundsException
+ throws ArrayIndexOutOfBoundsException
{
- if(null == m_imports)
+
+ if (null == m_imports)
throw new ArrayIndexOutOfBoundsException();
- return (StylesheetComposed)m_imports.elementAt(i);
+
+ return (StylesheetComposed) m_imports.elementAt(i);
}
/**
- * Get the number of imported stylesheets.
+ * Get the number of imported stylesheets.
* @see <a href="http://www.w3.org/TR/xslt#import">import in XSLT
Specification</a>
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public int getImportCount()
{
return (null != m_imports) ? m_imports.size() : 0;
}
-
+
/**
- * The "xsl:include" properties.
+ * The "xsl:include" properties.
*/
private Vector m_includes;
/**
- * Set a "xsl:include" property.
+ * Set a "xsl:include" property.
* @see <a href="http://www.w3.org/TR/xslt#include">include in XSLT
Specification</a>
+ *
+ * NEEDSDOC @param v
*/
- public void setInclude (Stylesheet v)
+ public void setInclude(Stylesheet v)
{
- if(null == m_includes)
+
+ if (null == m_includes)
m_includes = new Vector();
+
m_includes.addElement(v);
}
/**
- * Get an "xsl:include" property.
+ * Get an "xsl:include" property.
* @see <a href="http://www.w3.org/TR/xslt#include">include in XSLT
Specification</a>
+ *
+ * NEEDSDOC @param i
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws ArrayIndexOutOfBoundsException
*/
- public Stylesheet getInclude(int i)
- throws ArrayIndexOutOfBoundsException
+ public Stylesheet getInclude(int i) throws ArrayIndexOutOfBoundsException
{
- if(null == m_includes)
+
+ if (null == m_includes)
throw new ArrayIndexOutOfBoundsException();
- return (Stylesheet)m_includes.elementAt(i);
+
+ return (Stylesheet) m_includes.elementAt(i);
}
/**
- * Get the number of included stylesheets.
+ * Get the number of included stylesheets.
* @see <a href="http://www.w3.org/TR/xslt#import">import in XSLT
Specification</a>
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public int getIncludeCount()
{
return (null != m_includes) ? m_includes.size() : 0;
}
-
+
/**
* Table of tables of element decimal-format.
* @see ElemDecimalFormat.
@@ -486,63 +589,81 @@
/**
* Process the xsl:decimal-format element.
+ *
+ * NEEDSDOC @param edf
*/
public void setDecimalFormat(DecimalFormatProperties edf)
{
- if(null == m_DecimalFormatDeclarations)
+
+ if (null == m_DecimalFormatDeclarations)
m_DecimalFormatDeclarations = new Stack();
+
// Elements are pushed in by order of importance
// so that when recomposed, they get overiden properly.
m_DecimalFormatDeclarations.push(edf);
}
-
+
/**
- * Get an "xsl:decimal-format" property.
+ * Get an "xsl:decimal-format" property.
* @see ElemDecimalFormat.
* @see <a href="http://www.w3.org/TR/xslt#format-number">format-number in
XSLT Specification</a>
+ *
+ * NEEDSDOC @param name
* @return null if not found, otherwise a DecimalFormatProperties
* object, from which you can get a DecimalFormatSymbols object.
*/
public DecimalFormatProperties getDecimalFormat(QName name)
{
- if(null == m_DecimalFormatDeclarations)
+
+ if (null == m_DecimalFormatDeclarations)
return null;
-
+
int n = getDecimalFormatCount();
- for(int i = (n-1); i >= 0; i++)
+
+ for (int i = (n - 1); i >= 0; i++)
{
DecimalFormatProperties dfp = getDecimalFormat(i);
- if(dfp.getName().equals(name))
+
+ if (dfp.getName().equals(name))
return dfp;
}
-
+
return null;
}
-
+
/**
- * Get an "xsl:decimal-format" property.
+ * Get an "xsl:decimal-format" property.
* @see <a href="http://www.w3.org/TR/xslt#format-number">format-number in
XSLT Specification</a>
* @see ElemDecimalFormat.
+ *
+ * NEEDSDOC @param i
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws ArrayIndexOutOfBoundsException
*/
public DecimalFormatProperties getDecimalFormat(int i)
- throws ArrayIndexOutOfBoundsException
+ throws ArrayIndexOutOfBoundsException
{
- if(null == m_DecimalFormatDeclarations)
+
+ if (null == m_DecimalFormatDeclarations)
throw new ArrayIndexOutOfBoundsException();
- return (DecimalFormatProperties)m_DecimalFormatDeclarations.elementAt(i);
+
+ return (DecimalFormatProperties)
m_DecimalFormatDeclarations.elementAt(i);
}
/**
- * Get the number of xsl:decimal-format declarations.
+ * Get the number of xsl:decimal-format declarations.
* @see ElemDecimalFormat.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public int getDecimalFormatCount()
{
- return (null != m_DecimalFormatDeclarations)
+ return (null != m_DecimalFormatDeclarations)
? m_DecimalFormatDeclarations.size() : 0;
}
-
/**
* The "xsl:strip-space" properties,
* A lookup table of all space stripping elements.
@@ -550,42 +671,57 @@
private Vector m_whitespaceStrippingElements;
/**
- * Set the "xsl:strip-space" properties.
+ * Set the "xsl:strip-space" properties.
* @see <a href="http://www.w3.org/TR/xslt#strip">strip in XSLT
Specification</a>
+ *
+ * NEEDSDOC @param v
*/
public void setStripSpaces(Vector v)
{
- if(null == m_whitespaceStrippingElements)
+
+ if (null == m_whitespaceStrippingElements)
{
m_whitespaceStrippingElements = v;
}
else
{
int n = v.size();
- for(int i = 0; i < n; i++)
+
+ for (int i = 0; i < n; i++)
+ {
m_whitespaceStrippingElements.addElement(v.elementAt(i));
+ }
}
}
/**
- * Get an "xsl:strip-space" property.
+ * Get an "xsl:strip-space" property.
* @see <a href="http://www.w3.org/TR/xslt#strip">strip in XSLT
Specification</a>
+ *
+ * NEEDSDOC @param i
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws ArrayIndexOutOfBoundsException
*/
- public XPath getStripSpace(int i)
- throws ArrayIndexOutOfBoundsException
+ public XPath getStripSpace(int i) throws ArrayIndexOutOfBoundsException
{
- if(null == m_whitespaceStrippingElements)
+
+ if (null == m_whitespaceStrippingElements)
throw new ArrayIndexOutOfBoundsException();
- return (XPath)m_whitespaceStrippingElements.elementAt(i);
+
+ return (XPath) m_whitespaceStrippingElements.elementAt(i);
}
/**
- * Get the number of "xsl:strip-space" properties.
+ * Get the number of "xsl:strip-space" properties.
* @see <a href="http://www.w3.org/TR/xslt#strip">strip in XSLT
Specification</a>
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public int getStripSpaceCount()
{
- return (null != m_whitespaceStrippingElements)
+ return (null != m_whitespaceStrippingElements)
? m_whitespaceStrippingElements.size() : 0;
}
@@ -596,62 +732,81 @@
private Vector m_whitespacePreservingElements;
/**
- * Set the "xsl:preserve-space" property.
+ * Set the "xsl:preserve-space" property.
* @see <a href="http://www.w3.org/TR/xslt#strip">strip in XSLT
Specification</a>
+ *
+ * NEEDSDOC @param v
*/
- public void setPreserveSpaces (Vector v)
+ public void setPreserveSpaces(Vector v)
{
- if(null == m_whitespacePreservingElements)
+
+ if (null == m_whitespacePreservingElements)
{
m_whitespacePreservingElements = v;
}
else
{
int n = v.size();
- for(int i = 0; i < n; i++)
+
+ for (int i = 0; i < n; i++)
+ {
m_whitespacePreservingElements.addElement(v.elementAt(i));
+ }
}
}
/**
- * Get a "xsl:preserve-space" property.
+ * Get a "xsl:preserve-space" property.
* @see <a href="http://www.w3.org/TR/xslt#strip">strip in XSLT
Specification</a>
+ *
+ * NEEDSDOC @param i
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws ArrayIndexOutOfBoundsException
*/
- public XPath getPreserveSpace(int i)
- throws ArrayIndexOutOfBoundsException
+ public XPath getPreserveSpace(int i) throws ArrayIndexOutOfBoundsException
{
- if(null == m_whitespacePreservingElements)
+
+ if (null == m_whitespacePreservingElements)
throw new ArrayIndexOutOfBoundsException();
- return (XPath)m_whitespacePreservingElements.elementAt(i);
+
+ return (XPath) m_whitespacePreservingElements.elementAt(i);
}
/**
- * Get the number of "xsl:preserve-space" properties.
+ * Get the number of "xsl:preserve-space" properties.
* @see <a href="http://www.w3.org/TR/xslt#strip">strip in XSLT
Specification</a>
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public int getPreserveSpaceCount()
{
- return (null != m_whitespacePreservingElements)
+ return (null != m_whitespacePreservingElements)
? m_whitespacePreservingElements.size() : 0;
}
/**
- * The "xsl:output" property.
+ * The "xsl:output" property.
*/
private OutputFormatExtended m_output;
/**
- * Set the "xsl:output" property.
+ * Set the "xsl:output" property.
* @see <a href="http://www.w3.org/TR/xslt#output">output in XSLT
Specification</a>
+ *
+ * NEEDSDOC @param v
*/
- public void setOutput (OutputFormatExtended v)
+ public void setOutput(OutputFormatExtended v)
{
m_output = v;
}
/**
- * Get the "xsl:output" property.
+ * Get the "xsl:output" property.
* @see <a href="http://www.w3.org/TR/xslt#output">output in XSLT
Specification</a>
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public OutputFormatExtended getOutput()
{
@@ -659,216 +814,285 @@
}
/**
- * The "xsl:key" property.
+ * The "xsl:key" property.
*/
private Vector m_keyDeclarations;
/**
- * Set the "xsl:key" property.
+ * Set the "xsl:key" property.
* @see <a href="http://www.w3.org/TR/xslt#key">key in XSLT
Specification</a>
+ *
+ * NEEDSDOC @param v
*/
- public void setKey (KeyDeclaration v)
+ public void setKey(KeyDeclaration v)
{
- if(null == m_keyDeclarations)
+
+ if (null == m_keyDeclarations)
m_keyDeclarations = new Vector();
+
m_keyDeclarations.addElement(v);
}
/**
- * Get an "xsl:key" property.
+ * Get an "xsl:key" property.
* @see <a href="http://www.w3.org/TR/xslt#key">key in XSLT
Specification</a>
+ *
+ * NEEDSDOC @param i
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws ArrayIndexOutOfBoundsException
*/
- public KeyDeclaration getKey(int i)
- throws ArrayIndexOutOfBoundsException
+ public KeyDeclaration getKey(int i) throws ArrayIndexOutOfBoundsException
{
- if(null == m_keyDeclarations)
+
+ if (null == m_keyDeclarations)
throw new ArrayIndexOutOfBoundsException();
- return (KeyDeclaration)m_keyDeclarations.elementAt(i);
+
+ return (KeyDeclaration) m_keyDeclarations.elementAt(i);
}
/**
- * Get the number of "xsl:key" properties.
+ * Get the number of "xsl:key" properties.
* @see <a href="http://www.w3.org/TR/xslt#key">key in XSLT
Specification</a>
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public int getKeyCount()
{
- return (null != m_keyDeclarations)
- ? m_keyDeclarations.size() : 0;
+ return (null != m_keyDeclarations) ? m_keyDeclarations.size() : 0;
}
/**
- * The "xsl:attribute-set" property.
+ * The "xsl:attribute-set" property.
*/
private Vector m_attributeSets;
/**
- * Set the "xsl:attribute-set" property.
+ * Set the "xsl:attribute-set" property.
* @see <a href="http://www.w3.org/TR/xslt#attribute-sets">attribute-sets
in XSLT Specification</a>
+ *
+ * NEEDSDOC @param attrSet
*/
- public void setAttributeSet (ElemAttributeSet attrSet)
+ public void setAttributeSet(ElemAttributeSet attrSet)
{
- if(null == m_attributeSets)
+
+ if (null == m_attributeSets)
{
m_attributeSets = new Vector();
}
+
// Insert elements by order of importance so that
// during recompose, they get properly overiden.
- m_attributeSets.insertElementAt(attrSet, 0);
+ m_attributeSets.insertElementAt(attrSet, 0);
}
/**
- * Get an "xsl:attribute-set" property.
+ * Get an "xsl:attribute-set" property.
* @see <a href="http://www.w3.org/TR/xslt#attribute-sets">attribute-sets
in XSLT Specification</a>
+ *
+ * NEEDSDOC @param i
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws ArrayIndexOutOfBoundsException
*/
public ElemAttributeSet getAttributeSet(int i)
- throws ArrayIndexOutOfBoundsException
+ throws ArrayIndexOutOfBoundsException
{
- if(null == m_attributeSets)
+
+ if (null == m_attributeSets)
throw new ArrayIndexOutOfBoundsException();
- return (ElemAttributeSet)m_attributeSets.elementAt(i);
+
+ return (ElemAttributeSet) m_attributeSets.elementAt(i);
}
/**
- * Get the number of "xsl:attribute-set" properties.
+ * Get the number of "xsl:attribute-set" properties.
* @see <a href="http://www.w3.org/TR/xslt#attribute-sets">attribute-sets
in XSLT Specification</a>
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public int getAttributeSetCount()
{
- return (null != m_attributeSets)
- ? m_attributeSets.size() : 0;
+ return (null != m_attributeSets) ? m_attributeSets.size() : 0;
}
/**
- * The "xsl:variable" properties.
+ * The "xsl:variable" properties.
*/
private Vector m_topLevelVariables;
/**
- * Set the "xsl:variable" property.
+ * Set the "xsl:variable" property.
* @see <a
href="http://www.w3.org/TR/xslt#top-level-variables">top-level-variables in
XSLT Specification</a>
+ *
+ * NEEDSDOC @param v
*/
- public void setVariable (ElemVariable v)
+ public void setVariable(ElemVariable v)
{
- if(null == m_topLevelVariables)
+
+ if (null == m_topLevelVariables)
m_topLevelVariables = new Vector();
+
// Always insert variables by order of importance so that
// during recompose, they get properly overiden.
- m_topLevelVariables.insertElementAt(v, 0);
+ m_topLevelVariables.insertElementAt(v, 0);
}
-
+
/**
- * Get an "xsl:variable" property.
+ * Get an "xsl:variable" property.
* @see <a
href="http://www.w3.org/TR/xslt#top-level-variables">top-level-variables in
XSLT Specification</a>
+ *
+ * NEEDSDOC @param qname
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public ElemVariable getVariable(QName qname)
{
- if(null != m_topLevelVariables)
+
+ if (null != m_topLevelVariables)
{
int n = getVariableCount();
- for(int i = 0; i < n; i++)
+
+ for (int i = 0; i < n; i++)
{
- ElemVariable var = (ElemVariable)getVariable(i);
- if(var.getName().equals(qname))
+ ElemVariable var = (ElemVariable) getVariable(i);
+
+ if (var.getName().equals(qname))
return var;
}
}
+
return null;
}
/**
- * Get an "xsl:variable" property.
+ * Get an "xsl:variable" property.
* @see <a
href="http://www.w3.org/TR/xslt#top-level-variables">top-level-variables in
XSLT Specification</a>
+ *
+ * NEEDSDOC @param i
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws ArrayIndexOutOfBoundsException
*/
- public ElemVariable getVariable(int i)
- throws ArrayIndexOutOfBoundsException
+ public ElemVariable getVariable(int i) throws
ArrayIndexOutOfBoundsException
{
- if(null == m_topLevelVariables)
+
+ if (null == m_topLevelVariables)
throw new ArrayIndexOutOfBoundsException();
- return (ElemVariable)m_topLevelVariables.elementAt(i);
+
+ return (ElemVariable) m_topLevelVariables.elementAt(i);
}
/**
- * Get the number of "xsl:variable" properties.
+ * Get the number of "xsl:variable" properties.
* @see <a
href="http://www.w3.org/TR/xslt#top-level-variables">top-level-variables in
XSLT Specification</a>
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public int getVariableCount()
{
- return (null != m_topLevelVariables)
- ? m_topLevelVariables.size() : 0;
+ return (null != m_topLevelVariables) ? m_topLevelVariables.size() : 0;
}
/**
- * The "xsl:param" properties.
+ * The "xsl:param" properties.
*/
private Vector m_topLevelParams;
/**
- * Set an "xsl:param" property.
+ * Set an "xsl:param" property.
* @see <a
href="http://www.w3.org/TR/xslt#top-level-variables">top-level-variables in
XSLT Specification</a>
+ *
+ * NEEDSDOC @param v
*/
- public void setParam (ElemParam v)
+ public void setParam(ElemParam v)
{
- if(null == m_topLevelParams)
+
+ if (null == m_topLevelParams)
m_topLevelParams = new Vector();
+
// Always insert parameters by order of importance so that
// during recompose, they get properly overiden.
- m_topLevelParams.insertElementAt(v, 0);
+ m_topLevelParams.insertElementAt(v, 0);
}
-
+
/**
- * Get an "xsl:param" property.
+ * Get an "xsl:param" property.
* @see <a
href="http://www.w3.org/TR/xslt#top-level-variables">top-level-variables in
XSLT Specification</a>
+ *
+ * NEEDSDOC @param qname
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public ElemParam getParam(QName qname)
{
- if(null != m_topLevelParams)
+
+ if (null != m_topLevelParams)
{
int n = getParamCount();
- for(int i = 0; i < n; i++)
+
+ for (int i = 0; i < n; i++)
{
ElemParam var = getParam(i);
- if(var.getName().equals(qname))
+
+ if (var.getName().equals(qname))
return var;
}
}
+
return null;
}
/**
- * Get an "xsl:param" property.
+ * Get an "xsl:param" property.
* @see <a
href="http://www.w3.org/TR/xslt#top-level-variables">top-level-variables in
XSLT Specification</a>
+ *
+ * NEEDSDOC @param i
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws ArrayIndexOutOfBoundsException
*/
- public ElemParam getParam(int i)
- throws ArrayIndexOutOfBoundsException
+ public ElemParam getParam(int i) throws ArrayIndexOutOfBoundsException
{
- if(null == m_topLevelParams)
+
+ if (null == m_topLevelParams)
throw new ArrayIndexOutOfBoundsException();
- return (ElemParam)m_topLevelParams.elementAt(i);
+
+ return (ElemParam) m_topLevelParams.elementAt(i);
}
/**
- * Get the number of "xsl:param" properties.
+ * Get the number of "xsl:param" properties.
* @see <a
href="http://www.w3.org/TR/xslt#top-level-variables">top-level-variables in
XSLT Specification</a>
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public int getParamCount()
{
- return (null != m_topLevelParams)
- ? m_topLevelParams.size() : 0;
+ return (null != m_topLevelParams) ? m_topLevelParams.size() : 0;
}
/**
- * The "xsl:template" properties.
+ * The "xsl:template" properties.
*/
private Vector m_templates;
-
+
/**
- * Set an "xsl:template" property.
+ * Set an "xsl:template" property.
* @see <a
href="http://www.w3.org/TR/xslt#section-Defining-Template-Rules">section-Defining-Template-Rules
in XSLT Specification</a>
+ *
+ * NEEDSDOC @param v
*/
- public void setTemplate (ElemTemplate v)
+ public void setTemplate(ElemTemplate v)
{
- if(null == m_templates)
+
+ if (null == m_templates)
m_templates = new Vector();
+
m_templates.addElement(v);
v.setStylesheet(this);
}
@@ -876,86 +1100,114 @@
/**
* Get an "xsl:template" property.
* @see <a
href="http://www.w3.org/TR/xslt#section-Defining-Template-Rules">section-Defining-Template-Rules
in XSLT Specification</a>
+ *
+ * NEEDSDOC @param i
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws SAXException
*/
- public ElemTemplate getTemplate(int i)
- throws SAXException
+ public ElemTemplate getTemplate(int i) throws SAXException
{
- if(null == m_templates)
+
+ if (null == m_templates)
throw new ArrayIndexOutOfBoundsException();
- return (ElemTemplate)m_templates.elementAt(i);
+
+ return (ElemTemplate) m_templates.elementAt(i);
}
/**
* Get the number of "xsl:template" properties.
* @see <a
href="http://www.w3.org/TR/xslt#section-Defining-Template-Rules">section-Defining-Template-Rules
in XSLT Specification</a>
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public int getTemplateCount()
{
- return (null != m_templates)
- ? m_templates.size() : 0;
+ return (null != m_templates) ? m_templates.size() : 0;
}
/**
- * The "xsl:namespace-alias" properties.
+ * The "xsl:namespace-alias" properties.
*/
private Vector m_prefix_aliases;
-
+
/**
- * Set the "xsl:namespace-alias" property.
+ * Set the "xsl:namespace-alias" property.
* @see <a
href="http://www.w3.org/TR/xslt#literal-result-element">literal-result-element
in XSLT Specification</a>
+ *
+ * NEEDSDOC @param na
*/
- public void setNamespaceAlias (NamespaceAlias na)
+ public void setNamespaceAlias(NamespaceAlias na)
{
+
if (m_prefix_aliases == null)
m_prefix_aliases = new Vector();
+
// Always insert elements by order of importance so that
// during recompose, they get properly overiden.
m_prefix_aliases.insertElementAt(na, 0);
}
-
+
/**
- * Get an "xsl:variable" property.
+ * Get an "xsl:variable" property.
* @see <a
href="http://www.w3.org/TR/xslt#top-level-variables">top-level-variables in
XSLT Specification</a>
+ *
+ * NEEDSDOC @param i
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws ArrayIndexOutOfBoundsException
*/
public NamespaceAlias getNamespaceAlias(int i)
- throws ArrayIndexOutOfBoundsException
+ throws ArrayIndexOutOfBoundsException
{
- if(null == m_prefix_aliases)
+
+ if (null == m_prefix_aliases)
throw new ArrayIndexOutOfBoundsException();
- return (NamespaceAlias)m_prefix_aliases.elementAt(i);
+
+ return (NamespaceAlias) m_prefix_aliases.elementAt(i);
}
/**
- * Get the number of "xsl:variable" properties.
+ * Get the number of "xsl:variable" properties.
* @see <a
href="http://www.w3.org/TR/xslt#top-level-variables">top-level-variables in
XSLT Specification</a>
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public int getNamespaceAliasCount()
{
- return (null != m_prefix_aliases)
- ? m_prefix_aliases.size() : 0;
+ return (null != m_prefix_aliases) ? m_prefix_aliases.size() : 0;
}
-
/**
- * The "non-xsl-top-level" properties.
+ * The "non-xsl-top-level" properties.
*/
private Hashtable m_NonXslTopLevel;
/**
- * Set a found non-xslt element.
+ * Set a found non-xslt element.
* @see <a
href="http://www.w3.org/TR/xslt#stylesheet-element">stylesheet-element in XSLT
Specification</a>
+ *
+ * NEEDSDOC @param name
+ * NEEDSDOC @param obj
*/
- public void setNonXslTopLevel (QName name, Object obj)
+ public void setNonXslTopLevel(QName name, Object obj)
{
- if(null == m_NonXslTopLevel)
+
+ if (null == m_NonXslTopLevel)
m_NonXslTopLevel = new Hashtable();
-
+
m_NonXslTopLevel.put(name, obj);
}
/**
- * Get a non-xslt element.
+ * Get a non-xslt element.
* @see <a
href="http://www.w3.org/TR/xslt#stylesheet-element">stylesheet-element in XSLT
Specification</a>
+ *
+ * NEEDSDOC @param name
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public Object getNonXslTopLevel(QName name)
{
@@ -963,17 +1215,23 @@
}
// =========== End top-level XSLT properties ===========
-
+
/**
* The base URL of the XSL document.
* @serial
*/
private String m_href = null;
+
+ /** NEEDSDOC Field m_publicId */
private String m_publicId;
+
+ /** NEEDSDOC Field m_systemId */
private String m_systemId;
/**
* Get the base identifier with which this stylesheet is associated.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public String getHref()
{
@@ -982,39 +1240,44 @@
/**
* Get the base identifier with which this stylesheet is associated.
+ *
+ * NEEDSDOC @param baseIdent
*/
public void setHref(String baseIdent)
{
m_href = baseIdent;
}
-
+
/**
* Set the location information for this element.
+ *
+ * NEEDSDOC @param locator
*/
public void setLocaterInfo(Locator locator)
{
- if(null != locator)
+
+ if (null != locator)
{
m_publicId = locator.getPublicId();
m_systemId = locator.getSystemId();
-
- if(null != m_systemId)
+
+ if (null != m_systemId)
{
try
{
m_href = SystemIDResolver.getAbsoluteURI(m_systemId, null);
}
- catch(SAXException se)
+ catch (SAXException se)
{
+
// Ignore this for right now
}
}
-
+
super.setLocaterInfo(locator);
}
}
-
/**
* The root of the stylesheet, where all the tables common
* to all stylesheets are kept.
@@ -1025,6 +1288,8 @@
/**
* Get the root of the stylesheet, where all the tables common
* to all stylesheets are kept.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public StylesheetRoot getStylesheetRoot()
{
@@ -1034,6 +1299,8 @@
/**
* Set the root of the stylesheet, where all the tables common
* to all stylesheets are kept.
+ *
+ * NEEDSDOC @param v
*/
public void setStylesheetRoot(StylesheetRoot v)
{
@@ -1050,6 +1317,8 @@
/**
* Get the parent of the stylesheet. This will be null if this
* is the root stylesheet.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public Stylesheet getStylesheetParent()
{
@@ -1059,6 +1328,8 @@
/**
* Set the parent of the stylesheet. This should be null if this
* is the root stylesheet.
+ *
+ * NEEDSDOC @param v
*/
public void setStylesheetParent(Stylesheet v)
{
@@ -1066,31 +1337,38 @@
}
/**
- * Get the owning aggregated stylesheet, or this
+ * Get the owning aggregated stylesheet, or this
* stylesheet if it is aggregated.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public StylesheetComposed getStylesheetComposed()
{
+
Stylesheet sheet = this;
- while(!sheet.isAggregatedType())
+
+ while (!sheet.isAggregatedType())
{
sheet = sheet.getStylesheetParent();
}
- return (StylesheetComposed)sheet;
+
+ return (StylesheetComposed) sheet;
}
/**
* Get the type of the node. We'll pretend we're a Document.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
- public short getNodeType()
+ public short getNodeType()
{
return Node.DOCUMENT_NODE;
}
-
- /**
+
+ /**
* Get an integer representation of the element type.
- *
- * @return An integer representation of the element, defined in the
+ *
+ * @return An integer representation of the element, defined in the
* Constants class.
* @see org.apache.xalan.templates.Constants
*/
@@ -1098,9 +1376,11 @@
{
return Constants.ELEMNAME_STYLESHEET;
}
-
- /**
+
+ /**
* Return the node name.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public String getNodeName()
{
@@ -1113,15 +1393,20 @@
* us to access a template, compile it, instantiate it,
* and replace the original with the compiled instance.
* ADDED 9/5/2000 to support compilation experiment
+ *
+ * NEEDSDOC @param v
+ * NEEDSDOC @param i
+ *
+ * @throws SAXException
*/
- public void replaceTemplate(ElemTemplate v, int i)
- throws SAXException
+ public void replaceTemplate(ElemTemplate v, int i) throws SAXException
{
- if(null == m_templates)
+
+ if (null == m_templates)
throw new ArrayIndexOutOfBoundsException();
- replaceChild(v,(Node)m_templates.elementAt(i));
- m_templates.setElementAt(v,i);
- v.setStylesheet(this);
- }
+ replaceChild(v, (Node) m_templates.elementAt(i));
+ m_templates.setElementAt(v, i);
+ v.setStylesheet(this);
+ }
}
1.13 +369 -173
xml-xalan/java/src/org/apache/xalan/templates/StylesheetComposed.java
Index: StylesheetComposed.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/StylesheetComposed.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- StylesheetComposed.java 2000/10/18 04:36:43 1.12
+++ StylesheetComposed.java 2000/10/30 18:50:05 1.13
@@ -8,13 +8,13 @@
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
+ * the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
@@ -59,39 +59,44 @@
import java.util.Vector;
import java.util.Hashtable;
import java.util.Enumeration;
+
import org.apache.trax.ProcessorException;
import org.apache.xpath.XPath;
import org.apache.xalan.utils.QName;
import org.apache.serialize.OutputFormat;
import org.apache.xalan.transformer.TransformerImpl;
import org.apache.xpath.XPathContext;
+
import org.w3c.dom.Node;
import org.w3c.dom.Element;
+
import org.xml.sax.SAXException;
+
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
/**
- * Represents a stylesheet that has methods that resolve includes and
- * imports. It has methods on it that
+ * Represents a stylesheet that has methods that resolve includes and
+ * imports. It has methods on it that
* return "composed" properties, which mean that:
* <ol>
- * <li>Properties that are aggregates, like OutputFormat, will
- * be composed of properties declared in this stylsheet and all
+ * <li>Properties that are aggregates, like OutputFormat, will
+ * be composed of properties declared in this stylsheet and all
* included stylesheets.</li>
- * <li>Properties that aren't found, will be searched for first in
- * the includes, and, if none are located, will be searched for in
+ * <li>Properties that aren't found, will be searched for first in
+ * the includes, and, if none are located, will be searched for in
* the imports.</li>
- * <li>Properties in that are not atomic on a stylesheet will
- * have the form getXXXComposed. Some properties, like version and id,
+ * <li>Properties in that are not atomic on a stylesheet will
+ * have the form getXXXComposed. Some properties, like version and id,
* are not inherited, and so won't have getXXXComposed methods.</li>
- * </ol>
- * <p>In some cases getXXXComposed methods may calculate the composed
- * values dynamically, while in other cases they may store the composed
+ * </ol>
+ * <p>In some cases getXXXComposed methods may calculate the composed
+ * values dynamically, while in other cases they may store the composed
* values.</p>
*/
public class StylesheetComposed extends Stylesheet
{
+
/**
* Uses an XSL stylesheet document.
* @param parent The including or importing stylesheet.
@@ -100,273 +105,378 @@
{
super(parent);
}
-
+
/**
- * Tell if this can be cast to a StylesheetComposed, meaning, you
+ * Tell if this can be cast to a StylesheetComposed, meaning, you
* can ask questions from getXXXComposed functions.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public boolean isAggregatedType()
{
return true;
}
-
+
+ /** NEEDSDOC Field m_importNumber */
private int m_importNumber = -1;
-
+
+ /** NEEDSDOC Field m_importCountComposed */
+ private int m_importCountComposed;
+
/**
- * Recalculate the number of this stylesheet in the global
+ * Recalculate the number of this stylesheet in the global
* import list.
* <p>For example, suppose</p>
* <p>stylesheet A imports stylesheets B and C in that order;</p>
* <p>stylesheet B imports stylesheet D;</p>
* <p>stylesheet C imports stylesheet E.</p>
* <p>Then the order of import precedence (lowest first) is D, B, E, C,
A.</p>
- * <p>If this were stylesheet C, then the importsComposed list
+ * <p>If this were stylesheet C, then the importsComposed list
* would be E, B, D (highest first).</p>
*/
void recomposeImports()
{
+
m_importNumber = getStylesheetRoot().getImportNumber(this);
+
+ StylesheetRoot root = getStylesheetRoot();
+ int globalImportCount = root.getGlobalImportCount();
+
+ m_importCountComposed = (globalImportCount - m_importNumber) - 1;
}
/**
- * Get a stylesheet from the "import" list.
+ * Get a stylesheet from the "import" list.
* @see <a href="http://www.w3.org/TR/xslt#import">import in XSLT
Specification</a>
+ *
+ * NEEDSDOC @param i
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws ArrayIndexOutOfBoundsException
*/
public StylesheetComposed getImportComposed(int i)
- throws ArrayIndexOutOfBoundsException
+ throws ArrayIndexOutOfBoundsException
{
+
StylesheetRoot root = getStylesheetRoot();
+
// Get the stylesheet that is offset past this stylesheet.
// Thus, if the index of this stylesheet is 3, an argument
// to getImportComposed of 0 will return the 4th stylesheet
// in the global import list.
- return root.getGlobalImport(1+m_importNumber+i);
+ return root.getGlobalImport(1 + m_importNumber + i);
}
/**
- * Get the number of imported stylesheets.
+ * Get the number of imported stylesheets.
* @see <a href="http://www.w3.org/TR/xslt#import">import in XSLT
Specification</a>
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public int getImportCountComposed()
{
- StylesheetRoot root = getStylesheetRoot();
- int globalImportCount = root.getGlobalImportCount();
- return (globalImportCount-m_importNumber)-1;
+ return m_importCountComposed;
}
-
+
/**
* The combined list of includes.
*/
private transient Vector m_includesComposed;
-
+
/**
* Recompose the value of the composed include list.
+ *
+ * NEEDSDOC @param including
*/
void recomposeIncludes(Stylesheet including)
{
+
int n = including.getIncludeCount();
- if(n > 0)
+
+ if (n > 0)
{
- if(null == m_includesComposed)
+ if (null == m_includesComposed)
m_includesComposed = new Vector();
- for(int i = 0; i < n; i++)
+
+ for (int i = 0; i < n; i++)
{
Stylesheet included = including.getInclude(i);
+
m_includesComposed.addElement(included);
recomposeIncludes(included);
}
}
}
-
+
/**
- * Get an "xsl:include" property.
+ * Get an "xsl:include" property.
* @see <a href="http://www.w3.org/TR/xslt#include">include in XSLT
Specification</a>
+ *
+ * NEEDSDOC @param i
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws ArrayIndexOutOfBoundsException
*/
public Stylesheet getIncludeComposed(int i)
- throws ArrayIndexOutOfBoundsException
+ throws ArrayIndexOutOfBoundsException
{
- if(null == m_includesComposed)
+
+ if (null == m_includesComposed)
throw new ArrayIndexOutOfBoundsException();
- return (Stylesheet)m_includesComposed.elementAt(i);
+
+ return (Stylesheet) m_includesComposed.elementAt(i);
}
/**
- * Get the number of included stylesheets.
+ * Get the number of included stylesheets.
* @see <a href="http://www.w3.org/TR/xslt#import">import in XSLT
Specification</a>
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public int getIncludeCountComposed()
{
return (null != m_includesComposed) ? m_includesComposed.size() : 0;
}
-
+
/**
* Table of DecimalFormatSymbols, keyed by QName.
*/
private transient Hashtable m_decimalFormatSymbols;
-
+
/**
- * Given a valid element decimal-format name, return the
+ * Given a valid element decimal-format name, return the
* decimalFormatSymbols with that name.
- * <p>It is an error to declare either the default decimal-format or
- * a decimal-format with a given name more than once (even with
- * different import precedence), unless it is declared every
- * time with the same value for all attributes (taking into
+ * <p>It is an error to declare either the default decimal-format or
+ * a decimal-format with a given name more than once (even with
+ * different import precedence), unless it is declared every
+ * time with the same value for all attributes (taking into
* account any default values).</p>
- * <p>Which means, as far as I can tell, the decimal-format
+ * <p>Which means, as far as I can tell, the decimal-format
* properties are not additive.</p>
* @return null if name is not found.
*/
void recomposeDecimalFormats()
{
+
m_decimalFormatSymbols = new Hashtable();
-
+
// Loop for this stylesheet and all stylesheets included or of lower
// import precidence.
int nImports = getImportCountComposed();
- for(int i = -1; i < nImports; i++)
+
+ for (int i = -1; i < nImports; i++)
{
StylesheetComposed stylesheet = (i < 0) ? this : getImportComposed(i);
+
// Does this stylesheet contain it?
int nDFPs = stylesheet.getDecimalFormatCount();
- for(int dfpIndex = 0; dfpIndex < nDFPs; dfpIndex++)
+
+ for (int dfpIndex = 0; dfpIndex < nDFPs; dfpIndex++)
{
DecimalFormatProperties dfp = stylesheet.getDecimalFormat(dfpIndex);
- m_decimalFormatSymbols.put(dfp.getName(),
dfp.getDecimalFormatSymbols());
+
+ m_decimalFormatSymbols.put(dfp.getName(),
+ dfp.getDecimalFormatSymbols());
}
-
+
// Do the included stylesheets contain it?
int nIncludes = stylesheet.getIncludeCountComposed();
- for(int k = 0; k < nIncludes; k++)
+
+ for (int k = 0; k < nIncludes; k++)
{
Stylesheet included = stylesheet.getIncludeComposed(k);
+
nDFPs = included.getDecimalFormatCount();
- for(int dfpIndex = 0; dfpIndex < nDFPs; dfpIndex++)
+
+ for (int dfpIndex = 0; dfpIndex < nDFPs; dfpIndex++)
{
DecimalFormatProperties dfp = included.getDecimalFormat(dfpIndex);
- m_decimalFormatSymbols.put(dfp.getName(),
dfp.getDecimalFormatSymbols());
+
+ m_decimalFormatSymbols.put(dfp.getName(),
+ dfp.getDecimalFormatSymbols());
}
}
}
}
/**
- * Given a valid element decimal-format name, return the
+ * Given a valid element decimal-format name, return the
* decimalFormatSymbols with that name.
- * <p>It is an error to declare either the default decimal-format or
- * a decimal-format with a given name more than once (even with
- * different import precedence), unless it is declared every
- * time with the same value for all attributes (taking into
+ * <p>It is an error to declare either the default decimal-format or
+ * a decimal-format with a given name more than once (even with
+ * different import precedence), unless it is declared every
+ * time with the same value for all attributes (taking into
* account any default values).</p>
- * <p>Which means, as far as I can tell, the decimal-format
+ * <p>Which means, as far as I can tell, the decimal-format
* properties are not additive.</p>
+ *
+ * NEEDSDOC @param name
* @return null if name is not found.
*/
public DecimalFormatSymbols getDecimalFormatComposed(QName name)
{
- return (DecimalFormatSymbols)m_decimalFormatSymbols.get(name);
+ return (DecimalFormatSymbols) m_decimalFormatSymbols.get(name);
}
-
+
/**
- * A list of properties that specify how to do space
+ * A list of properties that specify how to do space
* stripping. This uses the same exact mechanism as Templates.
*/
- private transient WhitespaceList m_whiteSpaceInfoList;
-
+ private WhitespaceList m_whiteSpaceInfoList;
+
/**
* Compile a lookup table for WhiteSpaceInfo elements, which are built
* from xsl:strip-space and xsl:preserve space information.
* @return null if node is not matched.
+ *
+ * @throws SAXException
*/
- void recomposeWhiteSpaceInfo()
- throws SAXException
+ void recomposeWhiteSpaceInfo() throws SAXException
{
- m_whiteSpaceInfoList = new WhitespaceList(this);
-
+
int nIncludes = getIncludeCountComposed();
- for(int k = -1; k < nIncludes; k++)
+
+ for (int k = -1; k < nIncludes; k++)
{
Stylesheet included = (-1 == k) ? this : getIncludeComposed(k);
-
int n = included.getStripSpaceCount();
- for(int i = 0; i < n; i++)
+
+ for (int i = 0; i < n; i++)
{
+ if (null == m_whiteSpaceInfoList)
+ m_whiteSpaceInfoList = new WhitespaceList(this);
+
XPath match = included.getStripSpace(i);
+
m_whiteSpaceInfoList.setTemplate(new WhiteSpaceInfo(match, true));
}
+
n = included.getPreserveSpaceCount();
- for(int i = 0; i < n; i++)
+
+ for (int i = 0; i < n; i++)
{
+ if (null == m_whiteSpaceInfoList)
+ m_whiteSpaceInfoList = new WhitespaceList(this);
+
XPath match = included.getPreserveSpace(i);
+
m_whiteSpaceInfoList.setTemplate(new WhiteSpaceInfo(match, false));
}
}
+ }
+
+ /**
+ * Check to see if the caller should bother with check for
+ * whitespace nodes.
+ *
+ * NEEDSDOC ($objectName$) @return
+ */
+ public boolean shouldCheckWhitespace()
+ {
+
+ if (null != m_whiteSpaceInfoList)
+ return true;
+
+ int n = getImportCountComposed();
+
+ for (int i = 0; i < n; i++)
+ {
+ StylesheetComposed imported = getImportComposed(i);
+
+ if (null != imported.m_whiteSpaceInfoList)
+ return true;
+ }
+
+ return false;
}
-
+
/**
* Get information about whether or not an element should strip whitespace.
* @see <a href="http://www.w3.org/TR/xslt#strip">strip in XSLT
Specification</a>
+ *
+ * NEEDSDOC @param support
+ * NEEDSDOC @param targetElement
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws SAXException
*/
- public WhiteSpaceInfo getWhiteSpaceInfo(XPathContext support,
- Element targetElement)
- throws SAXException
+ public WhiteSpaceInfo getWhiteSpaceInfo(
+ XPathContext support, Element targetElement) throws SAXException
{
- return (WhiteSpaceInfo)m_whiteSpaceInfoList.getTemplate(support,
- targetElement,
null,
- false);
+
+ if (null != m_whiteSpaceInfoList)
+ return (WhiteSpaceInfo) m_whiteSpaceInfoList.getTemplate(support,
+ targetElement, null, false);
+ else
+ return null;
}
-
+
/**
- * A list of all key declarations visible from this stylesheet and all
+ * A list of all key declarations visible from this stylesheet and all
* lesser stylesheets.
*/
private transient Vector m_keyDecls;
-
+
/**
- * Recompose the key decls from this stylesheet and
+ * Recompose the key decls from this stylesheet and
* all stylesheets within lesser import precedence.
*/
void recomposeKeys()
{
+
m_keyDecls = new Vector();
-
+
// Loop for this stylesheet and all stylesheets included or of lower
// import precidence.
int nImports = getImportCountComposed();
- for(int i = -1; i < nImports; i++)
+
+ for (int i = -1; i < nImports; i++)
{
StylesheetComposed stylesheet = (i < 0) ? this : getImportComposed(i);
+
// Does this stylesheet contain it?
int nKeys = stylesheet.getKeyCount();
- for(int keyIndex = 0; keyIndex < nKeys; keyIndex++)
+
+ for (int keyIndex = 0; keyIndex < nKeys; keyIndex++)
{
KeyDeclaration keyDecl = stylesheet.getKey(keyIndex);
+
m_keyDecls.addElement(keyDecl);
}
-
+
// Do the included stylesheets contain it?
int nIncludes = stylesheet.getIncludeCountComposed();
- for(int k = 0; k < nIncludes; k++)
+
+ for (int k = 0; k < nIncludes; k++)
{
Stylesheet included = stylesheet.getIncludeComposed(k);
+
nKeys = included.getKeyCount();
- for(int keyIndex = 0; keyIndex < nKeys; keyIndex++)
+
+ for (int keyIndex = 0; keyIndex < nKeys; keyIndex++)
{
KeyDeclaration keyDecl = included.getKey(keyIndex);
+
m_keyDecls.addElement(keyDecl);
}
}
}
}
-
+
/**
- * Get the composed "xsl:key" properties.
+ * Get the composed "xsl:key" properties.
* @see <a href="http://www.w3.org/TR/xslt#key">key in XSLT
Specification</a>
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public Vector getKeysComposed()
{
return m_keyDecls;
}
-
+
/**
* Composed set of all included and imported attribute set properties.
* Each entry is a vector of ElemAttributeSet objects.
@@ -375,62 +485,81 @@
private transient Hashtable m_attrSets;
/**
- * Recompose the attribute-set decls from this stylesheet and
+ * Recompose the attribute-set decls from this stylesheet and
* all stylesheets within import precedence.
*/
void recomposeAttributeSets()
{
+
m_attrSets = new Hashtable();
-
+
// Loop for this stylesheet and all stylesheets included or of lower
// import precidence.
int nImports = getImportCountComposed();
- for(int i = -1; i < nImports; i++)
+
+ for (int i = -1; i < nImports; i++)
{
StylesheetComposed stylesheet = (i < 0) ? this : getImportComposed(i);
+
// Does this stylesheet contain it?
int nAS = stylesheet.getAttributeSetCount();
- for(int asIndex = 0; asIndex < nAS; asIndex++)
+
+ for (int asIndex = 0; asIndex < nAS; asIndex++)
{
ElemAttributeSet attrSet = stylesheet.getAttributeSet(asIndex);
- Vector attrSetList = (Vector)m_attrSets.get(attrSet.getName());
- if(null == attrSetList)
+ Vector attrSetList = (Vector) m_attrSets.get(attrSet.getName());
+
+ if (null == attrSetList)
{
attrSetList = new Vector();
+
m_attrSets.put(attrSet.getName(), attrSetList);
}
+
attrSetList.addElement(attrSet);
}
-
+
// Do the included stylesheets contain it?
int nIncludes = stylesheet.getIncludeCountComposed();
- for(int k = 0; k < nIncludes; k++)
+
+ for (int k = 0; k < nIncludes; k++)
{
Stylesheet included = stylesheet.getIncludeComposed(k);
+
nAS = included.getAttributeSetCount();
- for(int asIndex = 0; asIndex < nAS; asIndex++)
+
+ for (int asIndex = 0; asIndex < nAS; asIndex++)
{
ElemAttributeSet attrSet = included.getAttributeSet(asIndex);
- Vector attrSetList = (Vector)m_attrSets.get(attrSet.getName());
- if(null == attrSetList)
+ Vector attrSetList = (Vector) m_attrSets.get(attrSet.getName());
+
+ if (null == attrSetList)
{
attrSetList = new Vector();
+
m_attrSets.put(attrSet.getName(), attrSetList);
}
+
attrSetList.addElement(attrSet);
}
}
}
}
-
+
/**
- * Get a list "xsl:attribute-set" properties that match the qname.
+ * Get a list "xsl:attribute-set" properties that match the qname.
* @see <a href="http://www.w3.org/TR/xslt#attribute-sets">attribute-sets
in XSLT Specification</a>
+ *
+ * NEEDSDOC @param name
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws ArrayIndexOutOfBoundsException
*/
public Vector getAttributeSetComposed(QName name)
- throws ArrayIndexOutOfBoundsException
+ throws ArrayIndexOutOfBoundsException
{
- return (Vector)m_attrSets.get(name);
+ return (Vector) m_attrSets.get(name);
}
/**
@@ -440,40 +569,49 @@
private transient Hashtable m_variables;
/**
- * Recompose the attribute-set decls from this stylesheet and
+ * Recompose the attribute-set decls from this stylesheet and
* all stylesheets within import precedence.
*/
void recomposeVariables()
{
+
m_variables = new Hashtable();
-
+
// Loop for this stylesheet and all stylesheets included or of lower
// import precidence.
int nImports = getImportCountComposed();
- for(int i = -1; i < nImports; i++)
+
+ for (int i = -1; i < nImports; i++)
{
StylesheetComposed stylesheet = (i < 0) ? this : getImportComposed(i);
+
// Does this stylesheet contain it?
int nVariables = stylesheet.getVariableCount();
- for(int vIndex = 0; vIndex < nVariables; vIndex++)
+
+ for (int vIndex = 0; vIndex < nVariables; vIndex++)
{
ElemVariable elemVar = stylesheet.getVariable(vIndex);
+
// Don't overide higher priority variable
- if (m_variables.get(elemVar.getName())== null)
+ if (m_variables.get(elemVar.getName()) == null)
m_variables.put(elemVar.getName(), elemVar);
}
-
+
// Do the included stylesheets contain it?
int nIncludes = stylesheet.getIncludeCountComposed();
- for(int k = 0; k < nIncludes; k++)
+
+ for (int k = 0; k < nIncludes; k++)
{
Stylesheet included = stylesheet.getIncludeComposed(k);
+
nVariables = included.getVariableCount();
- for(int vIndex = 0; vIndex < nVariables; vIndex++)
+
+ for (int vIndex = 0; vIndex < nVariables; vIndex++)
{
ElemVariable elemVar = included.getVariable(vIndex);
+
// Don't overide higher priority variable
- if (m_variables.get(elemVar.getName())== null)
+ if (m_variables.get(elemVar.getName()) == null)
m_variables.put(elemVar.getName(), elemVar);
}
}
@@ -481,63 +619,78 @@
}
/**
- * Get an "xsl:variable" property.
+ * Get an "xsl:variable" property.
* @see <a
href="http://www.w3.org/TR/xslt#top-level-variables">top-level-variables in
XSLT Specification</a>
+ *
+ * NEEDSDOC @param qname
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public ElemVariable getVariableComposed(QName qname)
{
- return (ElemVariable)m_variables.get(qname);
+ return (ElemVariable) m_variables.get(qname);
}
-
+
/**
- * Get all global "xsl:variable" properties in scope for this stylesheet.
+ * Get all global "xsl:variable" properties in scope for this stylesheet.
* @see <a
href="http://www.w3.org/TR/xslt#top-level-variables">top-level-variables in
XSLT Specification</a>
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public Enumeration getVariablesComposed()
{
return m_variables.elements();
}
-
+
/**
* Composed set of all params.
*/
private transient Hashtable m_params;
/**
- * Recompose the attribute-set decls from this stylesheet and
+ * Recompose the attribute-set decls from this stylesheet and
* all stylesheets within import precedence.
*/
void recomposeParams()
{
+
m_params = new Hashtable();
-
+
// Loop for this stylesheet and all stylesheets included or of lower
// import precidence.
int nImports = getImportCountComposed();
- for(int i = -1; i < nImports; i++)
+
+ for (int i = -1; i < nImports; i++)
{
StylesheetComposed stylesheet = (i < 0) ? this : getImportComposed(i);
+
// Does this stylesheet contain it?
int nVariables = stylesheet.getParamCount();
- for(int vIndex = 0; vIndex < nVariables; vIndex++)
+
+ for (int vIndex = 0; vIndex < nVariables; vIndex++)
{
ElemParam elemVar = stylesheet.getParam(vIndex);
+
// Don't overide higher priority parameter
- if (m_params.get(elemVar.getName())== null)
+ if (m_params.get(elemVar.getName()) == null)
m_params.put(elemVar.getName(), elemVar);
}
-
+
// Do the included stylesheets contain it?
int nIncludes = stylesheet.getIncludeCountComposed();
- for(int k = 0; k < nIncludes; k++)
+
+ for (int k = 0; k < nIncludes; k++)
{
Stylesheet included = stylesheet.getIncludeComposed(k);
+
nVariables = included.getParamCount();
- for(int vIndex = 0; vIndex < nVariables; vIndex++)
+
+ for (int vIndex = 0; vIndex < nVariables; vIndex++)
{
ElemParam elemVar = included.getParam(vIndex);
+
// Don't overide higher priority parameter
- if (m_params.get(elemVar.getName())== null)
+ if (m_params.get(elemVar.getName()) == null)
m_params.put(elemVar.getName(), elemVar);
}
}
@@ -545,50 +698,67 @@
}
/**
- * Get an "xsl:param" property.
+ * Get an "xsl:param" property.
* @see <a
href="http://www.w3.org/TR/xslt#top-level-variables">top-level-variables in
XSLT Specification</a>
+ *
+ * NEEDSDOC @param qname
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public ElemParam getParamComposed(QName qname)
{
- return (ElemParam)m_params.get(qname);
+ return (ElemParam) m_params.get(qname);
}
-
+
/**
- * Get all global "xsl:variable" properties in scope for this stylesheet.
+ * Get all global "xsl:variable" properties in scope for this stylesheet.
* @see <a
href="http://www.w3.org/TR/xslt#top-level-variables">top-level-variables in
XSLT Specification</a>
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public Enumeration getParamsComposed()
{
return m_params.elements();
}
-
+
/**
- * The "xsl:template" properties.
+ * The "xsl:template" properties.
*/
private transient TemplateList m_templateList = new TemplateList(this);
+
+ /**
+ * NEEDSDOC Method getTemplateListComposed
+ *
+ *
+ * NEEDSDOC (getTemplateListComposed) @return
+ */
public final TemplateList getTemplateListComposed()
{
return m_templateList;
}
-
+
/**
- * Aggregate the list of templates and included templates into a single
list.
+ * Aggregate the list of templates and included templates into a single
list.
* @see <a
href="http://www.w3.org/TR/xslt#section-Defining-Template-Rules">section-Defining-Template-Rules
in XSLT Specification</a>
+ *
+ * @throws SAXException
*/
- public void recomposeTemplates()
- throws SAXException
+ public void recomposeTemplates() throws SAXException
{
+
int nIncludes = getIncludeCountComposed();
- for(int k = nIncludes-1; k >= -1; k--)
+
+ for (int k = nIncludes - 1; k >= -1; k--)
{
Stylesheet included = (-1 == k) ? this : getIncludeComposed(k);
-
int n = included.getTemplateCount();
- for(int i = 0; i < n; i++)
+
+ for (int i = 0; i < n; i++)
{
m_templateList.setTemplate(included.getTemplate(i));
}
}
+
m_templateList.compose();
}
@@ -599,36 +769,50 @@
* holding off until we've made up our minds about compilation.
* ADDED 9/5/2000 to support compilation experiment
* @see <a
href="http://www.w3.org/TR/xslt#section-Defining-Template-Rules">section-Defining-Template-Rules
in XSLT Specification</a>
+ *
+ * NEEDSDOC @param flushFirst
+ *
+ * @throws SAXException
*/
- public void recomposeTemplates(boolean flushFirst)
- throws SAXException
+ public void recomposeTemplates(boolean flushFirst) throws SAXException
{
- if(flushFirst)
- m_templateList = new TemplateList(this);
+
+ if (flushFirst)
+ m_templateList = new TemplateList(this);
+
recomposeTemplates();
}
/**
- * Get an "xsl:template" property by node match. This looks in the imports
as
+ * Get an "xsl:template" property by node match. This looks in the imports
as
* well as this stylesheet.
* @see <a
href="http://www.w3.org/TR/xslt#section-Defining-Template-Rules">section-Defining-Template-Rules
in XSLT Specification</a>
- */
- public ElemTemplate getTemplateComposed(XPathContext support,
- Node targetNode,
- QName mode,
- boolean quietConflictWarnings)
- throws SAXException
- {
- return m_templateList.getTemplate(support,
- targetNode,
- mode,
+ *
+ * NEEDSDOC @param support
+ * NEEDSDOC @param targetNode
+ * NEEDSDOC @param mode
+ * NEEDSDOC @param quietConflictWarnings
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws SAXException
+ */
+ public ElemTemplate getTemplateComposed(
+ XPathContext support, Node targetNode, QName mode, boolean
quietConflictWarnings)
+ throws SAXException
+ {
+ return m_templateList.getTemplate(support, targetNode, mode,
quietConflictWarnings);
}
/**
- * Get an "xsl:template" property. This looks in the imports as
+ * Get an "xsl:template" property. This looks in the imports as
* well as this stylesheet.
* @see <a
href="http://www.w3.org/TR/xslt#section-Defining-Template-Rules">section-Defining-Template-Rules
in XSLT Specification</a>
+ *
+ * NEEDSDOC @param qname
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public ElemTemplate getTemplateComposed(QName qname)
{
@@ -642,52 +826,64 @@
private transient Hashtable m_namespaceAliasComposed;
/**
- * Recompose the attribute-set decls from this stylesheet and
+ * Recompose the attribute-set decls from this stylesheet and
* all stylesheets within import precedence.
*/
void recomposeNamespaceAliases()
{
+
m_namespaceAliasComposed = new Hashtable();
-
+
// Loop for this stylesheet and all stylesheets included or of lower
// import precidence.
int nImports = getImportCountComposed();
- for(int i = -1; i < nImports; i++)
+
+ for (int i = -1; i < nImports; i++)
{
StylesheetComposed stylesheet = (i < 0) ? this : getImportComposed(i);
+
// Does this stylesheet contain it?
int nNSA = stylesheet.getNamespaceAliasCount();
- for(int nsaIndex = 0; nsaIndex < nNSA; nsaIndex++)
+
+ for (int nsaIndex = 0; nsaIndex < nNSA; nsaIndex++)
{
NamespaceAlias nsAlias = stylesheet.getNamespaceAlias(nsaIndex);
- m_namespaceAliasComposed.put(nsAlias.getStylesheetPrefix(),
- nsAlias.getResultPrefix());
+
+ m_namespaceAliasComposed.put(nsAlias.getStylesheetPrefix(),
+ nsAlias.getResultPrefix());
}
-
+
// Do the included stylesheets contain it?
int nIncludes = stylesheet.getIncludeCountComposed();
- for(int k = 0; k < nIncludes; k++)
+
+ for (int k = 0; k < nIncludes; k++)
{
Stylesheet included = stylesheet.getIncludeComposed(k);
+
nNSA = included.getNamespaceAliasCount();
- for(int nsaIndex = 0; nsaIndex < nNSA; nsaIndex++)
+
+ for (int nsaIndex = 0; nsaIndex < nNSA; nsaIndex++)
{
NamespaceAlias nsAlias = included.getNamespaceAlias(nsaIndex);
- m_namespaceAliasComposed.put(nsAlias.getStylesheetPrefix(),
- nsAlias.getResultPrefix());
+
+ m_namespaceAliasComposed.put(nsAlias.getStylesheetPrefix(),
+ nsAlias.getResultPrefix());
}
}
}
}
/**
- * Get the "xsl:namespace-alias" property.
+ * Get the "xsl:namespace-alias" property.
* Return the alias namespace uri for a given namespace uri if one is
found.
* @see <a
href="http://www.w3.org/TR/xslt#literal-result-element">literal-result-element
in XSLT Specification</a>
+ *
+ * NEEDSDOC @param uri
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public String getNamespaceAliasComposed(String uri)
{
- return (String)m_namespaceAliasComposed.get(uri);
+ return (String) m_namespaceAliasComposed.get(uri);
}
-
}
1.14 +188 -111
xml-xalan/java/src/org/apache/xalan/templates/StylesheetRoot.java
Index: StylesheetRoot.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/StylesheetRoot.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- StylesheetRoot.java 2000/10/17 19:08:40 1.13
+++ StylesheetRoot.java 2000/10/30 18:50:06 1.14
@@ -2,7 +2,7 @@
* The Apache Software License, Version 1.1
*
*
- * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -10,7 +10,7 @@
* are met:
*
* 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
+ * notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
@@ -18,7 +18,7 @@
* distribution.
*
* 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
+ * if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
@@ -26,7 +26,7 @@
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
- * software without prior written permission. For written
+ * software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
@@ -57,14 +57,17 @@
package org.apache.xalan.templates;
import org.w3c.dom.*;
+
import java.util.*;
+
import java.net.MalformedURLException;
+
import java.io.*;
+
import org.xml.sax.*;
import org.xml.sax.helpers.*;
import org.apache.serialize.*;
-
import org.apache.xalan.utils.*;
import org.apache.xpath.*;
import org.apache.xpath.compiler.XPathParser;
@@ -80,106 +83,120 @@
* <meta name="usage" content="general"/>
* This class represents the root object of the stylesheet tree.
*/
-public class StylesheetRoot
- extends StylesheetComposed
- implements java.io.Serializable, Templates
+public class StylesheetRoot extends StylesheetComposed
+ implements java.io.Serializable, Templates
{
+
/**
* Uses an XSL stylesheet document.
* @param transformer The XSLTProcessor implementation.
* @param baseIdentifier The file name or URL for the XSL stylesheet.
* @exception ProcessorException if the baseIdentifier can not be resolved
to a URL.
*/
- public StylesheetRoot()
- throws ProcessorException
+ public StylesheetRoot() throws ProcessorException
{
+
super(null);
+
setStylesheetRoot(this);
+
try
{
+ m_selectDefault = new XPath("node()", this, this, XPath.SELECT);
+
initDefaultRule();
}
- catch(SAXException se)
+ catch (SAXException se)
{
throw new ProcessorException("Can't init default templates!", se);
}
}
-
+
/**
* Tell if this is the root of the stylesheet tree.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public boolean isRoot()
{
return true;
}
-
-
+
//============== Templates Interface ================
-
+
/**
* Create a new transformation context for this Templates object.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public Transformer newTransformer()
{
return new TransformerImpl(this);
}
-
+
/**
- * Get the properties for xsl:output. The object returned will
- * be a clone of the internal values, and thus it can be mutated
- * without mutating the Templates object, and then handed in to
+ * Get the properties for xsl:output. The object returned will
+ * be a clone of the internal values, and thus it can be mutated
+ * without mutating the Templates object, and then handed in to
* the process method.
- * <p>A stylesheet may contain multiple xsl:output elements and may
- * include or import stylesheets that also contain xsl:output elements.
- * All the xsl:output elements occurring in a stylesheet are merged
- * into a single effective xsl:output element. For the
- * cdata-section-elements attribute, the effective value is the
- * union of the specified values. For other attributes, the effective
- * value is the specified value with the highest import precedence.
- * It is an error if there is more than one such value for an attribute.
- * An XSLT processor may signal the error; if it does not signal the
- * error, if should recover by using the value that occurs last in
- * the stylesheet. The values of attributes are defaulted after
- * the xsl:output elements have been merged; different output
+ * <p>A stylesheet may contain multiple xsl:output elements and may
+ * include or import stylesheets that also contain xsl:output elements.
+ * All the xsl:output elements occurring in a stylesheet are merged
+ * into a single effective xsl:output element. For the
+ * cdata-section-elements attribute, the effective value is the
+ * union of the specified values. For other attributes, the effective
+ * value is the specified value with the highest import precedence.
+ * It is an error if there is more than one such value for an attribute.
+ * An XSLT processor may signal the error; if it does not signal the
+ * error, if should recover by using the value that occurs last in
+ * the stylesheet. The values of attributes are defaulted after
+ * the xsl:output elements have been merged; different output
* methods may have different default values for an attribute.</p>
* @see <a href="http://www.w3.org/TR/xslt#output">output in XSLT
Specification</a>
* @return A OutputProperties object that may be mutated.
- *
+ *
* @see org.xml.org.apache.serialize.OutputFormat
*/
public OutputFormat getOutputFormat()
{
+
OutputFormatExtended cloned = new OutputFormatExtended();
- if(m_outputFormatComposed instanceof OutputFormatExtended)
+
+ if (m_outputFormatComposed instanceof OutputFormatExtended)
{
- cloned.copyFrom((OutputFormatExtended)m_outputFormatComposed);
+ cloned.copyFrom((OutputFormatExtended) m_outputFormatComposed);
}
else
{
cloned.copyFrom(m_outputFormatComposed);
}
+
return cloned;
}
//============== End Templates Interface ================
-
+
/**
- * Recompose the values of all "composed" properties, meaning
- * properties that need to be combined or calculated from
+ * Recompose the values of all "composed" properties, meaning
+ * properties that need to be combined or calculated from
* the combination of imported and included stylesheets.
+ *
+ * @throws SAXException
*/
- public void recompose()
- throws SAXException
+ public void recompose() throws SAXException
{
+
recomposeImports();
recomposeOutput();
-
+
int n = getGlobalImportCount();
- for(int i = 0; i < n; i++)
+
+ for (int i = 0; i < n; i++)
{
StylesheetComposed sheet = getGlobalImport(i);
- if(sheet != this) // already done
- {
+
+ if (sheet != this) // already done
+ {
sheet.recomposeImports();
sheet.recomposeIncludes(sheet);
sheet.recomposeAttributeSets();
@@ -191,7 +208,8 @@
sheet.recomposeVariables();
sheet.recomposeWhiteSpaceInfo();
}
- }
+ }
+
recomposeIncludes(this);
recomposeAttributeSets();
recomposeDecimalFormats();
@@ -201,212 +219,254 @@
recomposeTemplates();
recomposeVariables();
recomposeWhiteSpaceInfo();
-
composeTemplates(this);
}
-
+
/**
* Call the compose function for each ElemTemplateElement.
+ *
+ * NEEDSDOC @param templ
*/
void composeTemplates(ElemTemplateElement templ)
{
+
templ.compose();
- for(ElemTemplateElement child = templ.getFirstChildElem();
- child != null; child = child.getNextSiblingElem())
+
+ for (ElemTemplateElement child = templ.getFirstChildElem();
+ child != null; child = child.getNextSiblingElem())
{
composeTemplates(child);
}
}
-
+
/**
- * This will be set up with the default values, and then the values
+ * This will be set up with the default values, and then the values
* will be set as stylesheets are encountered.
*/
private OutputFormat m_outputFormatComposed;
/**
- * Get the combined "xsl:output" property with the properties
- * combined from the included stylesheets. If a xsl:output
- * is not declared in this stylesheet or an included stylesheet,
- * look in the imports.
+ * Get the combined "xsl:output" property with the properties
+ * combined from the included stylesheets. If a xsl:output
+ * is not declared in this stylesheet or an included stylesheet,
+ * look in the imports.
* Please note that this returns a reference to the OutputFormat
* object, not a cloned object, like getOutputFormat does.
* @see <a href="http://www.w3.org/TR/xslt#output">output in XSLT
Specification</a>
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public OutputFormat getOutputComposed()
{
+
// System.out.println("getOutputComposed.getIndent:
"+m_outputFormatComposed.getIndent());
// System.out.println("getOutputComposed.getIndenting:
"+m_outputFormatComposed.getIndenting());
return m_outputFormatComposed;
}
-
+
/**
* Recompose the output format object from the included elements.
*/
public void recomposeOutput()
{
+
// System.out.println("Recomposing output...");
m_outputFormatComposed = new OutputFormatExtended();
+
m_outputFormatComposed.setPreserveSpace(true);
recomposeOutput(this);
}
-
-
+
/**
* Recompose the output format object from the included elements.
+ *
+ * NEEDSDOC @param stylesheet
*/
private void recomposeOutput(Stylesheet stylesheet)
{
+
// Get the direct imports of this sheet.
int n = stylesheet.getImportCount();
- if(n > 0)
+
+ if (n > 0)
{
- for(int i = 0; i < n; i++)
+ for (int i = 0; i < n; i++)
{
Stylesheet imported = stylesheet.getImport(i);
+
recomposeOutput(imported);
}
}
-
+
n = stylesheet.getIncludeCount();
- if(n > 0)
+
+ if (n > 0)
{
- for(int i = 0; i < n; i++)
+ for (int i = 0; i < n; i++)
{
Stylesheet included = stylesheet.getInclude(i);
+
recomposeOutput(included);
}
}
-
+
OutputFormatExtended of = getOutput();
- if(null != of)
+
+ if (null != of)
{
- ((OutputFormatExtended)m_outputFormatComposed).copyFrom(of);
+ ((OutputFormatExtended) m_outputFormatComposed).copyFrom(of);
}
}
-
+ /** NEEDSDOC Field m_outputMethodSet */
private boolean m_outputMethodSet = false;
/**
* <meta name="usage" content="internal"/>
* Find out if an output method has been set by the user.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public boolean isOutputMethodSet()
{
return m_outputMethodSet;
}
-
+
/**
* The combined list of imports.
*/
private transient Vector m_globalImportList;
-
+
/**
* Add the imports in the given sheet to the m_globalImportList
- * list. The will be added from highest import precedence to
+ * list. The will be added from highest import precedence to
* least import precidence.
+ *
+ * NEEDSDOC @param stylesheet
+ * NEEDSDOC @param addToList
*/
protected void addImports(Stylesheet stylesheet, boolean addToList)
{
+
// Get the direct imports of this sheet.
int n = stylesheet.getImportCount();
- if(n > 0)
+
+ if (n > 0)
{
- for(int i = 0; i < n; i++)
+ for (int i = 0; i < n; i++)
{
Stylesheet imported = stylesheet.getImport(i);
+
m_globalImportList.insertElementAt(imported, 0);
addImports(imported, false);
}
}
-
+
n = stylesheet.getIncludeCount();
- if(n > 0)
+
+ if (n > 0)
{
- for(int i = 0; i < n; i++)
+ for (int i = 0; i < n; i++)
{
Stylesheet included = stylesheet.getInclude(i);
+
addImports(included, false);
}
}
- if(addToList)
+
+ if (addToList)
m_globalImportList.insertElementAt(stylesheet, 0);
}
-
+
/**
- * Recompose the value of the composed import list. This
+ * Recompose the value of the composed import list. This
* means any stylesheets of lesser import precidence.
* <p>For example, suppose</p>
* <p>stylesheet A imports stylesheets B and C in that order;</p>
* <p>stylesheet B imports stylesheet D;</p>
* <p>stylesheet C imports stylesheet E.</p>
- * <p>Then the order of import precedence (highest first) is
+ * <p>Then the order of import precedence (highest first) is
* A, C, E, B, D.</p>
*/
protected void recomposeImports()
{
- if(null == m_globalImportList)
+
+ if (null == m_globalImportList)
{
m_globalImportList = new Vector();
+
int n = getImportCount();
- for(int i = 0; i < n; i++)
+
+ for (int i = 0; i < n; i++)
{
StylesheetComposed imported = getImport(i);
+
addImports(imported, true);
}
+
n = getIncludeCount();
- for(int i = 0; i < n; i++)
+
+ for (int i = 0; i < n; i++)
{
Stylesheet included = getInclude(i);
+
addImports(included, false);
}
+
m_globalImportList.insertElementAt(this, 0);
}
+
super.recomposeImports();
}
-
+
/**
* Get a stylesheet from the global import list.
+ *
+ * NEEDSDOC @param i
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public StylesheetComposed getGlobalImport(int i)
{
- return (StylesheetComposed)m_globalImportList.elementAt(i);
+ return (StylesheetComposed) m_globalImportList.elementAt(i);
}
-
+
/**
* Get the total number of imports in the global import list.
- * @return The total number of imported stylesheets, including
- * the root stylesheet, thus the number will always be 1 or
+ * @return The total number of imported stylesheets, including
+ * the root stylesheet, thus the number will always be 1 or
* greater.
*/
public int getGlobalImportCount()
{
return m_globalImportList.size();
}
-
+
/**
- * Given a stylesheet, return the number of the stylesheet
+ * Given a stylesheet, return the number of the stylesheet
* in the global import list.
- * @param sheet The stylesheet which will be located in the
+ * @param sheet The stylesheet which will be located in the
* global import list.
* @return The index into the global import list of the given stylesheet,
* or -1 if it is not found (which should never happen).
*/
public int getImportNumber(StylesheetComposed sheet)
{
- if(this == sheet)
+
+ if (this == sheet)
return 0;
-
+
int n = getGlobalImportCount();
- for(int i = 0; i < n; i++)
+
+ for (int i = 0; i < n; i++)
{
- if(sheet == getGlobalImport(i))
+ if (sheet == getGlobalImport(i))
return i;
}
+
return -1;
}
-
+
/**
* <meta name="usage" content="advanced"/>
* The default template to use for text nodes if we don't find
@@ -414,16 +474,17 @@
* @serial
*/
private ElemTemplate m_defaultTextRule;
-
+
/**
* <meta name="usage" content="advanced"/>
* Get the default template for text.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public final ElemTemplate getDefaultTextRule()
{
return m_defaultTextRule;
}
-
/**
* <meta name="usage" content="advanced"/>
@@ -436,12 +497,14 @@
/**
* <meta name="usage" content="advanced"/>
* Get the default template for elements.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public final ElemTemplate getDefaultRule()
{
return m_defaultRule;
}
-
+
/**
* <meta name="usage" content="advanced"/>
* The default template to use for the root if we don't find
@@ -458,6 +521,8 @@
/**
* <meta name="usage" content="advanced"/>
* Get the default template for a root node.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public final ElemTemplate getDefaultRootRule()
{
@@ -465,48 +530,60 @@
}
/**
+ * Used for default selection.
+ */
+ XPath m_selectDefault;
+
+ /**
* Create the default rule if needed.
+ *
+ * @throws SAXException
*/
- private void initDefaultRule()
- throws SAXException
+ private void initDefaultRule() throws SAXException
{
+
// Then manufacture a default
m_defaultRule = new ElemTemplate();
+
m_defaultRule.setStylesheet(this);
+
XPath defMatch = new XPath("*", this, this, XPath.MATCH);
+
m_defaultRule.setMatch(defMatch);
- ElemApplyTemplates childrenElement
- = new ElemApplyTemplates();
+ ElemApplyTemplates childrenElement = new ElemApplyTemplates();
+
childrenElement.setIsDefaultTemplate(true);
m_defaultRule.appendChild(childrenElement);
// -----------------------------
-
m_defaultTextRule = new ElemTemplate();
+
m_defaultTextRule.setStylesheet(this);
-
+
defMatch = new XPath("text() | @*", this, this, XPath.MATCH);
+
m_defaultTextRule.setMatch(defMatch);
+
+ ElemValueOf elemValueOf = new ElemValueOf();
- ElemValueOf elemValueOf
- = new ElemValueOf();
m_defaultTextRule.appendChild(elemValueOf);
-
+
XPath selectPattern = new XPath(".", this, this, XPath.SELECT);
- elemValueOf.setSelect(selectPattern);
+ elemValueOf.setSelect(selectPattern);
//--------------------------------
-
m_defaultRootRule = new ElemTemplate();
+
m_defaultRootRule.setStylesheet(this);
-
+
defMatch = new XPath("/", this, this, XPath.MATCH);
+
m_defaultRootRule.setMatch(defMatch);
+
+ childrenElement = new ElemApplyTemplates();
- childrenElement
- = new ElemApplyTemplates();
childrenElement.setIsDefaultTemplate(true);
m_defaultRootRule.appendChild(childrenElement);
}
1.15 +205 -158
xml-xalan/java/src/org/apache/xalan/templates/TemplateList.java
Index: TemplateList.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/TemplateList.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- TemplateList.java 2000/10/18 20:42:32 1.14
+++ TemplateList.java 2000/10/30 18:50:06 1.15
@@ -1,59 +1,59 @@
/*
-* The Apache Software License, Version 1.1
-*
-*
-* Copyright (c) 1999 The Apache Software Foundation. All rights
-* reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions
-* are met:
-*
-* 1. Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-*
-* 2. Redistributions in binary form must reproduce the above copyright
-* notice, this list of conditions and the following disclaimer in
-* the documentation and/or other materials provided with the
-* distribution.
-*
-* 3. The end-user documentation included with the redistribution,
-* if any, must include the following acknowledgment:
-* "This product includes software developed by the
-* Apache Software Foundation (http://www.apache.org/)."
-* Alternately, this acknowledgment may appear in the software itself,
-* if and wherever such third-party acknowledgments normally appear.
-*
-* 4. The names "Xalan" and "Apache Software Foundation" must
-* not be used to endorse or promote products derived from this
-* software without prior written permission. For written
-* permission, please contact [EMAIL PROTECTED]
-*
-* 5. Products derived from this software may not be called "Apache",
-* nor may "Apache" appear in their name, without prior written
-* permission of the Apache Software Foundation.
-*
-* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
-* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
-* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-* SUCH DAMAGE.
-* ====================================================================
-*
-* This software consists of voluntary contributions made by many
-* individuals on behalf of the Apache Software Foundation and was
-* originally based on software copyright (c) 1999, Lotus
-* Development Corporation., http://www.lotus.com. For more
-* information on the Apache Software Foundation, please see
-* <http://www.apache.org/>.
-*/
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Xalan" and "Apache Software Foundation" must
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written
+ * permission, please contact [EMAIL PROTECTED]
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * nor may "Apache" appear in their name, without prior written
+ * permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation and was
+ * originally based on software copyright (c) 1999, Lotus
+ * Development Corporation., http://www.lotus.com. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.xalan.templates;
import java.util.Hashtable;
@@ -91,8 +91,9 @@
TemplateList(Stylesheet stylesheet)
{
m_stylesheet = stylesheet;
+ m_stylesheetComposed = m_stylesheet.getStylesheetComposed();
}
-
+
/**
* Add a template to the template list.
*
@@ -100,6 +101,7 @@
*/
public void setTemplate(ElemTemplate template)
{
+
int pos = 0;
if (null == m_firstTemplate)
@@ -115,15 +117,19 @@
if (null == next.m_nextSibling)
{
next.m_nextSibling = template;
- template.m_nextSibling = null; // just to play it safe.
+ template.m_nextSibling = null; // just to play it safe.
+
break;
}
else if (template.equals(next.m_nextSibling))
{
pos++;
+
break;
}
+
pos++;
+
next = next.m_nextSibling;
}
}
@@ -165,87 +171,112 @@
}
else
{
+
// TODO: assert error
}
}
}
-
+
+ /** NEEDSDOC Field DEBUG */
boolean DEBUG = false;
-
+
+ /**
+ * NEEDSDOC Method dumpAssociationTables
+ *
+ */
void dumpAssociationTables()
{
+
Enumeration associations = m_patternTable.elements();
- while(associations.hasMoreElements())
+
+ while (associations.hasMoreElements())
{
- TemplateSubPatternAssociation head
- = (TemplateSubPatternAssociation)associations.nextElement();
- while(null != head)
+ TemplateSubPatternAssociation head =
+ (TemplateSubPatternAssociation) associations.nextElement();
+
+ while (null != head)
{
- System.out.print("("+head.getTargetString()+",
"+head.getPattern()+")");
+ System.out.print("(" + head.getTargetString() + ", "
+ + head.getPattern() + ")");
+
head = head.getNext();
}
+
System.out.println("\n.....");
}
+
TemplateSubPatternAssociation head = m_wildCardPatterns;
+
System.out.print("wild card list: ");
- while(null != head)
+
+ while (null != head)
{
- System.out.print("("+head.getTargetString()+",
"+head.getPattern()+")");
+ System.out.print("(" + head.getTargetString() + ", "
+ + head.getPattern() + ")");
+
head = head.getNext();
}
+
System.out.println("\n.....");
}
-
+
/**
* After all templates have been added, this function
* should be called.
*/
public void compose()
{
- if(DEBUG)
+
+ if (DEBUG)
{
System.out.println("Before wildcard insert...");
dumpAssociationTables();
}
-
- if(null != m_wildCardPatterns)
+
+ if (null != m_wildCardPatterns)
{
Enumeration associations = m_patternTable.elements();
- while(associations.hasMoreElements())
+
+ while (associations.hasMoreElements())
{
- TemplateSubPatternAssociation head
- = (TemplateSubPatternAssociation)associations.nextElement();
+ TemplateSubPatternAssociation head =
+ (TemplateSubPatternAssociation) associations.nextElement();
TemplateSubPatternAssociation wild = m_wildCardPatterns;
- while(null != wild)
+
+ while (null != wild)
{
try
{
- insertAssociationIntoList(head,
-
(TemplateSubPatternAssociation)wild.clone(), true);
+ insertAssociationIntoList(
+ head, (TemplateSubPatternAssociation) wild.clone(), true);
}
- catch(CloneNotSupportedException cnse){}
+ catch (CloneNotSupportedException cnse){}
+
wild = wild.getNext();
}
}
}
- if(DEBUG)
+
+ if (DEBUG)
{
System.out.println("After wildcard insert...");
dumpAssociationTables();
}
}
-
+
/**
* Insert the given TemplateSubPatternAssociation into the the linked
* list. Sort by priority first, then by document order.
*
* @param head
* @param item
+ * NEEDSDOC @param isWildCardInsert
*/
private void insertAssociationIntoList(TemplateSubPatternAssociation head,
TemplateSubPatternAssociation item,
boolean isWildCardInsert)
{
+
// Sort by priority first, then by document order.
double priority = getPriorityOrScore(item);
TemplateSubPatternAssociation next;
@@ -259,12 +290,14 @@
// System.out.println("appending: "+target+" to "+matchPat.getPattern());
// This check is just to catch the first template in the list
// It's priority was not checked against the new template
- if(isWildCardInsert)
+ if (isWildCardInsert)
{
if ((getPriorityOrScore(head) < priority))
{
item.setNext(head);
+
String key = head.getTargetString();
+
item.setTargetString(key);
putHead(key, item);
}
@@ -279,7 +312,8 @@
if ((getPriorityOrScore(head) <= priority))
{
item.setNext(head);
- if(head.isWild() || item.isWild())
+
+ if (head.isWild() || item.isWild())
m_wildCardPatterns = item;
else
putHead(item.getTargetString(), item);
@@ -299,9 +333,10 @@
* @param template
* @param pos
*/
- private void insertPatternInTable(StepPattern pattern, ElemTemplate
template,
- int pos)
+ private void insertPatternInTable(StepPattern pattern,
+ ElemTemplate template, int pos)
{
+
String target = pattern.getTargetString();
if (null != target)
@@ -342,6 +377,7 @@
*/
private double getPriorityOrScore(TemplateSubPatternAssociation matchPat)
{
+
double priority = matchPat.getTemplate().getPriority();
if (priority == XPath.MATCH_SCORE_NONE)
@@ -373,7 +409,7 @@
if (null == namedTemplate)
{
- StylesheetComposed stylesheet =
getStylesheet().getStylesheetComposed();
+ StylesheetComposed stylesheet = m_stylesheetComposed;
int n = stylesheet.getImportCountComposed();
for (int i = 0; i < n; i++)
@@ -388,7 +424,7 @@
}
}
}
-
+
return namedTemplate;
}
@@ -403,47 +439,48 @@
TemplateSubPatternAssociation getHead(XPathContext xctxt, Node targetNode)
{
- int targetNodeType = targetNode.getNodeType();
+ short targetNodeType = targetNode.getNodeType();
TemplateSubPatternAssociation head;
switch (targetNodeType)
{
-
- case Node.PROCESSING_INSTRUCTION_NODE :
- case Node.ATTRIBUTE_NODE :
case Node.ELEMENT_NODE :
- {
- String targetName =
xctxt.getDOMHelper().getLocalNameOfNode(targetNode);
- head = getHead(targetName);
- }
- break;
-
- case Node.CDATA_SECTION_NODE :
+ case Node.ATTRIBUTE_NODE :
+ head = (TemplateSubPatternAssociation) m_patternTable.get(
+ xctxt.getDOMHelper().getLocalNameOfNode(targetNode));
+ break;
case Node.TEXT_NODE :
- head = getHead(PsuedoNames.PSEUDONAME_TEXT);
+ case Node.CDATA_SECTION_NODE :
+ head = m_textPatterns;
break;
-
+ case Node.ENTITY_REFERENCE_NODE :
+ case Node.ENTITY_NODE :
+ head = (TemplateSubPatternAssociation) m_patternTable.get(
+ targetNode.getNodeName());
+ break;
+ case Node.PROCESSING_INSTRUCTION_NODE :
+ head = (TemplateSubPatternAssociation) m_patternTable.get(
+ xctxt.getDOMHelper().getLocalNameOfNode(targetNode));
+ break;
case Node.COMMENT_NODE :
- head = getHead(PsuedoNames.PSEUDONAME_COMMENT);
+ head = m_commentPatterns;
break;
-
case Node.DOCUMENT_NODE :
- head = getHead(PsuedoNames.PSEUDONAME_ROOT);
+ head = m_docPatterns;
break;
-
case Node.DOCUMENT_FRAGMENT_NODE :
- head = getHead(PsuedoNames.PSEUDONAME_ANY);
+ head = (TemplateSubPatternAssociation) m_patternTable.get(
+ PsuedoNames.PSEUDONAME_ANY);
break;
-
+ case Node.NOTATION_NODE :
default :
- head = getHead(targetNode.getNodeName());
+ head = (TemplateSubPatternAssociation) m_patternTable.get(
+ targetNode.getNodeName());
}
- if(null == head)
- head = m_wildCardPatterns;
- return head;
+ return (null == head) ? m_wildCardPatterns : head;
}
-
+
/**
* Given a target element, find the template that best
* matches in the given XSL document, according
@@ -463,58 +500,68 @@
* @throws SAXException
*/
public ElemTemplate getTemplate(
- XPathContext xctxt, Node targetNode,
- QName mode, boolean quietConflictWarnings)
+ XPathContext xctxt, Node targetNode, QName mode, boolean
quietConflictWarnings)
throws SAXException
- {
+ {
+
TemplateSubPatternAssociation head = getHead(xctxt, targetNode);
- if(null != head)
+ if (null != head)
{
try
{
xctxt.pushCurrentNodeAndExpression(targetNode, targetNode);
+
do
{
- if((head.m_stepPattern.execute(xctxt) != NodeTest.SCORE_NONE)
- && head.matchMode(mode))
+ if ((head.m_stepPattern.execute(xctxt) != NodeTest.SCORE_NONE)
+ && head.matchMode(mode))
{
- if(quietConflictWarnings)
+ if (quietConflictWarnings)
checkConflicts(head, xctxt, targetNode, mode);
+
return head.getTemplate();
}
- head = head.getNext();
}
- while (null != head);
+ while (null != (head = head.getNext()));
}
finally
{
xctxt.popCurrentNodeAndExpression();
}
}
-
- StylesheetComposed stylesheet = getStylesheet().getStylesheetComposed();
- int n = stylesheet.getImportCountComposed();
- for(int i = 0; i < n; i++)
- {
- StylesheetComposed imported = stylesheet.getImportComposed(i);
- ElemTemplate t = getTemplate(imported, xctxt, targetNode, mode,
- quietConflictWarnings);
- if(null != t)
- return t;
+
+ int n = m_stylesheetComposed.getImportCountComposed();
+
+ if (0 != n)
+ {
+ for (int i = 0; i < n; i++)
+ {
+ StylesheetComposed imported =
+ m_stylesheetComposed.getImportComposed(i);
+ ElemTemplate t = getTemplate(imported, xctxt, targetNode, mode,
+ quietConflictWarnings);
+
+ if (null != t)
+ return t;
+ }
}
-
+
return null;
-
- } // end findTemplate
-
+ } // end findTemplate
+
/**
* Check for match conflicts, and warn the stylesheet author.
+ *
+ * NEEDSDOC @param head
+ * NEEDSDOC @param xctxt
+ * NEEDSDOC @param targetNode
+ * NEEDSDOC @param mode
*/
private void checkConflicts(TemplateSubPatternAssociation head,
- XPathContext xctxt, Node targetNode,
- QName mode)
+ XPathContext xctxt, Node targetNode, QName
mode)
{
+
// TODO: Check for conflicts.
}
@@ -573,6 +620,9 @@
*/
private Stylesheet m_stylesheet;
+ /** NEEDSDOC Field m_stylesheetComposed */
+ private StylesheetComposed m_stylesheetComposed;
+
/**
* Get the stylesheet owner of the list.
*
@@ -606,7 +656,7 @@
* findNamedTemplate.
* @serial
*/
- private Hashtable m_namedTemplates = new Hashtable();
+ private Hashtable m_namedTemplates = new Hashtable(89);
/**
* This table is keyed on the target elements
@@ -615,9 +665,20 @@
* to some degree of specifity.
* @serial
*/
- private Hashtable m_patternTable = new Hashtable();
+ private Hashtable m_patternTable = new Hashtable(89);
+
+ /** NEEDSDOC Field m_wildCardPatterns */
private TemplateSubPatternAssociation m_wildCardPatterns = null;
+ /** NEEDSDOC Field m_textPatterns */
+ private TemplateSubPatternAssociation m_textPatterns = null;
+
+ /** NEEDSDOC Field m_docPatterns */
+ private TemplateSubPatternAssociation m_docPatterns = null;
+
+ /** NEEDSDOC Field m_commentPatterns */
+ private TemplateSubPatternAssociation m_commentPatterns = null;
+
/**
* Get table of named Templates.
* These are keyed on string macro names, and holding values
@@ -643,27 +704,6 @@
}
/**
- * Given an element type, locate the start of a linked list of
- * possible template matches.
- *
- * @param sourceElementType
- * @param tryWildCard
- *
- * @return The head of a list of potentially matching
- * StepPattern-to-Template associations.
- */
- private TemplateSubPatternAssociation locateHead(String sourceElementType,
- boolean tryWildCard)
- {
-
- TemplateSubPatternAssociation startMatchList =
getHead(sourceElementType);
-
- return ((null == startMatchList) && tryWildCard)
- ? m_wildCardPatterns
- : startMatchList;
- }
-
- /**
* Get the head of the assocation list that is keyed by target.
*
* @param key
@@ -683,7 +723,14 @@
*/
private void putHead(String key, TemplateSubPatternAssociation assoc)
{
+
+ if (key.equals(PsuedoNames.PSEUDONAME_TEXT))
+ m_textPatterns = assoc;
+ else if (key.equals(PsuedoNames.PSEUDONAME_ROOT))
+ m_docPatterns = assoc;
+ else if (key.equals(PsuedoNames.PSEUDONAME_COMMENT))
+ m_commentPatterns = assoc;
+
m_patternTable.put(key, assoc);
}
-
}
1.4 +115 -70
xml-xalan/java/src/org/apache/xalan/templates/TemplateSubPatternAssociation.java
Index: TemplateSubPatternAssociation.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/TemplateSubPatternAssociation.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- TemplateSubPatternAssociation.java 2000/10/18 20:42:32 1.3
+++ TemplateSubPatternAssociation.java 2000/10/30 18:50:07 1.4
@@ -1,83 +1,98 @@
/*
-* The Apache Software License, Version 1.1
-*
-*
-* Copyright (c) 1999 The Apache Software Foundation. All rights
-* reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions
-* are met:
-*
-* 1. Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-*
-* 2. Redistributions in binary form must reproduce the above copyright
-* notice, this list of conditions and the following disclaimer in
-* the documentation and/or other materials provided with the
-* distribution.
-*
-* 3. The end-user documentation included with the redistribution,
-* if any, must include the following acknowledgment:
-* "This product includes software developed by the
-* Apache Software Foundation (http://www.apache.org/)."
-* Alternately, this acknowledgment may appear in the software itself,
-* if and wherever such third-party acknowledgments normally appear.
-*
-* 4. The names "Xalan" and "Apache Software Foundation" must
-* not be used to endorse or promote products derived from this
-* software without prior written permission. For written
-* permission, please contact [EMAIL PROTECTED]
-*
-* 5. Products derived from this software may not be called "Apache",
-* nor may "Apache" appear in their name, without prior written
-* permission of the Apache Software Foundation.
-*
-* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
-* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
-* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-* SUCH DAMAGE.
-* ====================================================================
-*
-* This software consists of voluntary contributions made by many
-* individuals on behalf of the Apache Software Foundation and was
-* originally based on software copyright (c) 1999, Lotus
-* Development Corporation., http://www.lotus.com. For more
-* information on the Apache Software Foundation, please see
-* <http://www.apache.org/>.
-*/
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Xalan" and "Apache Software Foundation" must
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written
+ * permission, please contact [EMAIL PROTECTED]
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * nor may "Apache" appear in their name, without prior written
+ * permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation and was
+ * originally based on software copyright (c) 1999, Lotus
+ * Development Corporation., http://www.lotus.com. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.xalan.templates;
import java.io.Serializable;
import org.w3c.dom.Node;
+
import org.xml.sax.SAXException;
import org.apache.xpath.XPath;
import org.apache.xpath.XPathContext;
import org.apache.xpath.patterns.StepPattern;
import org.apache.xalan.utils.QName;
-
+
/**
* A class to contain a match pattern and it's corresponding template.
* This class also defines a node in a match pattern linked list.
*/
class TemplateSubPatternAssociation implements Serializable, Cloneable
{
+
+ /** NEEDSDOC Field m_stepPattern */
StepPattern m_stepPattern;
+
+ /** NEEDSDOC Field m_posInStylesheet */
private int m_posInStylesheet;
+
+ /** NEEDSDOC Field m_pattern */
private String m_pattern;
+
+ /** NEEDSDOC Field m_template */
private ElemTemplate m_template;
- private TemplateSubPatternAssociation m_next = null;
+
+ /** NEEDSDOC Field m_next */
+ private TemplateSubPatternAssociation m_next = null;
+
+ /** NEEDSDOC Field m_wild */
private boolean m_wild;
+
+ /** NEEDSDOC Field m_targetString */
private String m_targetString;
/**
@@ -90,6 +105,7 @@
TemplateSubPatternAssociation(ElemTemplate template, StepPattern pattern,
String pat, int posInStylesheet)
{
+
m_pattern = pat;
m_template = template;
m_posInStylesheet = posInStylesheet;
@@ -97,20 +113,25 @@
m_targetString = m_stepPattern.getTargetString();
m_wild = m_targetString.equals("*");
}
-
+
/**
* Clone this object.
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws CloneNotSupportedException
*/
- public Object clone()
- throws CloneNotSupportedException
+ public Object clone() throws CloneNotSupportedException
{
- TemplateSubPatternAssociation tspa
- = (TemplateSubPatternAssociation)super.clone();
+
+ TemplateSubPatternAssociation tspa =
+ (TemplateSubPatternAssociation) super.clone();
+
tspa.m_next = null;
+
return tspa;
}
-
/**
* Get the target string of the pattern. For instance, if the pattern is
* "foo/baz/[EMAIL PROTECTED]", this string will be "boo".
@@ -121,22 +142,37 @@
{
return m_targetString;
}
-
+
+ /**
+ * NEEDSDOC Method setTargetString
+ *
+ *
+ * NEEDSDOC @param key
+ */
public void setTargetString(String key)
{
m_targetString = key;
}
-
+
/**
* Tell if two modes match according to the rules of XSLT.
+ *
+ * NEEDSDOC @param m1
+ *
+ * NEEDSDOC ($objectName$) @return
*/
boolean matchMode(QName m1)
{
return matchModes(m1, m_template.getMode());
}
-
+
/**
* Tell if two modes match according to the rules of XSLT.
+ *
+ * NEEDSDOC @param m1
+ * NEEDSDOC @param m2
+ *
+ * NEEDSDOC ($objectName$) @return
*/
private boolean matchModes(QName m1, QName m2)
{
@@ -147,13 +183,22 @@
/**
* Return the mode associated with the template.
*
+ *
+ * NEEDSDOC @param xctxt
+ * NEEDSDOC @param targetNode
+ * NEEDSDOC @param mode
* @return The mode associated with the template.
+ *
+ * @throws SAXException
*/
public boolean matches(XPathContext xctxt, Node targetNode, QName mode)
- throws SAXException
+ throws SAXException
{
+
double score = m_stepPattern.getMatchScore(xctxt, targetNode);
- return (XPath.MATCH_SCORE_NONE != score) && matchModes(mode,
m_template.getMode());
+
+ return (XPath.MATCH_SCORE_NONE != score)
+ && matchModes(mode, m_template.getMode());
}
/**
@@ -222,8 +267,8 @@
/**
* Set the next element on this association
- * list, which should be equal or less in priority to
- * this association, and, if equal priority, should occur
+ * list, which should be equal or less in priority to
+ * this association, and, if equal priority, should occur
* before this template in document order.
*
* @param mp The next association to score if this one fails.
1.3 +21 -8
xml-xalan/java/src/org/apache/xalan/templates/WhiteSpaceInfo.java
Index: WhiteSpaceInfo.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/WhiteSpaceInfo.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- WhiteSpaceInfo.java 2000/07/05 14:40:32 1.2
+++ WhiteSpaceInfo.java 2000/10/30 18:50:07 1.3
@@ -8,13 +8,13 @@
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
+ * the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
@@ -59,27 +59,40 @@
import org.apache.xpath.XPath;
/**
- * This is used as a special "fake" template that can be
- * handled by the TemplateList to do pattern matching
+ * This is used as a special "fake" template that can be
+ * handled by the TemplateList to do pattern matching
* on nodes.
*/
public class WhiteSpaceInfo extends ElemTemplate
{
+
+ /** NEEDSDOC Field m_shouldStripSpace */
private boolean m_shouldStripSpace;
-
+
/**
- * Return true if this element specifies that the node that
- * matches the match pattern should be stripped, otherwise
+ * Return true if this element specifies that the node that
+ * matches the match pattern should be stripped, otherwise
* the space should be preserved.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public boolean getShouldStripSpace()
{
return m_shouldStripSpace;
}
-
+
+ /**
+ * Constructor WhiteSpaceInfo
+ *
+ *
+ * NEEDSDOC @param matchPattern
+ * NEEDSDOC @param shouldStripSpace
+ */
WhiteSpaceInfo(XPath matchPattern, boolean shouldStripSpace)
{
+
m_shouldStripSpace = shouldStripSpace;
+
setMatch(matchPattern);
}
}
1.3 +80 -10
xml-xalan/java/src/org/apache/xalan/templates/WhitespaceList.java
Index: WhitespaceList.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/WhitespaceList.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- WhitespaceList.java 2000/07/05 14:40:34 1.2
+++ WhitespaceList.java 2000/10/30 18:50:08 1.3
@@ -1,15 +1,80 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Xalan" and "Apache Software Foundation" must
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written
+ * permission, please contact [EMAIL PROTECTED]
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * nor may "Apache" appear in their name, without prior written
+ * permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation and was
+ * originally based on software copyright (c) 1999, Lotus
+ * Development Corporation., http://www.lotus.com. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.xalan.templates;
import org.apache.xpath.XPathContext;
import org.apache.xalan.utils.QName;
+
import org.w3c.dom.Node;
import org.w3c.dom.Element;
+
import org.xml.sax.SAXException;
+/**
+ * <meta name="usage" content="internal"/>
+ * NEEDSDOC Class WhitespaceList <needs-comment/>
+ */
public class WhitespaceList extends TemplateList
{
+
/**
* Construct a TemplateList object.
+ *
+ * NEEDSDOC @param stylesheet
*/
WhitespaceList(Stylesheet stylesheet)
{
@@ -17,18 +82,23 @@
}
/**
- * For derived classes to override which method gets accesed to
+ * For derived classes to override which method gets accesed to
* get the imported template.
+ *
+ * NEEDSDOC @param imported
+ * NEEDSDOC @param support
+ * NEEDSDOC @param targetNode
+ * NEEDSDOC @param mode
+ * NEEDSDOC @param quietConflictWarnings
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws SAXException
*/
- protected ElemTemplate getTemplate(StylesheetComposed imported,
- XPathContext support,
- Node targetNode,
- QName mode,
- boolean quietConflictWarnings)
- throws SAXException
+ protected ElemTemplate getTemplate(
+ StylesheetComposed imported, XPathContext support, Node
targetNode, QName mode, boolean quietConflictWarnings)
+ throws SAXException
{
- return imported.getWhiteSpaceInfo(support,
- (Element)targetNode);
+ return imported.getWhiteSpaceInfo(support, (Element) targetNode);
}
-
}
1.3 +79 -10
xml-xalan/java/src/org/apache/xalan/templates/XMLNSDecl.java
Index: XMLNSDecl.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/templates/XMLNSDecl.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XMLNSDecl.java 2000/10/23 15:23:50 1.2
+++ XMLNSDecl.java 2000/10/30 18:50:08 1.3
@@ -1,3 +1,59 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 1999 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Xalan" and "Apache Software Foundation" must
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written
+ * permission, please contact [EMAIL PROTECTED]
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * nor may "Apache" appear in their name, without prior written
+ * permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation and was
+ * originally based on software copyright (c) 1999, Lotus
+ * Development Corporation., http://www.lotus.com. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
package org.apache.xalan.templates;
/**
@@ -6,46 +62,59 @@
public class XMLNSDecl
implements java.io.Serializable // 20001009 jkess
{
-
+
+ /**
+ * Constructor XMLNSDecl
+ *
+ *
+ * NEEDSDOC @param prefix
+ * NEEDSDOC @param uri
+ * NEEDSDOC @param isExcluded
+ */
public XMLNSDecl(String prefix, String uri, boolean isExcluded)
{
+
m_prefix = prefix;
m_uri = uri;
m_isExcluded = isExcluded;
}
-
+
+ /** NEEDSDOC Field m_prefix */
private String m_prefix;
/**
* Return the prefix.
- * @return The prefix that is associated with this URI, or null
+ * @return The prefix that is associated with this URI, or null
* if the XMLNSDecl is declaring the default namespace.
*/
- public String getPrefix ()
+ public String getPrefix()
{
return m_prefix;
}
-
+
+ /** NEEDSDOC Field m_uri */
private String m_uri;
/**
* Return the URI.
* @return The URI that is associated with this declaration.
*/
- public String getURI ()
+ public String getURI()
{
return m_uri;
}
-
+
+ /** NEEDSDOC Field m_isExcluded */
private boolean m_isExcluded;
-
+
/**
- * Tell if this declaration should be excluded from the
+ * Tell if this declaration should be excluded from the
* result namespace.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public boolean getIsExcluded()
{
return m_isExcluded;
}
-
}