sboag 00/10/30 10:41:03
Modified: java/src/org/apache/xalan/processor
CompilingStylesheetProcessor.java
ProcessorAttributeSet.java ProcessorCharacters.java
ProcessorDecimalFormat.java
ProcessorGlobalParamDecl.java
ProcessorGlobalVariableDecl.java
ProcessorImport.java ProcessorInclude.java
ProcessorKey.java ProcessorLRE.java
ProcessorNamespaceAlias.java
ProcessorOutputElem.java
ProcessorPreserveSpace.java
ProcessorStripSpace.java
ProcessorStylesheetDoc.java
ProcessorStylesheetElement.java
ProcessorTemplate.java ProcessorTemplateElem.java
ProcessorText.java ProcessorUnknown.java
StopParseException.java StylesheetHandler.java
StylesheetPIHandler.java StylesheetProcessor.java
TemplateElementFactory.java
XSLProcessorVersion.java XSLTAttributeDef.java
XSLTElementDef.java XSLTElementProcessor.java
XSLTSchema.java
Log:
Fixed some bugs with import\include. JIndent formatting.
Revision Changes Path
1.3 +13 -11
xml-xalan/java/src/org/apache/xalan/processor/CompilingStylesheetProcessor.java
Index: CompilingStylesheetProcessor.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/processor/CompilingStylesheetProcessor.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- CompilingStylesheetProcessor.java 2000/10/13 02:33:09 1.2
+++ CompilingStylesheetProcessor.java 2000/10/30 18:40:35 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,
@@ -57,6 +57,7 @@
package org.apache.xalan.processor;
import java.io.IOException;
+
import org.xml.sax.InputSource;
import org.xml.sax.helpers.XMLReaderFactory;
import org.xml.sax.XMLReader;
@@ -70,32 +71,33 @@
import org.apache.trax.TemplatesBuilder;
/**
- * The StylesheetProcessor, which implements the TRaX Processor
+ * The StylesheetProcessor, which implements the TRaX Processor
* interface, processes XSLT Stylesheets into a Templates object.
* This version has been modified to kick off conversion to JAVA,
* via CompilingStylesheetHandler
*/
public class CompilingStylesheetProcessor extends StylesheetProcessor
{
+
/**
- * Get a TemplatesBuilder object that can process SAX
- * events into a Templates object, if the processor supports the
+ * Get a TemplatesBuilder object that can process SAX
+ * events into a Templates object, if the processor supports the
* "http://xml.org/trax/features/sax/input" feature.
- *
+ *
* <h3>Open issues:</h3>
* <dl>
* <dt><h4>Should Processor derive from
org.xml.sax.ContentHandler?</h4></dt>
- * <dd>Instead of requesting an object from the Processor class, should
+ * <dd>Instead of requesting an object from the Processor class, should
* the Processor class simply derive from
org.xml.sax.ContentHandler?</dd>
* </dl>
* @return A TemplatesBuilder object, or null if not supported.
- * @exception May throw a ProcessorException if a StylesheetHandler can
+ * @exception May throw a ProcessorException if a StylesheetHandler can
* not be constructed for some reason.
+ *
+ * @throws ProcessorException
*/
- public TemplatesBuilder getTemplatesBuilder()
- throws ProcessorException
+ public TemplatesBuilder getTemplatesBuilder() throws ProcessorException
{
return new CompilingStylesheetHandler(this);
}
-
}
1.3 +25 -14
xml-xalan/java/src/org/apache/xalan/processor/ProcessorAttributeSet.java
Index: ProcessorAttributeSet.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/processor/ProcessorAttributeSet.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ProcessorAttributeSet.java 2000/08/08 00:27:16 1.2
+++ ProcessorAttributeSet.java 2000/10/30 18:40:35 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,
@@ -58,6 +58,7 @@
import org.apache.xalan.templates.ElemAttributeSet;
import org.apache.xalan.templates.ElemTemplateElement;
+
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
@@ -68,6 +69,7 @@
*/
class ProcessorAttributeSet extends XSLTElementProcessor
{
+
/**
* Receive notification of the start of an xsl:attribute-set element.
*
@@ -83,47 +85,56 @@
* @param atts The attributes attached to the element. If
* there are no attributes, it shall be an empty
* Attributes object.
+ * NEEDSDOC @param attributes
* @exception org.xml.sax.SAXException Any SAX exception, possibly
* wrapping another exception.
* @see org.apache.xalan.processor.StylesheetHandler#startElement
* @see org.xml.sax.ContentHandler#startElement
* @see org.xml.sax.ContentHandler#endElement
* @see org.xml.sax.Attributes
+ *
+ * @throws SAXException
*/
- public void startElement (StylesheetHandler handler,
- String uri, String localName,
- String rawName, Attributes attributes)
- throws SAXException
+ public void startElement(
+ StylesheetHandler handler, String uri, String localName, String
rawName, Attributes attributes)
+ throws SAXException
{
+
ElemAttributeSet eat = new ElemAttributeSet();
+
eat.setLocaterInfo(handler.getLocator());
eat.setPrefixes(handler.getNamespaceSupport());
eat.setDOMBackPointer(handler.getOriginatingNode());
-
setPropertiesFromAttributes(handler, rawName, attributes, eat);
-
handler.getStylesheet().setAttributeSet(eat);
-
+
// handler.pushElemTemplateElement(eat);
ElemTemplateElement parent = handler.getElemTemplateElement();
+
parent.appendChild(eat);
handler.pushElemTemplateElement(eat);
}
-
+
/**
* Receive notification of the end of an element.
*
* @param name The element type name.
* @param attributes The specified or defaulted attributes.
+ *
+ * NEEDSDOC @param handler
+ * NEEDSDOC @param uri
+ * NEEDSDOC @param localName
+ * NEEDSDOC @param rawName
* @exception org.xml.sax.SAXException Any SAX exception, possibly
* wrapping another exception.
* @see org.xml.sax.ContentHandler#endElement
+ *
+ * @throws SAXException
*/
- public void endElement (StylesheetHandler handler,
- String uri, String localName, String rawName)
- throws SAXException
+ public void endElement(
+ StylesheetHandler handler, String uri, String localName, String
rawName)
+ throws SAXException
{
handler.popElemTemplateElement();
}
-
}
1.4 +52 -28
xml-xalan/java/src/org/apache/xalan/processor/ProcessorCharacters.java
Index: ProcessorCharacters.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/processor/ProcessorCharacters.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ProcessorCharacters.java 2000/10/13 00:34:45 1.3
+++ ProcessorCharacters.java 2000/10/30 18:40:36 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,
@@ -57,7 +57,9 @@
package org.apache.xalan.processor;
import java.lang.StringBuffer;
+
import org.xml.sax.SAXException;
+
import org.apache.xalan.templates.ElemText;
import org.apache.xalan.templates.ElemTextLiteral;
import org.apache.xalan.templates.ElemTemplateElement;
@@ -70,44 +72,58 @@
* @see <a
href="http://www.w3.org/TR/xslt#section-Creating-the-Result-Tree">section-Creating-the-Result-Tree
in XSLT Specification</a>
*/
public class ProcessorCharacters extends XSLTElementProcessor
-{
+{
+
/**
- * Receive notification of the start of the non-text event. This
+ * Receive notification of the start of the non-text event. This
* is sent to the current processor when any non-text event occurs.
+ *
+ * NEEDSDOC @param handler
+ *
+ * @throws SAXException
*/
- public void startNonText(StylesheetHandler handler)
- throws SAXException
+ public void startNonText(StylesheetHandler handler) throws SAXException
{
- if(this == handler.getCurrentProcessor())
+
+ if (this == handler.getCurrentProcessor())
handler.popProcessor();
int nChars = m_accumulator.length();
- if((nChars > 0) &&
- ((null != m_xslTextElement)
- || !XMLCharacterRecognizer.isWhiteSpace(m_accumulator)))
+
+ if ((nChars > 0)
+ && ((null != m_xslTextElement)
+ ||!XMLCharacterRecognizer.isWhiteSpace(m_accumulator)))
{
ElemTextLiteral elem = new ElemTextLiteral();
+
elem.setDOMBackPointer(handler.getOriginatingNode());
elem.setLocaterInfo(handler.getLocator());
elem.setPrefixes(handler.getNamespaceSupport());
- boolean doe = (null != m_xslTextElement)
+
+ boolean doe = (null != m_xslTextElement)
? m_xslTextElement.getDisableOutputEscaping() : false;
+
elem.setDisableOutputEscaping(doe);
elem.setPreserveSpace(true);
char[] chars = new char[nChars];
+
m_accumulator.getChars(0, nChars, chars, 0);
elem.setChars(chars);
+
ElemTemplateElement parent = handler.getElemTemplateElement();
+
parent.appendChild(elem);
}
+
m_accumulator.setLength(0);
}
-
/**
* Receive notification of character data inside an element.
*
+ *
+ * NEEDSDOC @param handler
* @param ch The characters.
* @param start The start position in the character array.
* @param length The number of characters to use from the
@@ -115,18 +131,21 @@
* @exception org.xml.sax.SAXException Any SAX exception, possibly
* wrapping another exception.
* @see org.xml.sax.ContentHandler#characters
+ *
+ * @throws SAXException
*/
- public void characters (StylesheetHandler handler,
- char ch[], int start, int length)
- throws SAXException
+ public void characters(
+ StylesheetHandler handler, char ch[], int start, int length)
+ throws SAXException
{
+
m_accumulator.append(ch, start, length);
-
+
// Catch all events until a non-character event.
- if(this != handler.getCurrentProcessor())
+ if (this != handler.getCurrentProcessor())
handler.pushProcessor(this);
- }
-
+ }
+
/**
* Receive notification of the end of an element.
*
@@ -149,37 +168,42 @@
* @see org.xml.sax.ContentHandler#startElement
* @see org.xml.sax.ContentHandler#endElement
* @see org.xml.sax.Attributes
+ *
+ * @throws SAXException
*/
- public void endElement (StylesheetHandler handler, String uri,
- String localName, String rawName)
- throws SAXException
+ public void endElement(
+ StylesheetHandler handler, String uri, String localName, String
rawName)
+ throws SAXException
{
+
// Since this has been installed as the current processor, we
// may get and end element event, in which case, we pop and clear
// and then call the real element processor.
startNonText(handler);
- handler.getCurrentProcessor().endElement (handler, uri, localName,
rawName);
+ handler.getCurrentProcessor().endElement(handler, uri, localName,
+ rawName);
handler.popProcessor();
}
/**
- * Accumulate characters, until a non-whitespace event has
+ * Accumulate characters, until a non-whitespace event has
* occured.
*/
private StringBuffer m_accumulator = new StringBuffer();
-
+
/**
- * The xsl:text processor will call this to set a
+ * The xsl:text processor will call this to set a
* preserve space state.
*/
private ElemText m_xslTextElement;
-
+
/**
* Set the current setXslTextElement
+ *
+ * NEEDSDOC @param xslTextElement
*/
void setXslTextElement(ElemText xslTextElement)
{
m_xslTextElement = xslTextElement;
}
-
}
1.2 +17 -9
xml-xalan/java/src/org/apache/xalan/processor/ProcessorDecimalFormat.java
Index: ProcessorDecimalFormat.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/processor/ProcessorDecimalFormat.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ProcessorDecimalFormat.java 2000/06/19 16:52:05 1.1
+++ ProcessorDecimalFormat.java 2000/10/30 18:40:36 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,
@@ -57,11 +57,17 @@
package org.apache.xalan.processor;
import org.apache.xalan.templates.DecimalFormatProperties;
+
import org.xml.sax.SAXException;
import org.xml.sax.Attributes;
+/**
+ * <meta name="usage" content="internal"/>
+ * NEEDSDOC Class ProcessorDecimalFormat <needs-comment/>
+ */
class ProcessorDecimalFormat extends XSLTElementProcessor
-{
+{
+
/**
* Receive notification of the start of an element.
*
@@ -77,6 +83,7 @@
* @param atts The attributes attached to the element. If
* there are no attributes, it shall be an empty
* Attributes object.
+ * NEEDSDOC @param attributes
* @exception org.xml.sax.SAXException Any SAX exception, possibly
* wrapping another exception.
* @see org.apache.xalan.processor.StylesheetHandler#startElement
@@ -84,16 +91,17 @@
* @see org.xml.sax.ContentHandler#startElement
* @see org.xml.sax.ContentHandler#endElement
* @see org.xml.sax.Attributes
+ *
+ * @throws SAXException
*/
- public void startElement (StylesheetHandler handler,
- String uri, String localName,
- String rawName, Attributes attributes)
- throws SAXException
+ public void startElement(
+ StylesheetHandler handler, String uri, String localName, String
rawName, Attributes attributes)
+ throws SAXException
{
+
DecimalFormatProperties dfp = new DecimalFormatProperties();
-
+
setPropertiesFromAttributes(handler, rawName, attributes, dfp);
-
handler.getStylesheet().setDecimalFormat(dfp);
}
}
1.3 +30 -13
xml-xalan/java/src/org/apache/xalan/processor/ProcessorGlobalParamDecl.java
Index: ProcessorGlobalParamDecl.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/processor/ProcessorGlobalParamDecl.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ProcessorGlobalParamDecl.java 2000/07/30 22:45:45 1.2
+++ ProcessorGlobalParamDecl.java 2000/10/30 18:40:36 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,
@@ -58,6 +58,7 @@
import org.apache.xalan.templates.ElemTemplateElement;
import org.apache.xalan.templates.ElemParam;
+
import org.xml.sax.SAXException;
import org.xml.sax.Attributes;
@@ -68,33 +69,49 @@
*/
class ProcessorGlobalParamDecl extends ProcessorTemplateElem
{
+
/**
- * Append the current template element to the current
- * template element, and then push it onto the current template
+ * Append the current template element to the current
+ * template element, and then push it onto the current template
* element stack.
+ *
+ * NEEDSDOC @param handler
+ * NEEDSDOC @param elem
+ *
+ * @throws SAXException
*/
- protected void appendAndPush(StylesheetHandler handler,
- ElemTemplateElement elem)
- throws SAXException
+ protected void appendAndPush(
+ StylesheetHandler handler, ElemTemplateElement elem)
+ throws SAXException
{
+
// Just push, but don't append.
handler.pushElemTemplateElement(elem);
}
-
- /**
+
+ /**
* Receive notification of the end of an element.
*
* @param name The element type name.
* @param attributes The specified or defaulted attributes.
+ *
+ * NEEDSDOC @param handler
+ * NEEDSDOC @param uri
+ * NEEDSDOC @param localName
+ * NEEDSDOC @param rawName
* @exception org.xml.sax.SAXException Any SAX exception, possibly
* wrapping another exception.
* @see org.xml.sax.ContentHandler#endElement
+ *
+ * @throws SAXException
*/
- public void endElement (StylesheetHandler handler,
- String uri, String localName, String rawName)
- throws SAXException
+ public void endElement(
+ StylesheetHandler handler, String uri, String localName, String
rawName)
+ throws SAXException
{
- ElemParam v = (ElemParam)handler.getElemTemplateElement();
+
+ ElemParam v = (ElemParam) handler.getElemTemplateElement();
+
handler.getStylesheet().appendChild(v);
handler.getStylesheet().setParam(v);
super.endElement(handler, uri, localName, rawName);
1.3 +30 -14
xml-xalan/java/src/org/apache/xalan/processor/ProcessorGlobalVariableDecl.java
Index: ProcessorGlobalVariableDecl.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/processor/ProcessorGlobalVariableDecl.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ProcessorGlobalVariableDecl.java 2000/07/30 22:45:45 1.2
+++ ProcessorGlobalVariableDecl.java 2000/10/30 18:40:37 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,
@@ -58,6 +58,7 @@
import org.apache.xalan.templates.ElemTemplateElement;
import org.apache.xalan.templates.ElemVariable;
+
import org.xml.sax.SAXException;
import org.xml.sax.Attributes;
@@ -68,36 +69,51 @@
*/
class ProcessorGlobalVariableDecl extends ProcessorTemplateElem
{
+
/**
- * Append the current template element to the current
- * template element, and then push it onto the current template
+ * Append the current template element to the current
+ * template element, and then push it onto the current template
* element stack.
+ *
+ * NEEDSDOC @param handler
+ * NEEDSDOC @param elem
+ *
+ * @throws SAXException
*/
- protected void appendAndPush(StylesheetHandler handler,
- ElemTemplateElement elem)
- throws SAXException
+ protected void appendAndPush(
+ StylesheetHandler handler, ElemTemplateElement elem)
+ throws SAXException
{
+
// Just push, but don't append.
handler.pushElemTemplateElement(elem);
}
-
- /**
+
+ /**
* Receive notification of the end of an element.
*
* @param name The element type name.
* @param attributes The specified or defaulted attributes.
+ *
+ * NEEDSDOC @param handler
+ * NEEDSDOC @param uri
+ * NEEDSDOC @param localName
+ * NEEDSDOC @param rawName
* @exception org.xml.sax.SAXException Any SAX exception, possibly
* wrapping another exception.
* @see org.xml.sax.ContentHandler#endElement
+ *
+ * @throws SAXException
*/
- public void endElement (StylesheetHandler handler,
- String uri, String localName, String rawName)
- throws SAXException
+ public void endElement(
+ StylesheetHandler handler, String uri, String localName, String
rawName)
+ throws SAXException
{
- ElemVariable v = (ElemVariable)handler.getElemTemplateElement();
+
+ ElemVariable v = (ElemVariable) handler.getElemTemplateElement();
+
handler.getStylesheet().appendChild(v);
handler.getStylesheet().setVariable(v);
super.endElement(handler, uri, localName, rawName);
}
-
}
1.5 +26 -11
xml-xalan/java/src/org/apache/xalan/processor/ProcessorImport.java
Index: ProcessorImport.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/processor/ProcessorImport.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ProcessorImport.java 2000/10/13 02:33:09 1.4
+++ ProcessorImport.java 2000/10/30 18:40:37 1.5
@@ -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,
@@ -61,15 +61,20 @@
import org.apache.xalan.templates.StylesheetComposed;
import org.apache.xalan.res.XSLMessages;
import org.apache.xalan.res.XSLTErrorResources;
+
import org.xml.sax.SAXException;
import org.xml.sax.Attributes;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.XMLReaderFactory;
import org.xml.sax.InputSource;
import org.xml.sax.EntityResolver;
+
import java.net.URL;
+
import java.io.IOException;
+
import org.apache.trax.URIResolver;
+
import org.w3c.dom.Node;
/**
@@ -79,6 +84,7 @@
*/
class ProcessorImport extends ProcessorInclude
{
+
/**
* Receive notification of the start of an xsl:import element.
*
@@ -94,6 +100,7 @@
* @param atts The attributes attached to the element. If
* there are no attributes, it shall be an empty
* Attributes object.
+ * NEEDSDOC @param attributes
* @exception org.xml.sax.SAXException Any SAX exception, possibly
* wrapping another exception.
* @see org.apache.xalan.processor.StylesheetHandler#startElement
@@ -101,33 +108,41 @@
* @see org.xml.sax.ContentHandler#startElement
* @see org.xml.sax.ContentHandler#endElement
* @see org.xml.sax.Attributes
+ *
+ * @throws SAXException
*/
- public void startElement (StylesheetHandler handler,
- String uri, String localName,
- String rawName, Attributes attributes)
- throws SAXException
+ public void startElement(
+ StylesheetHandler handler, String uri, String localName, String
rawName, Attributes attributes)
+ throws SAXException
{
+
setPropertiesFromAttributes(handler, rawName, attributes, this);
String hrefUrl = getHref();
- if(handler.importStackContains(hrefUrl))
+
+ if (handler.importStackContains(hrefUrl))
{
- throw new
SAXException(XSLMessages.createMessage(XSLTErrorResources.ER_IMPORTING_ITSELF,
new Object[] {hrefUrl})); //"(StylesheetHandler) "+hrefUrl+" is directly or
indirectly importing itself!");
+ throw new SAXException(
+ XSLMessages.createMessage(
+ XSLTErrorResources.ER_IMPORTING_ITSELF, new Object[]{ hrefUrl }));
//"(StylesheetHandler) "+hrefUrl+" is directly or indirectly importing
itself!");
}
handler.pushImportURL(hrefUrl);
+
int savedStylesheetType = handler.getStylesheetType();
+
handler.setStylesheetType(StylesheetHandler.STYPE_IMPORT);
-
+ handler.pushNewNamespaceSupport();
+
try
{
- parse (handler, uri, localName, rawName, attributes);
+ parse(handler, uri, localName, rawName, attributes);
}
finally
{
handler.setStylesheetType(savedStylesheetType);
handler.popImportURL();
- handler.popStylesheet();
+ handler.popNamespaceSupport();
}
}
}
1.7 +83 -39
xml-xalan/java/src/org/apache/xalan/processor/ProcessorInclude.java
Index: ProcessorInclude.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/processor/ProcessorInclude.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ProcessorInclude.java 2000/10/13 02:33:09 1.6
+++ ProcessorInclude.java 2000/10/30 18:40:37 1.7
@@ -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,
@@ -60,16 +60,23 @@
import org.apache.xalan.templates.Stylesheet;
import org.apache.xalan.res.XSLMessages;
import org.apache.xalan.res.XSLTErrorResources;
+
import org.xml.sax.SAXException;
import org.xml.sax.Attributes;
import org.xml.sax.XMLReader;
import org.xml.sax.InputSource;
import org.xml.sax.EntityResolver;
+
import java.net.URL;
+
import java.io.IOException;
+
import org.xml.sax.helpers.XMLReaderFactory;
+
import org.apache.trax.URIResolver;
+
import org.w3c.dom.Node;
+
import org.apache.xalan.utils.SystemIDResolver;
/**
@@ -79,6 +86,7 @@
*/
class ProcessorInclude extends XSLTElementProcessor
{
+
/**
* The base URL of the XSL document.
* @serial
@@ -87,6 +95,8 @@
/**
* Get the base identifier with which this stylesheet is associated.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public String getHref()
{
@@ -95,6 +105,8 @@
/**
* Get the base identifier with which this stylesheet is associated.
+ *
+ * NEEDSDOC @param baseIdent
*/
public void setHref(String baseIdent)
{
@@ -116,6 +128,7 @@
* @param atts The attributes attached to the element. If
* there are no attributes, it shall be an empty
* Attributes object.
+ * NEEDSDOC @param attributes
* @exception org.xml.sax.SAXException Any SAX exception, possibly
* wrapping another exception.
* @see org.apache.xalan.processor.StylesheetHandler#startElement
@@ -123,91 +136,122 @@
* @see org.xml.sax.ContentHandler#startElement
* @see org.xml.sax.ContentHandler#endElement
* @see org.xml.sax.Attributes
+ *
+ * @throws SAXException
*/
- public void startElement (StylesheetHandler handler,
- String uri, String localName,
- String rawName, Attributes attributes)
- throws SAXException
+ public void startElement(
+ StylesheetHandler handler, String uri, String localName, String
rawName, Attributes attributes)
+ throws SAXException
{
+
setPropertiesFromAttributes(handler, rawName, attributes, this);
-
+
int savedStylesheetType = handler.getStylesheetType();
+
handler.setStylesheetType(StylesheetHandler.STYPE_INCLUDE);
+ handler.pushNewNamespaceSupport();
try
{
- parse (handler, uri, localName, rawName, attributes);
+ parse(handler, uri, localName, rawName, attributes);
}
finally
{
handler.setStylesheetType(savedStylesheetType);
- handler.popStylesheet();
+ handler.popNamespaceSupport();
+
+ // handler.popStylesheet();
}
}
-
- protected void parse (StylesheetHandler handler,
- String uri, String localName,
- String rawName, Attributes attributes)
- throws SAXException
+
+ /**
+ * NEEDSDOC Method parse
+ *
+ *
+ * NEEDSDOC @param handler
+ * NEEDSDOC @param uri
+ * NEEDSDOC @param localName
+ * NEEDSDOC @param rawName
+ * NEEDSDOC @param attributes
+ *
+ * @throws SAXException
+ */
+ protected void parse(
+ StylesheetHandler handler, String uri, String localName, String
rawName, Attributes attributes)
+ throws SAXException
{
- URIResolver uriresolver =
handler.getStylesheetProcessor().getURIResolver();
+ URIResolver uriresolver =
+ handler.getStylesheetProcessor().getURIResolver();
+
try
{
XMLReader reader = null;
boolean tryCreatingReader = true;
- EntityResolver entityResolver
- = handler.getStylesheetProcessor().getEntityResolver();
-
+ EntityResolver entityResolver =
+ handler.getStylesheetProcessor().getEntityResolver();
InputSource inputSource;
- if(null != entityResolver)
+
+ if (null != entityResolver)
{
inputSource = entityResolver.resolveEntity(null, getHref());
+
// TODO: Check for relative URL, and absolutize it??? Or no?
}
else
{
- String absURL
- = SystemIDResolver.getAbsoluteURI(getHref(),
handler.getBaseIdentifier());
+ String absURL = SystemIDResolver.getAbsoluteURI(getHref(),
+ handler.getBaseIdentifier());
+
inputSource = new InputSource(absURL);
}
- if(null != uriresolver)
+ if (null != uriresolver)
{
tryCreatingReader = false;
reader = uriresolver.getXMLReader(inputSource);
- if(null == reader)
+
+ if (null == reader)
{
Node node = uriresolver.getDOMNode(inputSource);
- if(null != node)
+
+ if (null != node)
{
TreeWalker walker = new TreeWalker(handler);
+
walker.traverse(node);
}
else
tryCreatingReader = true;
}
}
- if(tryCreatingReader)
+
+ if (tryCreatingReader)
{
reader = handler.getStylesheetProcessor().getXMLReader();
- if(null == reader)
+
+ if (null == reader)
{
reader = XMLReaderFactory.createXMLReader();
}
else
{
- Class readerClass = ((Object)reader).getClass();
- reader = (XMLReader)readerClass.newInstance();
+ Class readerClass = ((Object) reader).getClass();
+
+ reader = (XMLReader) readerClass.newInstance();
}
}
- if(null != reader)
+
+ if (null != reader)
{
- if(null != entityResolver)
+ if (null != entityResolver)
reader.setEntityResolver(entityResolver);
+
reader.setContentHandler(handler);
-
reader.setFeature("http://apache.org/xml/features/validation/dynamic", true);
+
reader.setFeature("http://apache.org/xml/features/validation/dynamic",
+ true);
handler.pushBaseIndentifier(inputSource.getSystemId());
+
try
{
reader.parse(inputSource);
@@ -218,23 +262,23 @@
}
}
}
- catch(InstantiationException ie)
+ catch (InstantiationException ie)
{
handler.error("Could not clone parser!", ie);
}
- catch(IllegalAccessException iae)
+ catch (IllegalAccessException iae)
{
handler.error("Can not access class!", iae);
}
- catch(IOException ioe)
+ catch (IOException ioe)
{
- handler.error(XSLTErrorResources.ER_IOEXCEPTION, new Object[]
{getHref()}, ioe);
+ handler.error(XSLTErrorResources.ER_IOEXCEPTION,
+ new Object[]{ getHref() }, ioe);
}
- catch(SAXException ioe)
+ catch (SAXException ioe)
{
- handler.error(XSLTErrorResources.ER_IOEXCEPTION, new Object[]
{getHref()}, ioe);
+ handler.error(XSLTErrorResources.ER_IOEXCEPTION,
+ new Object[]{ getHref() }, ioe);
}
}
-
-
}
1.5 +53 -35
xml-xalan/java/src/org/apache/xalan/processor/ProcessorKey.java
Index: ProcessorKey.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/processor/ProcessorKey.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ProcessorKey.java 2000/10/02 15:02:35 1.4
+++ ProcessorKey.java 2000/10/30 18:40:38 1.5
@@ -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,8 +57,10 @@
package org.apache.xalan.processor;
import org.apache.xalan.templates.KeyDeclaration;
+
import org.xml.sax.SAXException;
import org.xml.sax.Attributes;
+
import org.apache.xalan.res.XSLMessages;
import org.apache.xalan.res.XSLTErrorResources;
@@ -79,7 +81,10 @@
*/
class ProcessorKey extends XSLTElementProcessor
{
+
+ /** NEEDSDOC Field FUNC_KEY_STRING */
static final String FUNC_KEY_STRING = "key";
+
/**
* Receive notification of the start of an xsl:key element.
*
@@ -95,6 +100,7 @@
* @param atts The attributes attached to the element. If
* there are no attributes, it shall be an empty
* Attributes object.
+ * NEEDSDOC @param attributes
* @exception org.xml.sax.SAXException Any SAX exception, possibly
* wrapping another exception.
* @see org.apache.xalan.processor.StylesheetHandler#startElement
@@ -102,87 +108,99 @@
* @see org.xml.sax.ContentHandler#startElement
* @see org.xml.sax.ContentHandler#endElement
* @see org.xml.sax.Attributes
+ *
+ * @throws SAXException
*/
- public void startElement (StylesheetHandler handler,
- String uri, String localName,
- String rawName, Attributes attributes)
- throws SAXException
+ public void startElement(
+ StylesheetHandler handler, String uri, String localName, String
rawName, Attributes attributes)
+ throws SAXException
{
+
KeyDeclaration kd = new KeyDeclaration();
+
kd.setDOMBackPointer(handler.getOriginatingNode());
kd.setLocaterInfo(handler.getLocator());
-
setPropertiesFromAttributes(handler, rawName, attributes, kd);
-
handler.getStylesheet().setKey(kd);
}
-
+
/**
* Set the properties of an object from the given attribute list.
- * @param handler The stylesheet's Content handler, needed for
+ * @param handler The stylesheet's Content handler, needed for
* error reporting.
- * @param rawName The raw name of the owner element, needed for
+ * @param rawName The raw name of the owner element, needed for
* error reporting.
* @param attributes The list of attributes.
* @param target The target element where the properties will be set.
+ *
+ * @throws SAXException
*/
- void setPropertiesFromAttributes(StylesheetHandler handler,
- String rawName,
- Attributes attributes,
- Object target)
- throws SAXException
+ void setPropertiesFromAttributes(
+ StylesheetHandler handler, String rawName, Attributes attributes,
Object target)
+ throws SAXException
{
+
XSLTElementDef def = getElemDef();
// Keep track of which XSLTAttributeDefs have been processed, so
// I can see which default values need to be set.
Vector processedDefs = new Vector();
int nAttrs = attributes.getLength();
- for(int i = 0; i < nAttrs; i++)
+
+ for (int i = 0; i < nAttrs; i++)
{
String attrUri = attributes.getURI(i);
String attrLocalName = attributes.getLocalName(i);
- XSLTAttributeDef attrDef = def.getAttributeDef( attrUri, attrLocalName
);
-
- if(null == attrDef)
+ XSLTAttributeDef attrDef = def.getAttributeDef(attrUri, attrLocalName);
+
+ if (null == attrDef)
{
+
// Then barf, because this element does not allow this attribute.
- handler.error(attributes.getQName(i)+
- "attribute is not allowed on the "+
- rawName+" element!", null);
+ handler.error(attributes.getQName(i)
+ + "attribute is not allowed on the " + rawName
+ + " element!", null);
}
else
{
String valueString = attributes.getValue(i);
- if (valueString.indexOf(FUNC_KEY_STRING+"(") >= 0)
-
handler.error(XSLMessages.createMessage(XSLTErrorResources.ER_INVALID_KEY_CALL,
null), null);
+
+ if (valueString.indexOf(FUNC_KEY_STRING + "(") >= 0)
+ handler.error(
+ XSLMessages.createMessage(
+ XSLTErrorResources.ER_INVALID_KEY_CALL, null), null);
+
processedDefs.addElement(attrDef);
attrDef.setAttrValue(handler, attrUri, attrLocalName,
- attributes.getQName(i),
- attributes.getValue(i),
+ attributes.getQName(i), attributes.getValue(i),
target);
}
}
-
+
XSLTAttributeDef[] attrDefs = def.getAttributes();
int nAttrDefs = attrDefs.length;
- for(int i = 0; i < nAttrDefs; i++)
+
+ for (int i = 0; i < nAttrDefs; i++)
{
XSLTAttributeDef attrDef = attrDefs[i];
String defVal = attrDef.getDefault();
- if(null != defVal)
+
+ if (null != defVal)
{
- if(!processedDefs.contains(attrDef))
+ if (!processedDefs.contains(attrDef))
{
attrDef.setDefAttrValue(handler, target);
}
}
+
if (attrDef.getRequired())
{
- if(!processedDefs.contains(attrDef))
-
handler.error(XSLMessages.createMessage(XSLTErrorResources.ER_REQUIRES_ATTRIB,
new Object[]{rawName, attrDef.getName()}) , null);
- }
+ if (!processedDefs.contains(attrDef))
+ handler.error(
+ XSLMessages.createMessage(
+ XSLTErrorResources.ER_REQUIRES_ATTRIB, new Object[]{ rawName,
+
attrDef.getName() }), null);
+ }
}
-
}
}
1.9 +135 -65
xml-xalan/java/src/org/apache/xalan/processor/ProcessorLRE.java
Index: ProcessorLRE.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/processor/ProcessorLRE.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- ProcessorLRE.java 2000/10/23 15:23:27 1.8
+++ ProcessorLRE.java 2000/10/30 18:40:38 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,
@@ -64,119 +64,143 @@
import org.apache.xalan.templates.Constants;
import org.apache.xpath.XPath;
import org.apache.xalan.templates.StylesheetRoot;
+
import org.xml.sax.SAXException;
import org.xml.sax.Attributes;
import org.xml.sax.helpers.AttributesImpl;
+/**
+ * <meta name="usage" content="internal"/>
+ * NEEDSDOC Class ProcessorLRE <needs-comment/>
+ */
public class ProcessorLRE extends ProcessorTemplateElem
{
-
+
/**
* Receive notification of the start of an element.
*
* @param name The element type name.
+ *
+ * NEEDSDOC @param handler
+ * NEEDSDOC @param uri
+ * NEEDSDOC @param localName
+ * NEEDSDOC @param rawName
* @param attributes The specified or defaulted attributes.
* @exception org.xml.sax.SAXException Any SAX exception, possibly
* wrapping another exception.
* @see org.xml.sax.ContentHandler#startElement
+ *
+ * @throws SAXException
*/
- public void startElement (StylesheetHandler handler,
- String uri, String localName,
- String rawName, Attributes attributes)
- throws SAXException
+ public void startElement(
+ StylesheetHandler handler, String uri, String localName, String
rawName, Attributes attributes)
+ throws SAXException
{
+
ElemTemplateElement p = handler.getElemTemplateElement();
boolean excludeXSLDecl = false;
-
- if(null == p)
+ boolean isLREAsStyleSheet = false;
+
+ if (null == p)
{
- // Literal Result Template as stylesheet.
+ // Literal Result Template as stylesheet.
XSLTElementProcessor lreProcessor = handler.popProcessor();
- XSLTElementProcessor stylesheetProcessor
- = handler.getProcessorFor( Constants.S_XSLNAMESPACEURL,
"stylesheet", "xsl:stylesheet" );
+ XSLTElementProcessor stylesheetProcessor =
+ handler.getProcessorFor(Constants.S_XSLNAMESPACEURL, "stylesheet",
+ "xsl:stylesheet");
+
handler.pushProcessor(lreProcessor);
-
+
Stylesheet stylesheet = new StylesheetRoot();
-
+
// stylesheet.setDOMBackPointer(handler.getOriginatingNode());
// ***** Note that we're assigning an empty locator. Is this
necessary?
stylesheet.setLocaterInfo(new org.xml.sax.helpers.LocatorImpl());
stylesheet.setPrefixes(handler.getNamespaceSupport());
-
handler.pushStylesheet(stylesheet);
-
+
+ isLREAsStyleSheet = true;
+
AttributesImpl stylesheetAttrs = new AttributesImpl();
AttributesImpl lreAttrs = new AttributesImpl();
int n = attributes.getLength();
- for(int i = 0; i < n; i++)
+
+ for (int i = 0; i < n; i++)
{
String attrLocalName = attributes.getLocalName(i);
String attrUri = attributes.getURI(i);
String value = attributes.getValue(i);
- if((null != attrUri) && attrUri.equals(Constants.S_XSLNAMESPACEURL))
+ if ((null != attrUri) && attrUri.equals(Constants.S_XSLNAMESPACEURL))
{
- stylesheetAttrs.addAttribute(null, attrLocalName,
- attrLocalName,
- attributes.getType(i),
+ stylesheetAttrs.addAttribute(null, attrLocalName, attrLocalName,
+ attributes.getType(i),
attributes.getValue(i));
}
- else if((attrLocalName.startsWith("xmlns:") ||
- attrLocalName.equals("xmlns")) &&
- value.equals(Constants.S_XSLNAMESPACEURL))
+ else if ((attrLocalName.startsWith("xmlns:") || attrLocalName.equals(
+ "xmlns")) && value.equals(Constants.S_XSLNAMESPACEURL))
{
+
// ignore
}
else
{
- lreAttrs.addAttribute(attrUri, attrLocalName,
- attributes.getQName(i),
- attributes.getType(i),
+ lreAttrs.addAttribute(attrUri, attrLocalName,
+ attributes.getQName(i),
+ attributes.getType(i),
attributes.getValue(i));
}
}
+
attributes = lreAttrs;
-
+
// Set properties from the attributes, but don't throw
// an error if there is an attribute defined that is not
// allowed on a stylesheet.
- stylesheetProcessor.setPropertiesFromAttributes(handler, "stylesheet",
- stylesheetAttrs,
- stylesheet);
-
+ stylesheetProcessor.setPropertiesFromAttributes(handler, "stylesheet",
+ stylesheetAttrs, stylesheet);
handler.pushElemTemplateElement(stylesheet);
-
+
ElemTemplate template = new ElemTemplate();
+
appendAndPush(handler, template);
-
+
XPath rootMatch = new XPath("/", stylesheet, stylesheet, XPath.MATCH);
- template.setMatch(rootMatch);
+
+ template.setMatch(rootMatch);
+
// template.setDOMBackPointer(handler.getOriginatingNode());
stylesheet.setTemplate(template);
+
p = handler.getElemTemplateElement();
excludeXSLDecl = true;
}
XSLTElementDef def = getElemDef();
Class classObject = def.getClassObject();
-
boolean isExtension = false;
boolean isComponentDecl = false;
boolean isUnknownTopLevel = false;
- while(null != p)
+
+ while (null != p)
{
+
// System.out.println("Checking: "+p);
- if(p instanceof ElemLiteralResult)
+ if (p instanceof ElemLiteralResult)
{
- ElemLiteralResult parentElem = (ElemLiteralResult)p;
+ ElemLiteralResult parentElem = (ElemLiteralResult) p;
+
isExtension = parentElem.containsExtensionElementURI(uri);
}
- else if(p instanceof Stylesheet)
+ else if (p instanceof Stylesheet)
{
- Stylesheet parentElem = (Stylesheet)p;
+ Stylesheet parentElem = (Stylesheet) p;
+
isExtension = parentElem.containsExtensionElementURI(uri);
- if((false == isExtension) && (null != uri) &&
uri.equals(Constants.S_BUILTIN_EXTENSIONS_URL))
+
+ if ((false == isExtension) && (null != uri)
+ && uri.equals(Constants.S_BUILTIN_EXTENSIONS_URL))
{
isComponentDecl = true;
}
@@ -185,71 +209,117 @@
isUnknownTopLevel = true;
}
}
- if(isExtension)
+
+ if (isExtension)
break;
+
p = p.getParentElem();
}
-
+
ElemTemplateElement elem = null;
+
try
{
- if(isExtension)
+ if (isExtension)
{
+
// System.out.println("Creating extension(1): "+uri);
elem = new ElemExtensionCall();
}
- else if(isComponentDecl)
+ else if (isComponentDecl)
{
- elem = (ElemTemplateElement)classObject.newInstance();
+ elem = (ElemTemplateElement) classObject.newInstance();
}
- else if(isUnknownTopLevel)
+ else if (isUnknownTopLevel)
{
+
// TBD: Investigate, not sure about this. -sb
- elem = (ElemTemplateElement)classObject.newInstance();
+ elem = (ElemTemplateElement) classObject.newInstance();
}
else
{
- elem = (ElemTemplateElement)classObject.newInstance();
+ elem = (ElemTemplateElement) classObject.newInstance();
}
+
elem.setDOMBackPointer(handler.getOriginatingNode());
elem.setLocaterInfo(handler.getLocator());
elem.setPrefixes(handler.getNamespaceSupport(), excludeXSLDecl);
- if(elem instanceof ElemLiteralResult)
+
+ if (elem instanceof ElemLiteralResult)
{
- ((ElemLiteralResult)elem).setNamespace(uri);
- ((ElemLiteralResult)elem).setLocalName(localName);
- ((ElemLiteralResult)elem).setRawName(rawName);
+ ((ElemLiteralResult) elem).setNamespace(uri);
+ ((ElemLiteralResult) elem).setLocalName(localName);
+ ((ElemLiteralResult) elem).setRawName(rawName);
+ ((ElemLiteralResult) elem).setIsLiteralResultAsStylesheet(
+ isLREAsStyleSheet);
}
}
- catch(InstantiationException ie)
+ catch (InstantiationException ie)
{
handler.error("Failed creating ElemLiteralResult instance!", ie);
}
- catch(IllegalAccessException iae)
+ catch (IllegalAccessException iae)
{
handler.error("Failed creating ElemLiteralResult instance!", iae);
}
-
+
setPropertiesFromAttributes(handler, rawName, attributes, elem);
-
+
// bit of a hack here...
- if(!isExtension && (elem instanceof ElemLiteralResult))
+ if (!isExtension && (elem instanceof ElemLiteralResult))
{
- isExtension =
((ElemLiteralResult)elem).containsExtensionElementURI(uri);
- if(isExtension)
+ isExtension =
+ ((ElemLiteralResult) elem).containsExtensionElementURI(uri);
+
+ if (isExtension)
{
+
// System.out.println("Creating extension(2): "+uri);
elem = new ElemExtensionCall();
+
elem.setLocaterInfo(handler.getLocator());
elem.setPrefixes(handler.getNamespaceSupport());
- ((ElemLiteralResult)elem).setNamespace(uri);
- ((ElemLiteralResult)elem).setLocalName(localName);
- ((ElemLiteralResult)elem).setRawName(rawName);
+ ((ElemLiteralResult) elem).setNamespace(uri);
+ ((ElemLiteralResult) elem).setLocalName(localName);
+ ((ElemLiteralResult) elem).setRawName(rawName);
setPropertiesFromAttributes(handler, rawName, attributes, elem);
}
}
-
+
appendAndPush(handler, elem);
}
+ /**
+ * Receive notification of the end of an element.
+ *
+ * @param name The element type name.
+ * @param attributes The specified or defaulted attributes.
+ *
+ * NEEDSDOC @param handler
+ * NEEDSDOC @param uri
+ * NEEDSDOC @param localName
+ * NEEDSDOC @param rawName
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.ContentHandler#endElement
+ *
+ * @throws SAXException
+ */
+ public void endElement(
+ StylesheetHandler handler, String uri, String localName, String
rawName)
+ throws SAXException
+ {
+
+ ElemTemplateElement elem = handler.getElemTemplateElement();
+
+ if (elem instanceof ElemLiteralResult)
+ {
+ if (((ElemLiteralResult) elem).getIsLiteralResultAsStylesheet())
+ {
+ handler.popStylesheet();
+ }
+ }
+
+ super.endElement(handler, uri, localName, rawName);
+ }
}
1.2 +14 -10
xml-xalan/java/src/org/apache/xalan/processor/ProcessorNamespaceAlias.java
Index: ProcessorNamespaceAlias.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/processor/ProcessorNamespaceAlias.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ProcessorNamespaceAlias.java 2000/06/19 16:52:07 1.1
+++ ProcessorNamespaceAlias.java 2000/10/30 18:40:39 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,
@@ -57,13 +57,14 @@
package org.apache.xalan.processor;
import org.apache.xalan.templates.NamespaceAlias;
+
import org.xml.sax.SAXException;
import org.xml.sax.Attributes;
/**
* Processor for xsl:namespace-alias markup.
- * 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.
* <pre>
* <!ELEMENT xsl:namespace-alias EMPTY>
* <!ATTLIST xsl:namespace-alias
@@ -76,6 +77,7 @@
*/
class ProcessorNamespaceAlias extends XSLTElementProcessor
{
+
/**
* Receive notification of the start of an xsl:namespace-alias element.
*
@@ -91,6 +93,7 @@
* @param atts The attributes attached to the element. If
* there are no attributes, it shall be an empty
* Attributes object.
+ * NEEDSDOC @param attributes
* @exception org.xml.sax.SAXException Any SAX exception, possibly
* wrapping another exception.
* @see org.apache.xalan.processor.StylesheetHandler#startElement
@@ -98,16 +101,17 @@
* @see org.xml.sax.ContentHandler#startElement
* @see org.xml.sax.ContentHandler#endElement
* @see org.xml.sax.Attributes
+ *
+ * @throws SAXException
*/
- public void startElement (StylesheetHandler handler,
- String uri, String localName,
- String rawName, Attributes attributes)
- throws SAXException
+ public void startElement(
+ StylesheetHandler handler, String uri, String localName, String
rawName, Attributes attributes)
+ throws SAXException
{
+
NamespaceAlias na = new NamespaceAlias();
-
+
setPropertiesFromAttributes(handler, rawName, attributes, na);
-
handler.getStylesheet().setNamespaceAlias(na);
}
}
1.4 +15 -9
xml-xalan/java/src/org/apache/xalan/processor/ProcessorOutputElem.java
Index: ProcessorOutputElem.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/processor/ProcessorOutputElem.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ProcessorOutputElem.java 2000/10/13 02:33:09 1.3
+++ ProcessorOutputElem.java 2000/10/30 18:40:39 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,
@@ -57,10 +57,13 @@
package org.apache.xalan.processor;
import org.apache.serialize.OutputFormat;
+
import java.util.Hashtable;
+
import org.apache.xalan.templates.OutputFormatExtended;
import org.apache.xalan.templates.StylesheetRoot;
import org.apache.xalan.templates.Stylesheet;
+
import org.xml.sax.SAXException;
import org.xml.sax.Attributes;
@@ -70,7 +73,8 @@
* @see <a href="http://www.w3.org/TR/xslt#output">output in XSLT
Specification</a>
*/
class ProcessorOutputElem extends XSLTElementProcessor
-{
+{
+
/**
* Receive notification of the start of an xsl:output element.
*
@@ -86,6 +90,7 @@
* @param atts The attributes attached to the element. If
* there are no attributes, it shall be an empty
* Attributes object.
+ * NEEDSDOC @param attributes
* @exception org.xml.sax.SAXException Any SAX exception, possibly
* wrapping another exception.
* @see org.apache.xalan.processor.StylesheetHandler#startElement
@@ -93,16 +98,17 @@
* @see org.xml.sax.ContentHandler#startElement
* @see org.xml.sax.ContentHandler#endElement
* @see org.xml.sax.Attributes
+ *
+ * @throws SAXException
*/
- public void startElement (StylesheetHandler handler,
- String uri, String localName,
- String rawName, Attributes attributes)
- throws SAXException
+ public void startElement(
+ StylesheetHandler handler, String uri, String localName, String
rawName, Attributes attributes)
+ throws SAXException
{
+
OutputFormatExtended ofe = new OutputFormatExtended();
-
+
setPropertiesFromAttributes(handler, rawName, attributes, ofe);
-
handler.getStylesheet().setOutput(ofe);
}
}
1.2 +16 -11
xml-xalan/java/src/org/apache/xalan/processor/ProcessorPreserveSpace.java
Index: ProcessorPreserveSpace.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/processor/ProcessorPreserveSpace.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ProcessorPreserveSpace.java 2000/06/19 16:52:07 1.1
+++ ProcessorPreserveSpace.java 2000/10/30 18:40:39 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,6 +58,7 @@
import org.xml.sax.SAXException;
import org.xml.sax.Attributes;
+
import java.util.Vector;
/**
@@ -69,15 +70,17 @@
*/
class ProcessorPreserveSpace extends XSLTElementProcessor
{
-
+
/**
- * Bean property to allow setPropertiesFromAttributes to
+ * Bean property to allow setPropertiesFromAttributes to
* get the elements attribute.
*/
private Vector m_elements;
-
+
/**
* Set from the elements attribute.
+ *
+ * NEEDSDOC @param elems
*/
public void setElements(Vector elems)
{
@@ -86,6 +89,8 @@
/**
* Get the property set by setElements().
+ *
+ * NEEDSDOC ($objectName$) @return
*/
Vector getElements()
{
@@ -107,6 +112,7 @@
* @param atts The attributes attached to the element. If
* there are no attributes, it shall be an empty
* Attributes object.
+ * NEEDSDOC @param attributes
* @exception org.xml.sax.SAXException Any SAX exception, possibly
* wrapping another exception.
* @see org.apache.xalan.processor.StylesheetHandler#startElement
@@ -114,15 +120,14 @@
* @see org.xml.sax.ContentHandler#startElement
* @see org.xml.sax.ContentHandler#endElement
* @see org.xml.sax.Attributes
+ *
+ * @throws SAXException
*/
- public void startElement (StylesheetHandler handler,
- String uri, String localName,
- String rawName, Attributes attributes)
- throws SAXException
+ public void startElement(
+ StylesheetHandler handler, String uri, String localName, String
rawName, Attributes attributes)
+ throws SAXException
{
setPropertiesFromAttributes(handler, rawName, attributes, this);
-
handler.getStylesheet().setPreserveSpaces(getElements());
}
-
}
1.2 +10 -7
xml-xalan/java/src/org/apache/xalan/processor/ProcessorStripSpace.java
Index: ProcessorStripSpace.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/processor/ProcessorStripSpace.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ProcessorStripSpace.java 2000/06/19 16:52:07 1.1
+++ ProcessorStripSpace.java 2000/10/30 18:40:39 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,6 +58,7 @@
import org.xml.sax.SAXException;
import org.xml.sax.Attributes;
+
import java.util.Vector;
/**
@@ -69,6 +70,7 @@
*/
class ProcessorStripSpace extends ProcessorPreserveSpace
{
+
/**
* Receive notification of the start of an strip-space element.
*
@@ -84,6 +86,7 @@
* @param atts The attributes attached to the element. If
* there are no attributes, it shall be an empty
* Attributes object.
+ * NEEDSDOC @param attributes
* @exception org.xml.sax.SAXException Any SAX exception, possibly
* wrapping another exception.
* @see org.apache.xalan.processor.StylesheetHandler#startElement
@@ -91,14 +94,14 @@
* @see org.xml.sax.ContentHandler#startElement
* @see org.xml.sax.ContentHandler#endElement
* @see org.xml.sax.Attributes
+ *
+ * @throws SAXException
*/
- public void startElement (StylesheetHandler handler,
- String uri, String localName,
- String rawName, Attributes attributes)
- throws SAXException
+ public void startElement(
+ StylesheetHandler handler, String uri, String localName, String
rawName, Attributes attributes)
+ throws SAXException
{
setPropertiesFromAttributes(handler, rawName, attributes, this);
-
handler.getStylesheet().setStripSpaces(getElements());
}
}
1.2 +60 -0
xml-xalan/java/src/org/apache/xalan/processor/ProcessorStylesheetDoc.java
Index: ProcessorStylesheetDoc.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/processor/ProcessorStylesheetDoc.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ProcessorStylesheetDoc.java 2000/06/19 16:52:08 1.1
+++ ProcessorStylesheetDoc.java 2000/10/30 18:40:40 1.2
@@ -1,5 +1,65 @@
+/*
+ * 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.processor;
+/**
+ * <meta name="usage" content="internal"/>
+ * NEEDSDOC Class ProcessorStylesheetDoc <needs-comment/>
+ */
public class ProcessorStylesheetDoc extends XSLTElementProcessor
{
}
1.3 +33 -19
xml-xalan/java/src/org/apache/xalan/processor/ProcessorStylesheetElement.java
Index: ProcessorStylesheetElement.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/processor/ProcessorStylesheetElement.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ProcessorStylesheetElement.java 2000/08/08 00:27:21 1.2
+++ ProcessorStylesheetElement.java 2000/10/30 18:40:40 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,
@@ -70,6 +70,7 @@
*/
class ProcessorStylesheetElement extends XSLTElementProcessor
{
+
/**
* Receive notification of the start of an strip-space element.
*
@@ -85,6 +86,7 @@
* @param atts The attributes attached to the element. If
* there are no attributes, it shall be an empty
* Attributes object.
+ * NEEDSDOC @param attributes
* @exception org.xml.sax.SAXException Any SAX exception, possibly
* wrapping another exception.
* @see org.apache.xalan.processor.StylesheetHandler#startElement
@@ -92,59 +94,71 @@
* @see org.xml.sax.ContentHandler#startElement
* @see org.xml.sax.ContentHandler#endElement
* @see org.xml.sax.Attributes
+ *
+ * @throws SAXException
*/
- public void startElement (StylesheetHandler handler,
- String uri, String localName,
- String rawName, Attributes attributes)
- throws SAXException
+ public void startElement(
+ StylesheetHandler handler, String uri, String localName, String
rawName, Attributes attributes)
+ throws SAXException
{
+
int stylesheetType = handler.getStylesheetType();
Stylesheet stylesheet;
- if(stylesheetType == StylesheetHandler.STYPE_ROOT)
+
+ if (stylesheetType == StylesheetHandler.STYPE_ROOT)
{
stylesheet = new StylesheetRoot();
}
- else
+ else
{
Stylesheet parent = handler.getStylesheet();
- if(stylesheetType == StylesheetHandler.STYPE_IMPORT)
+
+ if (stylesheetType == StylesheetHandler.STYPE_IMPORT)
{
StylesheetComposed sc = new StylesheetComposed(parent);
+
parent.setImport(sc);
+
stylesheet = sc;
}
else
{
stylesheet = new Stylesheet(parent);
+
parent.setInclude(stylesheet);
}
}
+
stylesheet.setDOMBackPointer(handler.getOriginatingNode());
stylesheet.setLocaterInfo(handler.getLocator());
stylesheet.setPrefixes(handler.getNamespaceSupport());
-
handler.pushStylesheet(stylesheet);
-
- setPropertiesFromAttributes(handler, rawName, attributes,
handler.getStylesheet());
-
+ setPropertiesFromAttributes(handler, rawName, attributes,
+ handler.getStylesheet());
handler.pushElemTemplateElement(handler.getStylesheet());
}
-
+
/**
* Receive notification of the end of an element.
*
* @param name The element type name.
* @param attributes The specified or defaulted attributes.
+ *
+ * NEEDSDOC @param handler
+ * NEEDSDOC @param uri
+ * NEEDSDOC @param localName
+ * NEEDSDOC @param rawName
* @exception org.xml.sax.SAXException Any SAX exception, possibly
* wrapping another exception.
* @see org.xml.sax.ContentHandler#endElement
+ *
+ * @throws SAXException
*/
- public void endElement (StylesheetHandler handler,
- String uri, String localName, String rawName)
- throws SAXException
+ public void endElement(
+ StylesheetHandler handler, String uri, String localName, String
rawName)
+ throws SAXException
{
handler.popElemTemplateElement();
+ handler.popStylesheet();
}
-
-
}
1.3 +16 -8
xml-xalan/java/src/org/apache/xalan/processor/ProcessorTemplate.java
Index: ProcessorTemplate.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/processor/ProcessorTemplate.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ProcessorTemplate.java 2000/08/08 00:27:21 1.2
+++ ProcessorTemplate.java 2000/10/30 18:40:40 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,
@@ -58,6 +58,7 @@
import org.apache.xalan.templates.ElemTemplate;
import org.apache.xalan.templates.ElemTemplateElement;
+
import org.xml.sax.SAXException;
import org.xml.sax.Attributes;
@@ -66,17 +67,24 @@
*/
class ProcessorTemplate extends ProcessorTemplateElem
{
+
/**
- * Append the current template element to the current
- * template element, and then push it onto the current template
+ * Append the current template element to the current
+ * template element, and then push it onto the current template
* element stack.
+ *
+ * NEEDSDOC @param handler
+ * NEEDSDOC @param elem
+ *
+ * @throws SAXException
*/
- protected void appendAndPush(StylesheetHandler handler,
- ElemTemplateElement elem)
- throws SAXException
+ protected void appendAndPush(
+ StylesheetHandler handler, ElemTemplateElement elem)
+ throws SAXException
{
+
super.appendAndPush(handler, elem);
elem.setDOMBackPointer(handler.getOriginatingNode());
- handler.getStylesheet().setTemplate((ElemTemplate)elem);
+ handler.getStylesheet().setTemplate((ElemTemplate) elem);
}
}
1.4 +47 -23
xml-xalan/java/src/org/apache/xalan/processor/ProcessorTemplateElem.java
Index: ProcessorTemplateElem.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/processor/ProcessorTemplateElem.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ProcessorTemplateElem.java 2000/10/02 23:42:33 1.3
+++ ProcessorTemplateElem.java 2000/10/30 18:40:40 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,
@@ -57,13 +57,16 @@
package org.apache.xalan.processor;
import org.apache.xalan.templates.ElemTemplateElement;
+
import org.xml.sax.SAXException;
import org.xml.sax.Attributes;
+
import java.lang.reflect.Method;
import java.lang.reflect.InvocationTargetException;
import java.lang.NoSuchMethodException;
import java.lang.InstantiationException;
import java.lang.IllegalAccessException;
+
import java.util.Vector;
/**
@@ -73,73 +76,94 @@
*/
public class ProcessorTemplateElem extends XSLTElementProcessor
{
+
/**
* Receive notification of the start of an element.
*
* @param name The element type name.
+ *
+ * NEEDSDOC @param handler
+ * NEEDSDOC @param uri
+ * NEEDSDOC @param localName
+ * NEEDSDOC @param rawName
* @param attributes The specified or defaulted attributes.
* @exception org.xml.sax.SAXException Any SAX exception, possibly
* wrapping another exception.
* @see org.xml.sax.ContentHandler#startElement
+ *
+ * @throws SAXException
*/
- public void startElement (StylesheetHandler handler,
- String uri, String localName,
- String rawName, Attributes attributes)
- throws SAXException
+ public void startElement(
+ StylesheetHandler handler, String uri, String localName, String
rawName, Attributes attributes)
+ throws SAXException
{
- ElemTemplateElement parent = handler.getElemTemplateElement();
+ // ElemTemplateElement parent = handler.getElemTemplateElement();
XSLTElementDef def = getElemDef();
Class classObject = def.getClassObject();
-
ElemTemplateElement elem = null;
+
try
{
- elem = (ElemTemplateElement)classObject.newInstance();
+ elem = (ElemTemplateElement) classObject.newInstance();
+
elem.setDOMBackPointer(handler.getOriginatingNode());
elem.setLocaterInfo(handler.getLocator());
elem.setPrefixes(handler.getNamespaceSupport());
}
- catch(InstantiationException ie)
+ catch (InstantiationException ie)
{
handler.error("Failed creating ElemTemplateElement instance!", ie);
}
- catch(IllegalAccessException iae)
+ catch (IllegalAccessException iae)
{
handler.error("Failed creating ElemTemplateElement instance!", iae);
}
-
+
setPropertiesFromAttributes(handler, rawName, attributes, elem);
-
appendAndPush(handler, elem);
}
-
+
/**
- * Append the current template element to the current
- * template element, and then push it onto the current template
+ * Append the current template element to the current
+ * template element, and then push it onto the current template
* element stack.
+ *
+ * NEEDSDOC @param handler
+ * NEEDSDOC @param elem
+ *
+ * @throws SAXException
*/
- protected void appendAndPush(StylesheetHandler handler,
- ElemTemplateElement elem)
- throws SAXException
+ protected void appendAndPush(
+ StylesheetHandler handler, ElemTemplateElement elem)
+ throws SAXException
{
+
ElemTemplateElement parent = handler.getElemTemplateElement();
+
parent.appendChild(elem);
handler.pushElemTemplateElement(elem);
}
-
+
/**
* Receive notification of the end of an element.
*
* @param name The element type name.
* @param attributes The specified or defaulted attributes.
+ *
+ * NEEDSDOC @param handler
+ * NEEDSDOC @param uri
+ * NEEDSDOC @param localName
+ * NEEDSDOC @param rawName
* @exception org.xml.sax.SAXException Any SAX exception, possibly
* wrapping another exception.
* @see org.xml.sax.ContentHandler#endElement
+ *
+ * @throws SAXException
*/
- public void endElement (StylesheetHandler handler,
- String uri, String localName, String rawName)
- throws SAXException
+ public void endElement(
+ StylesheetHandler handler, String uri, String localName, String
rawName)
+ throws SAXException
{
handler.popElemTemplateElement();
}
1.3 +36 -18
xml-xalan/java/src/org/apache/xalan/processor/ProcessorText.java
Index: ProcessorText.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/processor/ProcessorText.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ProcessorText.java 2000/08/08 00:27:22 1.2
+++ ProcessorText.java 2000/10/30 18:40:41 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,
@@ -58,6 +58,7 @@
import org.apache.xalan.templates.ElemTemplateElement;
import org.apache.xalan.templates.ElemText;
+
import org.xml.sax.SAXException;
/**
@@ -67,41 +68,58 @@
*/
public class ProcessorText extends ProcessorTemplateElem
{
+
/**
- * Append the current template element to the current
- * template element, and then push it onto the current template
+ * Append the current template element to the current
+ * template element, and then push it onto the current template
* element stack.
+ *
+ * NEEDSDOC @param handler
+ * NEEDSDOC @param elem
+ *
+ * @throws SAXException
*/
- protected void appendAndPush(StylesheetHandler handler,
- ElemTemplateElement elem)
- throws SAXException
+ protected void appendAndPush(
+ StylesheetHandler handler, ElemTemplateElement elem)
+ throws SAXException
{
+
// Don't push this element onto the element stack.
- ProcessorCharacters charProcessor
- = (ProcessorCharacters)handler.getProcessorFor( null, "text()",
"text" );
- charProcessor.setXslTextElement((ElemText)elem);
+ ProcessorCharacters charProcessor =
+ (ProcessorCharacters) handler.getProcessorFor(null, "text()", "text");
+
+ charProcessor.setXslTextElement((ElemText) elem);
+
ElemTemplateElement parent = handler.getElemTemplateElement();
+
parent.appendChild(elem);
elem.setDOMBackPointer(handler.getOriginatingNode());
}
-
+
/**
* Receive notification of the end of an element.
*
* @param name The element type name.
* @param attributes The specified or defaulted attributes.
+ *
+ * NEEDSDOC @param handler
+ * NEEDSDOC @param uri
+ * NEEDSDOC @param localName
+ * NEEDSDOC @param rawName
* @exception org.xml.sax.SAXException Any SAX exception, possibly
* wrapping another exception.
* @see org.xml.sax.ContentHandler#endElement
+ *
+ * @throws SAXException
*/
- public void endElement (StylesheetHandler handler,
- String uri, String localName, String rawName)
- throws SAXException
+ public void endElement(
+ StylesheetHandler handler, String uri, String localName, String
rawName)
+ throws SAXException
{
- ProcessorCharacters charProcessor
- = (ProcessorCharacters)handler.getProcessorFor( null, "text()",
"text" );
- charProcessor.setXslTextElement(null);
- }
+ ProcessorCharacters charProcessor =
+ (ProcessorCharacters) handler.getProcessorFor(null, "text()", "text");
+ charProcessor.setXslTextElement(null);
+ }
}
1.2 +29 -17
xml-xalan/java/src/org/apache/xalan/processor/ProcessorUnknown.java
Index: ProcessorUnknown.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/processor/ProcessorUnknown.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ProcessorUnknown.java 2000/10/04 23:23:40 1.1
+++ ProcessorUnknown.java 2000/10/30 18:40:41 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,
@@ -64,42 +64,54 @@
import org.apache.xalan.templates.Constants;
import org.apache.xpath.XPath;
import org.apache.xalan.templates.StylesheetRoot;
+
import org.xml.sax.SAXException;
import org.xml.sax.Attributes;
+/**
+ * <meta name="usage" content="internal"/>
+ * NEEDSDOC Class ProcessorUnknown <needs-comment/>
+ */
public class ProcessorUnknown extends ProcessorTemplateElem
{
+
/**
* Receive notification of the start of an element.
*
* @param name The element type name.
+ *
+ * NEEDSDOC @param handler
+ * NEEDSDOC @param uri
+ * NEEDSDOC @param localName
+ * NEEDSDOC @param rawName
* @param attributes The specified or defaulted attributes.
* @exception org.xml.sax.SAXException Any SAX exception, possibly
* wrapping another exception.
* @see org.xml.sax.ContentHandler#startElement
+ *
+ * @throws SAXException
*/
- public void startElement (StylesheetHandler handler,
- String uri, String localName,
- String rawName, Attributes attributes)
- throws SAXException
- {
-
- }
-
+ public void startElement(
+ StylesheetHandler handler, String uri, String localName, String
rawName, Attributes attributes)
+ throws SAXException{}
+
/**
* Receive notification of the end of an element.
*
* @param name The element type name.
* @param attributes The specified or defaulted attributes.
+ *
+ * NEEDSDOC @param handler
+ * NEEDSDOC @param uri
+ * NEEDSDOC @param localName
+ * NEEDSDOC @param rawName
* @exception org.xml.sax.SAXException Any SAX exception, possibly
* wrapping another exception.
* @see org.xml.sax.ContentHandler#endElement
+ *
+ * @throws SAXException
*/
- public void endElement (StylesheetHandler handler,
- String uri, String localName, String rawName)
- throws SAXException
- {
-
- }
-
+ public void endElement(
+ StylesheetHandler handler, String uri, String localName, String
rawName)
+ throws SAXException{}
}
1.2 +13 -4
xml-xalan/java/src/org/apache/xalan/processor/StopParseException.java
Index: StopParseException.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/processor/StopParseException.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- StopParseException.java 2000/10/11 03:36:04 1.1
+++ StopParseException.java 2000/10/30 18:40:41 1.2
@@ -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",
@@ -58,8 +58,17 @@
import org.xml.sax.SAXException;
+/**
+ * <meta name="usage" content="internal"/>
+ * NEEDSDOC Class StopParseException <needs-comment/>
+ */
public class StopParseException extends SAXException
{
+
+ /**
+ * Constructor StopParseException
+ *
+ */
StopParseException()
{
super("Stylesheet PIs found, stop the parse");
1.14 +500 -272
xml-xalan/java/src/org/apache/xalan/processor/StylesheetHandler.java
Index: StylesheetHandler.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/processor/StylesheetHandler.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- StylesheetHandler.java 2000/10/18 17:05:09 1.13
+++ StylesheetHandler.java 2000/10/30 18:40:42 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,7 +57,9 @@
package org.apache.xalan.processor;
import java.net.URL;
+
import java.util.Stack;
+
import org.apache.xalan.templates.Constants;
import org.apache.xalan.templates.ElemTemplateElement;
import org.apache.xalan.templates.StylesheetRoot;
@@ -76,6 +78,7 @@
import org.apache.xpath.functions.Function;
import org.apache.xalan.res.XSLMessages;
import org.apache.xalan.utils.PrefixResolver;
+
import org.xml.sax.Attributes;
import org.xml.sax.ContentHandler;
import org.xml.sax.DTDHandler;
@@ -87,32 +90,36 @@
import org.xml.sax.Locator;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
-import org.w3c.dom.Node;
+import org.w3c.dom.Node;
/**
* <meta name="usage" content="advanced"/>
* Initializes and processes a stylesheet via SAX events.
- * This class acts as essentially a state machine, maintaining
- * a ContentHandler stack, and pushing appropriate content
+ * This class acts as essentially a state machine, maintaining
+ * a ContentHandler stack, and pushing appropriate content
* handlers as parse events occur.
*/
public class StylesheetHandler
- implements EntityResolver, DTDHandler,
- ContentHandler, ErrorHandler, TemplatesBuilder, PrefixResolver,
- NodeConsumer
+ implements EntityResolver, DTDHandler, ContentHandler, ErrorHandler,
+ TemplatesBuilder, PrefixResolver, NodeConsumer
{
+
/**
- * Create a StylesheetHandler object, creating a root stylesheet
+ * Create a StylesheetHandler object, creating a root stylesheet
* as the target.
- * @exception May throw ProcessorException if a StylesheetRoot
+ *
+ * NEEDSDOC @param processor
+ * @exception May throw ProcessorException if a StylesheetRoot
* can not be constructed for some reason.
+ *
+ * @throws ProcessorException
*/
public StylesheetHandler(StylesheetProcessor processor)
- throws ProcessorException
+ throws ProcessorException
{
+
// m_schema = new XSLTSchema();
-
init(processor);
}
@@ -121,39 +128,44 @@
* has been initialized.
*/
private static boolean m_xpathFunctionsInited = false;
-
+
/**
* Do common initialization.
+ *
+ * NEEDSDOC @param processor
*/
void init(StylesheetProcessor processor)
{
+
// Not sure about double-check of this flag, but
// it seems safe...
- if(false == m_xpathFunctionsInited)
+ if (false == m_xpathFunctionsInited)
{
synchronized (this)
{
- if(false == m_xpathFunctionsInited)
+ if (false == m_xpathFunctionsInited)
{
m_xpathFunctionsInited = true;
- Function func
- = new org.apache.xalan.templates.FuncDocument();
+
+ Function func = new org.apache.xalan.templates.FuncDocument();
+
FunctionTable.installFunction("document", func);
-
+
// func = new org.apache.xalan.templates.FuncKey();
// FunctionTable.installFunction("key", func);
-
func = new org.apache.xalan.templates.FuncFormatNumb();
+
FunctionTable.installFunction("format-number", func);
}
}
}
m_stylesheetProcessor = processor;
-
+
// Set the initial content handler.
m_processors.push(m_schema.getElementProcessor());
-
+ this.pushNewNamespaceSupport();
+
//
m_includeStack.push(SystemIDResolver.getAbsoluteURI(this.getBaseIdentifier(),
null));
// initXPath(processor, null);
}
@@ -161,108 +173,143 @@
/**
* Process an expression string into an XPath.
* Must be public for access by the AVT class.
+ *
+ * NEEDSDOC @param str
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws org.xml.sax.SAXException
*/
- public XPath createXPath(String str)
- throws org.xml.sax.SAXException
+ public XPath createXPath(String str) throws org.xml.sax.SAXException
{
return new XPath(str, getLocator(), this, XPath.SELECT);
}
/**
* Process an expression string into an XPath.
+ *
+ * NEEDSDOC @param str
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws org.xml.sax.SAXException
*/
- XPath createMatchPatternXPath(String str)
- throws org.xml.sax.SAXException
+ XPath createMatchPatternXPath(String str) throws org.xml.sax.SAXException
{
return new XPath(str, getLocator(), this, XPath.MATCH);
}
-
+
/**
- * Given a namespace, get the corrisponding prefix. This assumes that
+ * Given a namespace, get the corrisponding prefix. This assumes that
* the PrevixResolver hold's it's own namespace context, or is a namespace
* context itself.
+ *
+ * NEEDSDOC @param prefix
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public String getNamespaceForPrefix(String prefix)
{
- return m_nsSupport.getURI(prefix);
+ return this.getNamespaceSupport().getURI(prefix);
}
/**
* Given a namespace, get the corrisponding prefix.
+ *
+ * NEEDSDOC @param prefix
+ * NEEDSDOC @param context
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public String getNamespaceForPrefix(String prefix, org.w3c.dom.Node
context)
{
+
// Don't need to support this here. Return the current URI for the
prefix,
// ignoring the context.
assert(true, "can't process a context node in StylesheetHandler!");
+
return null;
}
-
- /**
+
+ /**
* Return the base identifier.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public String getBaseIdentifier()
{
+
org.xml.sax.Locator locator = getLocator();
-
+
return (null == locator) ? "" : locator.getSystemId();
}
-
+
/**
* Test to see if the stack contains the given URL.
+ *
+ * NEEDSDOC @param stack
+ * NEEDSDOC @param url
+ *
+ * NEEDSDOC ($objectName$) @return
*/
private boolean stackContains(Stack stack, String url)
{
+
int n = stack.size();
boolean contains = false;
- for(int i = 0; i < n; i++)
+
+ for (int i = 0; i < n; i++)
{
- String url2 = (String)stack.elementAt(i);
- if(url2.equals(url))
+ String url2 = (String) stack.elementAt(i);
+
+ if (url2.equals(url))
{
contains = true;
+
break;
}
}
+
return contains;
}
////////////////////////////////////////////////////////////////////
// Implementation of the TRAX TemplatesBuilder interface.
////////////////////////////////////////////////////////////////////
-
+
/**
- * When this object is used as a ContentHandler or ContentHandler, it will
- * create a Templates object, which the caller can get once
+ * When this object is used as a ContentHandler or ContentHandler, it will
+ * create a Templates object, which the caller can get once
* the SAX events have been completed.
- * @return The stylesheet object that was created during
- * the SAX event process, or null if no stylesheet has
+ * @return The stylesheet object that was created during
+ * the SAX event process, or null if no stylesheet has
* been created.
*
* @version Alpha
* @author <a href="mailto:[EMAIL PROTECTED]">Scott Boag</a>
+ *
+ * @throws TransformException
*/
- public Templates getTemplates()
- throws TransformException
+ public Templates getTemplates() throws TransformException
{
return getStylesheetRoot();
}
-
+
/**
- * Set the base ID (URL or system ID) for the stylesheet
- * created by this builder. This must be set in order to
+ * Set the base ID (URL or system ID) for the stylesheet
+ * created by this builder. This must be set in order to
* resolve relative URLs in the stylesheet.
* @param baseID Base URL for this stylesheet.
*/
public void setBaseID(String baseID)
- {
+ {
pushBaseIndentifier(baseID);
}
////////////////////////////////////////////////////////////////////
// Implementation of the EntityResolver interface.
////////////////////////////////////////////////////////////////////
-
+
/**
* Resolve an external entity.
*
@@ -274,26 +321,26 @@
*
* @param publicId The public identifer, or null if none is
* available.
- * @param systemId The system identifier provided in the XML
+ * @param systemId The system identifier provided in the XML
* document.
* @return The new input source, or null to require the
* default behaviour.
* @exception org.xml.sax.SAXException Any SAX exception, possibly
* wrapping another exception.
* @see org.xml.sax.EntityResolver#resolveEntity
+ *
+ * @throws SAXException
*/
- public InputSource resolveEntity (String publicId, String systemId)
- throws SAXException
+ public InputSource resolveEntity(String publicId, String systemId)
+ throws SAXException
{
- return getCurrentProcessor().resolveEntity (this, publicId, systemId);
+ return getCurrentProcessor().resolveEntity(this, publicId, systemId);
}
-
-
+
////////////////////////////////////////////////////////////////////
// Implementation of DTDHandler interface.
////////////////////////////////////////////////////////////////////
-
-
+
/**
* Receive notification of a notation declaration.
*
@@ -307,12 +354,11 @@
* @param systemId The notation system identifier.
* @see org.xml.sax.DTDHandler#notationDecl
*/
- public void notationDecl (String name, String publicId, String systemId)
+ public void notationDecl(String name, String publicId, String systemId)
{
- getCurrentProcessor().notationDecl (this, name, publicId, systemId);
+ getCurrentProcessor().notationDecl(this, name, publicId, systemId);
}
-
-
+
/**
* Receive notification of an unparsed entity declaration.
*
@@ -323,105 +369,119 @@
* @param notationName The name of the associated notation.
* @see org.xml.sax.DTDHandler#unparsedEntityDecl
*/
- public void unparsedEntityDecl (String name, String publicId,
- String systemId, String notationName)
+ public void unparsedEntityDecl(String name, String publicId,
+ String systemId, String notationName)
{
- getCurrentProcessor().unparsedEntityDecl (this, name, publicId,
- systemId, notationName);
+ getCurrentProcessor().unparsedEntityDecl(this, name, publicId, systemId,
+ notationName);
}
-
+
/**
- * Given a namespace URI, and a local name or a node type, get the
processor
+ * Given a namespace URI, and a local name or a node type, get the
processor
* for the element, or return null if not allowed.
+ *
+ * NEEDSDOC @param uri
+ * NEEDSDOC @param localName
+ * NEEDSDOC @param rawName
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws SAXException
*/
- XSLTElementProcessor getProcessorFor( String uri, String localName,
- String rawName)
- throws SAXException
+ XSLTElementProcessor getProcessorFor(
+ String uri, String localName, String rawName) throws SAXException
{
+
XSLTElementProcessor currentProcessor = getCurrentProcessor();
XSLTElementDef def = currentProcessor.getElemDef();
XSLTElementProcessor elemProcessor = def.getProcessorFor(uri, localName);
-
- if(null == elemProcessor &&
Double.valueOf(getStylesheet().getVersion()).doubleValue() >
Constants.XSLTVERSUPPORTED)
+
+ if (null == elemProcessor
+ && Double.valueOf(getStylesheet().getVersion()).doubleValue()
+ > Constants.XSLTVERSUPPORTED)
{
elemProcessor = def.getProcessorForUnknown(uri, localName);
}
- if(null == elemProcessor)
- error(rawName+" is not allowed in this position in the stylesheet!",
null);
-
+
+ if (null == elemProcessor)
+ error(rawName + " is not allowed in this position in the stylesheet!",
+ null);
+
return elemProcessor;
}
-
////////////////////////////////////////////////////////////////////
// Implementation of ContentHandler interface.
////////////////////////////////////////////////////////////////////
-
-
+
/**
* Receive a Locator object for document events.
- * This is called by the parser to push a locator for the
+ * This is called by the parser to push a locator for the
* stylesheet being parsed. The stack needs to be popped
- * after the stylesheed has been parsed. We pop in in
+ * after the stylesheed has been parsed. We pop in in
* popStylesheet.
- *
+ *
* @param locator A locator for all SAX document events.
* @see org.xml.sax.ContentHandler#setDocumentLocator
* @see org.xml.sax.Locator
*/
- public void setDocumentLocator (Locator locator)
+ public void setDocumentLocator(Locator locator)
{
+
// System.out.println("pushing locator for: "+locator.getSystemId());
m_stylesheetLocatorStack.push(locator);
- }
-
+ }
+
/**
* The level of the stylesheet we are at.
*/
private int m_stylesheetLevel = -1;
-
+
/**
* Receive notification of the beginning of the document.
*
* @exception org.xml.sax.SAXException Any SAX exception, possibly
* wrapping another exception.
* @see org.xml.sax.ContentHandler#startDocument
+ *
+ * @throws SAXException
*/
- public void startDocument ()
- throws SAXException
+ public void startDocument() throws SAXException
{
m_stylesheetLevel++;
}
-
+
/**
* Receive notification of the end of the document.
*
* @exception org.xml.sax.SAXException Any SAX exception, possibly
* wrapping another exception.
* @see org.xml.sax.ContentHandler#endDocument
+ *
+ * @throws SAXException
*/
- public void endDocument ()
- throws SAXException
+ public void endDocument() throws SAXException
{
- if(null != getStylesheetRoot())
+
+ if (null != getStylesheetRoot())
{
- if(0 == m_stylesheetLevel)
+ if (0 == m_stylesheetLevel)
getStylesheetRoot().recompose();
-
+
// Resolve the result prefix tables in the elements.
- getStylesheet().resolvePrefixTables();
+ getLastPoppedStylesheet().resolvePrefixTables();
}
else
throw new SAXException("Did not find the stylesheet root!");
XSLTElementProcessor elemProcessor = getCurrentProcessor();
- if(null != elemProcessor)
+
+ if (null != elemProcessor)
elemProcessor.startNonText(this);
-
+
m_stylesheetLevel--;
}
-
/**
* Receive notification of the start of a Namespace mapping.
*
@@ -435,15 +495,17 @@
* @exception org.xml.sax.SAXException Any SAX exception, possibly
* wrapping another exception.
* @see org.xml.sax.ContentHandler#startPrefixMapping
+ *
+ * @throws SAXException
*/
- public void startPrefixMapping (String prefix, String uri)
- throws SAXException
+ public void startPrefixMapping(String prefix, String uri)
+ throws SAXException
{
+
// m_nsSupport.pushContext();
- m_nsSupport.declarePrefix(prefix, uri);
+ this.getNamespaceSupport().declarePrefix(prefix, uri);
}
-
/**
* Receive notification of the end of a Namespace mapping.
*
@@ -456,74 +518,102 @@
* @exception org.xml.sax.SAXException Any SAX exception, possibly
* wrapping another exception.
* @see org.xml.sax.ContentHandler#endPrefixMapping
+ *
+ * @throws SAXException
*/
- public void endPrefixMapping (String prefix)
- throws SAXException
+ public void endPrefixMapping(String prefix) throws SAXException
{
+
// m_nsSupport.popContext();
}
-
+
/**
* Flush the characters buffer.
+ *
+ * @throws SAXException
*/
- private void flushCharacters()
- throws SAXException
+ private void flushCharacters() throws SAXException
{
+
XSLTElementProcessor elemProcessor = getCurrentProcessor();
- if(null != elemProcessor)
+
+ if (null != elemProcessor)
elemProcessor.startNonText(this);
}
-
+
/**
* Receive notification of the start of an element.
*
* @param name The element type name.
+ *
+ * NEEDSDOC @param uri
+ * NEEDSDOC @param localName
+ * NEEDSDOC @param rawName
* @param attributes The specified or defaulted attributes.
* @exception org.xml.sax.SAXException Any SAX exception, possibly
* wrapping another exception.
* @see org.xml.sax.ContentHandler#startElement
+ *
+ * @throws SAXException
*/
- public void startElement (String uri, String localName,
- String rawName, Attributes attributes)
- throws SAXException
+ public void startElement(
+ String uri, String localName, String rawName, Attributes
attributes)
+ throws SAXException
{
+
m_elementID++;
+
checkForFragmentID(attributes);
-
- if(!m_shouldProcess)
+
+ if (!m_shouldProcess)
return;
- flushCharacters();
- XSLTElementProcessor elemProcessor = getProcessorFor( uri, localName,
rawName );
+
+ flushCharacters();
+
+ XSLTElementProcessor elemProcessor = getProcessorFor(uri, localName,
+ rawName);
+
this.pushProcessor(elemProcessor);
- elemProcessor.startElement (this, uri, localName,
- rawName, attributes);
- m_nsSupport.pushContext();
+ elemProcessor.startElement(this, uri, localName, rawName, attributes);
+ this.getNamespaceSupport().pushContext();
}
-
+
/**
* Receive notification of the end of an element.
*
* @param name The element type name.
* @param attributes The specified or defaulted attributes.
+ *
+ * NEEDSDOC @param uri
+ * NEEDSDOC @param localName
+ * NEEDSDOC @param rawName
* @exception org.xml.sax.SAXException Any SAX exception, possibly
* wrapping another exception.
* @see org.xml.sax.ContentHandler#endElement
+ *
+ * @throws SAXException
*/
- public void endElement (String uri, String localName, String rawName)
- throws SAXException
+ public void endElement(String uri, String localName, String rawName)
+ throws SAXException
{
+
m_elementID--;
- if(!m_shouldProcess)
+
+ if (!m_shouldProcess)
return;
- if((m_elementID+1) == m_fragmentID)
+
+ if ((m_elementID + 1) == m_fragmentID)
m_shouldProcess = false;
+
flushCharacters();
+
XSLTElementProcessor p = getCurrentProcessor();
- p.endElement (this, uri, localName, rawName);
+
+ p.endElement(this, uri, localName, rawName);
this.popProcessor();
- m_nsSupport.popContext();
+ this.getNamespaceSupport().popContext();
}
-
+
/**
* Receive notification of character data inside an element.
*
@@ -534,27 +624,34 @@
* @exception org.xml.sax.SAXException Any SAX exception, possibly
* wrapping another exception.
* @see org.xml.sax.ContentHandler#characters
+ *
+ * @throws SAXException
*/
- public void characters (char ch[], int start, int length)
- throws SAXException
+ public void characters(char ch[], int start, int length) throws
SAXException
{
- if(!m_shouldProcess)
+
+ if (!m_shouldProcess)
return;
+
XSLTElementProcessor elemProcessor = getCurrentProcessor();
XSLTElementDef def = elemProcessor.getElemDef();
- if(def.getType() != XSLTElementDef.T_PCDATA)
+
+ if (def.getType() != XSLTElementDef.T_PCDATA)
elemProcessor = def.getProcessorFor(null, "text()");
-
- if(null == elemProcessor)
+
+ if (null == elemProcessor)
{
+
// If it's whitespace, just ignore it, otherwise flag an error.
- if(!XMLCharacterRecognizer.isWhiteSpace(ch, start, length))
- error("Non-whitespace text is not allowed in this position in the
stylesheet!", null);
+ if (!XMLCharacterRecognizer.isWhiteSpace(ch, start, length))
+ error(
+ "Non-whitespace text is not allowed in this position in the
stylesheet!",
+ null);
}
else
- elemProcessor.characters (this, ch, start, length);
+ elemProcessor.characters(this, ch, start, length);
}
-
+
/**
* Receive notification of ignorable whitespace in element content.
*
@@ -565,16 +662,19 @@
* @exception org.xml.sax.SAXException Any SAX exception, possibly
* wrapping another exception.
* @see org.xml.sax.ContentHandler#ignorableWhitespace
+ *
+ * @throws SAXException
*/
- public void ignorableWhitespace (char ch[], int start, int length)
- throws SAXException
+ public void ignorableWhitespace(char ch[], int start, int length)
+ throws SAXException
{
- if(!m_shouldProcess)
+
+ if (!m_shouldProcess)
return;
- getCurrentProcessor().ignorableWhitespace (this, ch, start, length);
+
+ getCurrentProcessor().ignorableWhitespace(this, ch, start, length);
}
-
-
+
/**
* Receive notification of a processing instruction.
*
@@ -589,17 +689,20 @@
* @exception org.xml.sax.SAXException Any SAX exception, possibly
* wrapping another exception.
* @see org.xml.sax.ContentHandler#processingInstruction
+ *
+ * @throws SAXException
*/
- public void processingInstruction (String target, String data)
- throws SAXException
+ public void processingInstruction(String target, String data)
+ throws SAXException
{
- if(!m_shouldProcess)
+
+ if (!m_shouldProcess)
return;
+
flushCharacters();
- getCurrentProcessor().processingInstruction (this, target, data);
+ getCurrentProcessor().processingInstruction(this, target, data);
}
-
/**
* Receive notification of a skipped entity.
*
@@ -612,45 +715,55 @@
* @exception org.xml.sax.SAXException Any SAX exception, possibly
* wrapping another exception.
* @see org.xml.sax.ContentHandler#processingInstruction
+ *
+ * @throws SAXException
*/
- public void skippedEntity (String name)
- throws SAXException
+ public void skippedEntity(String name) throws SAXException
{
- if(!m_shouldProcess)
+
+ if (!m_shouldProcess)
return;
- getCurrentProcessor().skippedEntity (this, name);
+
+ getCurrentProcessor().skippedEntity(this, name);
}
-
-
+
////////////////////////////////////////////////////////////////////
// Implementation of the ErrorHandler interface.
////////////////////////////////////////////////////////////////////
-
+
/**
* <meta name="usage" content="internal"/>
* Warn the user of an problem.
+ *
+ * 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 SAXException
*/
- public void warn(int msg, Object args[])
- throws SAXException
+ public void warn(int msg, Object args[]) throws SAXException
{
+
String formattedMsg = m_XSLMessages.createWarning(msg, args);
Locator locator = getLocator();
-
- ErrorHandler handler = m_stylesheetProcessor.getErrorHandler ();
- if(null != handler)
+ ErrorHandler handler = m_stylesheetProcessor.getErrorHandler();
+
+ if (null != handler)
handler.warning(new ProcessorException(formattedMsg, locator));
}
-
+
/**
* <meta name="usage" content="internal"/>
* Assert that a condition is true. If it is not true, throw an error.
+ *
+ * NEEDSDOC @param condition
+ * NEEDSDOC @param msg
* @exception throws Runtime Exception.
*/
private void assert(boolean condition, String msg)
{
- if(!condition)
+ if (!condition)
throw new RuntimeException(msg);
}
@@ -658,18 +771,24 @@
* <meta name="usage" content="internal"/>
* Tell the user of an error, and probably throw an
* exception.
+ *
+ * NEEDSDOC @param msg
+ * NEEDSDOC @param e
* @exception XSLProcessorException thrown if the active ProblemListener
and XPathContext decide
* the error condition is severe enough to halt processing.
+ *
+ * @throws SAXException
*/
- protected void error(String msg, Exception e)
- throws SAXException
+ protected void error(String msg, Exception e) throws SAXException
{
+
Locator locator = getLocator();
-
- ErrorHandler handler = m_stylesheetProcessor.getErrorHandler ();
- ProcessorException pe = (null == e) ? new ProcessorException(msg,
locator) :
- new ProcessorException(msg,
locator, e);
- if(null != handler)
+ ErrorHandler handler = m_stylesheetProcessor.getErrorHandler();
+ ProcessorException pe = (null == e)
+ ? new ProcessorException(msg, locator)
+ : new ProcessorException(msg, locator, e);
+
+ if (null != handler)
handler.fatalError(pe);
else
throw pe;
@@ -679,16 +798,24 @@
* <meta name="usage" content="internal"/>
* Tell the user of an error, and probably throw an
* exception.
+ *
+ * NEEDSDOC @param msg
+ * NEEDSDOC @param args
+ * NEEDSDOC @param e
* @exception XSLProcessorException thrown if the active ProblemListener
and XPathContext decide
* the error condition is severe enough to halt processing.
+ *
+ * @throws SAXException
*/
protected void error(int msg, Object args[], Exception e)
- throws SAXException
+ throws SAXException
{
- String formattedMsg = m_XSLMessages.createMessage(msg, args);
+
+ String formattedMsg = m_XSLMessages.createMessage(msg, args);
+
error(formattedMsg, e);
}
-
+
/**
* Receive notification of a parser warning.
*
@@ -697,18 +824,19 @@
* wrapping another exception.
* @see org.xml.sax.ErrorHandler#warning
* @see org.xml.sax.SAXParseException
+ *
+ * @throws SAXException
*/
- public void warning (SAXParseException e)
- throws SAXException
+ public void warning(SAXParseException e) throws SAXException
{
+
// Need to set up a diagnosticsWriter here?
- System.out.println("WARNING: "+e.getMessage());
- System.out.println(" ID: "+e.getSystemId()
- +" Line #"+e.getLineNumber()
- +" Column #"+e.getColumnNumber());
+ System.out.println("WARNING: " + e.getMessage());
+ System.out.println(" ID: " + e.getSystemId() + " Line #"
+ + e.getLineNumber() + " Column #"
+ + e.getColumnNumber());
}
-
-
+
/**
* Receive notification of a recoverable parser error.
*
@@ -717,18 +845,19 @@
* wrapping another exception.
* @see org.xml.sax.ErrorHandler#warning
* @see org.xml.sax.SAXParseException
+ *
+ * @throws SAXException
*/
- public void error (SAXParseException e)
- throws SAXException
+ public void error(SAXParseException e) throws SAXException
{
+
// Need to set up a diagnosticsWriter here?
- System.out.println("RECOVERABLE ERROR: "+e.getMessage());
- System.out.println(" ID: "+e.getSystemId()
- +" Line #"+e.getLineNumber()
- +" Column #"+e.getColumnNumber());
+ System.out.println("RECOVERABLE ERROR: " + e.getMessage());
+ System.out.println(" ID: " + e.getSystemId() + " Line #"
+ + e.getLineNumber() + " Column #"
+ + e.getColumnNumber());
}
-
-
+
/**
* Report a fatal XML parsing error.
*
@@ -745,61 +874,68 @@
* wrapping another exception.
* @see org.xml.sax.ErrorHandler#fatalError
* @see org.xml.sax.SAXParseException
+ *
+ * @throws SAXException
*/
- public void fatalError (SAXParseException e)
- throws SAXException
+ public void fatalError(SAXParseException e) throws SAXException
{
throw e;
}
-
+
/**
- * If we have a URL to a XML fragment, this is set
+ * If we have a URL to a XML fragment, this is set
* to false until the ID is found.
* (warning: I worry that this should be in a stack).
*/
private boolean m_shouldProcess = true;
-
+
/**
- * If we have a URL to a XML fragment, the value is stored
- * in this string, and the m_shouldProcess flag is set to
+ * If we have a URL to a XML fragment, the value is stored
+ * in this string, and the m_shouldProcess flag is set to
* false until we match an ID with this string.
* (warning: I worry that this should be in a stack).
*/
private String m_fragmentIDString;
-
- /**
- * Keep track of the elementID, so we can tell when
- * is has completed. This isn't a real ID, but rather
- * a nesting level. However, it's good enough for
+
+ /**
+ * Keep track of the elementID, so we can tell when
+ * is has completed. This isn't a real ID, but rather
+ * a nesting level. However, it's good enough for
* our purposes.
* (warning: I worry that this should be in a stack).
*/
private int m_elementID = 0;
-
+
/**
* The ID of the fragment that has been found
* (warning: I worry that this should be in a stack).
*/
private int m_fragmentID = 0;
-
+
/**
- * Check to see if an ID attribute matched the #id, called
+ * Check to see if an ID attribute matched the #id, called
* from startElement.
+ *
+ * NEEDSDOC @param attributes
*/
private void checkForFragmentID(Attributes attributes)
{
- if(!m_shouldProcess)
+
+ if (!m_shouldProcess)
{
- if((null != attributes) && (null != m_fragmentIDString))
+ if ((null != attributes) && (null != m_fragmentIDString))
{
int n = attributes.getLength();
- for(int i = 0; i < n; i++)
+
+ for (int i = 0; i < n; i++)
{
String type = attributes.getType(i);
- if(type.equalsIgnoreCase("ID"))
+
+ if (type.equalsIgnoreCase("ID"))
{
String val = attributes.getValue(i);
- if(val.equalsIgnoreCase(m_fragmentIDString))
+
+ if (val.equalsIgnoreCase(m_fragmentIDString))
{
m_shouldProcess = true;
m_fragmentID = m_elementID;
@@ -809,38 +945,50 @@
}
}
}
-
- /**
- * The XSLT Processor for needed services.
+
+ /**
+ * The XSLT Processor for needed services.
*/
private StylesheetProcessor m_stylesheetProcessor;
-
+
/**
* Get the XSLT Processor for needed services.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
StylesheetProcessor getStylesheetProcessor()
{
return m_stylesheetProcessor;
}
-
+
+ /** NEEDSDOC Field STYPE_ROOT */
static final int STYPE_ROOT = 1;
+
+ /** NEEDSDOC Field STYPE_INCLUDE */
static final int STYPE_INCLUDE = 2;
+
+ /** NEEDSDOC Field STYPE_IMPORT */
static final int STYPE_IMPORT = 3;
-
+
+ /** NEEDSDOC Field m_stylesheetType */
private int m_stylesheetType = STYPE_ROOT;
-
+
/**
- * Get the type of stylesheet that should be built
+ * Get the type of stylesheet that should be built
* or is being processed.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
int getStylesheetType()
{
return m_stylesheetType;
}
-
+
/**
- * Set the type of stylesheet that should be built
+ * Set the type of stylesheet that should be built
* or is being processed.
+ *
+ * NEEDSDOC @param type
*/
void setStylesheetType(int type)
{
@@ -851,60 +999,94 @@
* The stack of stylesheets being processed.
*/
private Stack m_stylesheets = new Stack();
-
+
/**
* Return the stylesheet that this handler is constructing.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
Stylesheet getStylesheet()
{
- return (Stylesheet)m_stylesheets.peek();
+ return (m_stylesheets.size() == 0)
+ ? null : (Stylesheet) m_stylesheets.peek();
}
-
+
/**
* Return the stylesheet that this handler is constructing.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
+ Stylesheet getLastPoppedStylesheet()
+ {
+ return m_lastPoppedStylesheet;
+ }
+
+ /**
+ * Return the stylesheet that this handler is constructing.
+ *
+ * NEEDSDOC ($objectName$) @return
+ */
public StylesheetRoot getStylesheetRoot()
{
- return (m_stylesheets.size() > 0)
- ? (StylesheetRoot)m_stylesheets.elementAt(0) : null;
+ return m_stylesheetRoot;
}
+ /** NEEDSDOC Field m_stylesheetRoot */
+ StylesheetRoot m_stylesheetRoot;
+
+ /** NEEDSDOC Field m_lastPoppedStylesheet */
+ Stylesheet m_lastPoppedStylesheet;
+
/**
* Return the stylesheet that this handler is constructing.
+ *
+ * NEEDSDOC @param s
*/
void pushStylesheet(Stylesheet s)
{
+
+ if (m_stylesheets.size() == 0)
+ m_stylesheetRoot = (StylesheetRoot) s;
+
m_stylesheets.push(s);
}
-
+
/**
* Return the stylesheet that this handler is constructing.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
Stylesheet popStylesheet()
{
+
// The stylesheetLocatorStack needs to be popped because
// a locator was pushed in for this stylesheet by the SAXparser by
calling
// setDocumentLocator().
m_stylesheetLocatorStack.pop();
- return (Stylesheet)m_stylesheets.pop();
+
+ m_lastPoppedStylesheet = (Stylesheet) m_stylesheets.pop();
+
+ return m_lastPoppedStylesheet;
}
/**
* The stack of current processors.
*/
private Stack m_processors = new Stack();
-
+
/**
* Get the current XSLTElementProcessor at the top of the stack.
* @return Valid XSLTElementProcessor, which should never be null.
*/
XSLTElementProcessor getCurrentProcessor()
{
- return (XSLTElementProcessor)m_processors.peek();
+ return (XSLTElementProcessor) m_processors.peek();
}
-
+
/**
* Push the current XSLTElementProcessor onto the top of the stack.
+ *
+ * NEEDSDOC @param processor
*/
void pushProcessor(XSLTElementProcessor processor)
{
@@ -917,49 +1099,54 @@
*/
XSLTElementProcessor popProcessor()
{
- return (XSLTElementProcessor)m_processors.pop();
+ return (XSLTElementProcessor) m_processors.pop();
}
-
+
/**
- * The root of the XSLT Schema, which tells us how to
+ * The root of the XSLT Schema, which tells us how to
* transition content handlers, create elements, etc.
- * For the moment at least, this can't be static, since
+ * For the moment at least, this can't be static, since
* the processors store state.
*/
private XSLTSchema m_schema = new XSLTSchema();
-
+
/**
- * Get the root of the XSLT Schema, which tells us how to
+ * Get the root of the XSLT Schema, which tells us how to
* transition content handlers, create elements, etc.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
XSLTSchema getSchema()
{
return m_schema;
}
-
+
/**
* The stack of elements, pushed and popped as events occur.
*/
private Stack m_elems = new Stack();
-
+
/**
* Get the current ElemTemplateElement at the top of the stack.
* @return Valid ElemTemplateElement, which may be null.
*/
ElemTemplateElement getElemTemplateElement()
{
+
try
{
- return (ElemTemplateElement)m_elems.peek();
+ return (ElemTemplateElement) m_elems.peek();
}
- catch(java.util.EmptyStackException ese)
+ catch (java.util.EmptyStackException ese)
{
return null;
}
}
-
+
/**
* Push the current XSLTElementProcessor to the top of the stack.
+ *
+ * NEEDSDOC @param elem
*/
void pushElemTemplateElement(ElemTemplateElement elem)
{
@@ -972,7 +1159,7 @@
*/
ElemTemplateElement popElemTemplateElement()
{
- return (ElemTemplateElement)m_elems.pop();
+ return (ElemTemplateElement) m_elems.pop();
}
/**
@@ -981,37 +1168,43 @@
* to being the first elements.
*/
private boolean m_foundNotImport = false;
-
+
/**
* A XSLMessages instance capable of producing user messages.
*/
private static XSLMessages m_XSLMessages = new XSLMessages();
-
+
/**
* Get an XSLMessages instance capable of producing user messages.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
XSLMessages getXSLMessages()
{
return m_XSLMessages;
}
-
+
/**
* This will act as a stack to keep track of the
* current include base.
*/
Stack m_baseIdentifiers = new Stack();
-
+
/**
* Push a base identifier onto the base URI stack.
+ *
+ * NEEDSDOC @param baseID
*/
void pushBaseIndentifier(String baseID)
{
- if(null != baseID)
+
+ if (null != baseID)
{
int posOfHash = baseID.indexOf('#');
- if(posOfHash > -1)
+
+ if (posOfHash > -1)
{
- m_fragmentIDString = baseID.substring(posOfHash+1);
+ m_fragmentIDString = baseID.substring(posOfHash + 1);
m_shouldProcess = false;
}
else
@@ -1019,111 +1212,146 @@
}
else
m_shouldProcess = true;
+
m_baseIdentifiers.push(baseID);
}
-
+
/**
* Pop a base URI from the stack.
* @return baseIdentifier.
*/
String popBaseIndentifier()
{
- return (String)m_baseIdentifiers.pop();
+ return (String) m_baseIdentifiers.pop();
}
-
+
/**
* The top of this stack should contain the currently processed
* stylesheet SAX locator object.
*/
private Stack m_stylesheetLocatorStack = new Stack();
-
+
/**
* Get the current stylesheet Locator object.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public Locator getLocator()
{
- if(m_stylesheetLocatorStack.isEmpty())
+
+ if (m_stylesheetLocatorStack.isEmpty())
{
- org.xml.sax.helpers.LocatorImpl locator
- = new org.xml.sax.helpers.LocatorImpl();
+ org.xml.sax.helpers.LocatorImpl locator =
+ new org.xml.sax.helpers.LocatorImpl();
+
locator.setSystemId(this.getStylesheetProcessor().getDOMsystemID());
m_stylesheetLocatorStack.push(locator);
}
- return ((Locator)m_stylesheetLocatorStack.peek());
+
+ return ((Locator) m_stylesheetLocatorStack.peek());
}
-
+
/**
- * A stack of URL hrefs for imported stylesheets. This is
+ * A stack of URL hrefs for imported stylesheets. This is
* used to diagnose circular imports.
*/
private Stack m_importStack = new Stack();
-
+
/**
* Push an import href onto the stylesheet stack.
+ *
+ * NEEDSDOC @param hrefUrl
*/
void pushImportURL(String hrefUrl)
{
m_importStack.push(hrefUrl);
}
-
+
/**
- * See if the imported stylesheet stack already contains
+ * See if the imported stylesheet stack already contains
* the given URL.
+ *
+ * NEEDSDOC @param hrefUrl
+ *
+ * NEEDSDOC ($objectName$) @return
*/
boolean importStackContains(String hrefUrl)
{
return stackContains(m_importStack, hrefUrl);
}
-
+
/**
* Pop an import href from the stylesheet stack.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
String popImportURL()
{
- return (String)m_importStack.pop();
+ return (String) m_importStack.pop();
}
-
/**
* If this is set to true, we've already warned about using the
* older XSLT namespace URL.
*/
private boolean warnedAboutOldXSLTNamespace = false;
-
+
/**
* The query/pattern-matcher object.
*/
private XPathParser m_xpathProcessor = new XPathParser();
-
+
+ /** NEEDSDOC Field m_nsSupportStack */
+ Stack m_nsSupportStack = new Stack();
+
+ /**
+ * NEEDSDOC Method pushNewNamespaceSupport
+ *
+ */
+ void pushNewNamespaceSupport()
+ {
+ m_nsSupportStack.push(new NamespaceSupport());
+ }
+
/**
- * Use the SAX2 helper class to track namespaces.
+ * NEEDSDOC Method popNamespaceSupport
+ *
*/
- private NamespaceSupport m_nsSupport = new NamespaceSupport();
-
+ void popNamespaceSupport()
+ {
+ m_nsSupportStack.pop();
+ }
+
/**
* Get the NamespaceSupport object.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
NamespaceSupport getNamespaceSupport()
{
- return m_nsSupport;
+ return (NamespaceSupport) m_nsSupportStack.peek();
}
-
+
+ /** NEEDSDOC Field m_originatingNode */
private Node m_originatingNode;
-
+
/**
* Set the node that is originating the SAX event.
+ *
+ * NEEDSDOC @param n
*/
public void setOriginatingNode(Node n)
{
m_originatingNode = n;
}
- /**
+ /**
* Set the node that is originating the SAX event.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public Node getOriginatingNode()
{
return m_originatingNode;
}
-
}
1.3 +94 -55
xml-xalan/java/src/org/apache/xalan/processor/StylesheetPIHandler.java
Index: StylesheetPIHandler.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/processor/StylesheetPIHandler.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- StylesheetPIHandler.java 2000/10/11 03:36:04 1.2
+++ StylesheetPIHandler.java 2000/10/30 18:40:42 1.3
@@ -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",
@@ -60,8 +60,10 @@
import org.xml.sax.SAXException;
import org.xml.sax.InputSource;
import org.xml.sax.Attributes;
+
import java.util.Vector;
import java.util.StringTokenizer;
+
import org.apache.xalan.utils.SystemIDResolver;
/**
@@ -70,47 +72,68 @@
*/
public class StylesheetPIHandler extends DefaultHandler
{
+
+ /** NEEDSDOC Field STARTELEM_FOUND_MSG */
static final String STARTELEM_FOUND_MSG = "##startElement found";
-
+
+ /** NEEDSDOC Field m_source */
InputSource m_source;
- String m_media;
+
+ /** NEEDSDOC Field m_media */
+ String m_media;
+
+ /** NEEDSDOC Field m_title */
String m_title;
+
+ /** NEEDSDOC Field m_charset */
String m_charset;
+
+ /** NEEDSDOC Field m_stylesheets */
Vector m_stylesheets = new Vector();
-
+
/**
* Construct a StylesheetPIHandler instance.
+ *
+ * NEEDSDOC @param source
+ * NEEDSDOC @param media
+ * NEEDSDOC @param title
+ * NEEDSDOC @param charset
*/
- public StylesheetPIHandler(InputSource source,
- String media,
- String title,
+ public StylesheetPIHandler(InputSource source, String media, String title,
String charset)
{
+
m_source = source;
m_media = media;
m_title = title;
m_charset = charset;
}
-
+
/**
* Return all stylesheets found that match the constraints.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public InputSource[] getAssociatedStylesheets()
{
+
int sz = m_stylesheets.size();
- if(sz > 0)
+
+ if (sz > 0)
{
InputSource[] inputs = new InputSource[sz];
- for(int i = 0; i < sz; i++)
+
+ for (int i = 0; i < sz; i++)
{
- inputs[i] = (InputSource)m_stylesheets.elementAt(i);
+ inputs[i] = (InputSource) m_stylesheets.elementAt(i);
}
+
return inputs;
}
else
return null;
}
-
+
/**
* Handle the xml-stylesheet processing instruction.
*
@@ -120,105 +143,121 @@
* @exception org.xml.sax.SAXException Any SAX exception, possibly
* wrapping another exception.
* @see org.xml.sax.ContentHandler#processingInstruction
+ *
+ * @throws SAXException
* @see <a href="http://www.w3.org/TR/xml-stylesheet/">Associating Style
Sheets with XML documents, Version 1.0</a>
*/
- public void processingInstruction (String target, String data)
- throws SAXException
+ public void processingInstruction(String target, String data)
+ throws SAXException
{
- if(target.equals("xml-stylesheet"))
- {
- String href = null; // CDATA #REQUIRED
- String type = null; // CDATA #REQUIRED
- String title = null; // CDATA #IMPLIED
- String media = null; // CDATA #IMPLIED
- String charset = null; // CDATA #IMPLIED
- boolean alternate = false; // (yes|no) "no"
+ if (target.equals("xml-stylesheet"))
+ {
+ String href = null; // CDATA #REQUIRED
+ String type = null; // CDATA #REQUIRED
+ String title = null; // CDATA #IMPLIED
+ String media = null; // CDATA #IMPLIED
+ String charset = null; // CDATA #IMPLIED
+ boolean alternate = false; // (yes|no) "no"
StringTokenizer tokenizer = new StringTokenizer(data, " \t=");
- while(tokenizer.hasMoreTokens())
+
+ while (tokenizer.hasMoreTokens())
{
String name = tokenizer.nextToken();
- if(name.equals("type"))
+
+ if (name.equals("type"))
{
String typeVal = tokenizer.nextToken();
- type = typeVal.substring(1, typeVal.length()-1);
+
+ type = typeVal.substring(1, typeVal.length() - 1);
}
- else if(name.equals("href"))
+ else if (name.equals("href"))
{
href = tokenizer.nextToken();
- href = href.substring(1, href.length()-1);
-
- href = SystemIDResolver.getAbsoluteURI(href,
m_source.getSystemId());
+ href = href.substring(1, href.length() - 1);
+ href = SystemIDResolver.getAbsoluteURI(href,
+ m_source.getSystemId());
}
- else if(name.equals("title"))
+ else if (name.equals("title"))
{
title = tokenizer.nextToken();
- title = title.substring(1, title.length()-1);
+ title = title.substring(1, title.length() - 1);
}
- else if(name.equals("media"))
+ else if (name.equals("media"))
{
media = tokenizer.nextToken();
- media = media.substring(1, media.length()-1);
+ media = media.substring(1, media.length() - 1);
}
- else if(name.equals("charset"))
+ else if (name.equals("charset"))
{
charset = tokenizer.nextToken();
- charset = charset.substring(1, charset.length()-1);
+ charset = charset.substring(1, charset.length() - 1);
}
- else if(name.equals("alternate"))
+ else if (name.equals("alternate"))
{
String alternateStr = tokenizer.nextToken();
- alternate = alternateStr.substring(1,
alternateStr.length()-1).equals("yes");
+
+ alternate = alternateStr.substring(1, alternateStr.length()
+ - 1).equals("yes");
}
}
- if((null != type) && type.equals("text/xsl") && (null != href))
+ if ((null != type) && type.equals("text/xsl") && (null != href))
{
- if(null != m_media)
+ if (null != m_media)
{
- if(null != media)
+ if (null != media)
{
- if(!media.equals(m_media))
+ if (!media.equals(m_media))
return;
}
else
return;
}
- if(null != m_charset)
+
+ if (null != m_charset)
{
- if(null != charset)
+ if (null != charset)
{
- if(!charset.equals(m_charset))
+ if (!charset.equals(m_charset))
return;
}
else
return;
}
- if(null != m_title)
+
+ if (null != m_title)
{
- if(null != title)
+ if (null != title)
{
- if(!title.equals(m_title))
+ if (!title.equals(m_title))
return;
}
else
return;
}
+
m_stylesheets.addElement(new InputSource(href));
}
}
}
-
+
/**
* The spec notes that "The xml-stylesheet processing instruction is
allowed only in the prolog of an XML document.",
* so, at least for right now, I'm going to go ahead an throw a
SAXException
* in order to stop the parse.
+ *
+ * NEEDSDOC @param namespaceURI
+ * NEEDSDOC @param localName
+ * NEEDSDOC @param qName
+ * NEEDSDOC @param atts
+ *
+ * @throws SAXException
*/
- public void startElement (String namespaceURI, String localName,
- String qName, Attributes atts)
- throws SAXException
+ public void startElement(
+ String namespaceURI, String localName, String qName, Attributes
atts)
+ throws SAXException
{
throw new StopParseException();
}
-
}
1.10 +191 -106
xml-xalan/java/src/org/apache/xalan/processor/StylesheetProcessor.java
Index: StylesheetProcessor.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/processor/StylesheetProcessor.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- StylesheetProcessor.java 2000/10/13 02:33:09 1.9
+++ StylesheetProcessor.java 2000/10/30 18:40:42 1.10
@@ -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,
@@ -67,7 +67,6 @@
import org.apache.xalan.utils.TreeWalker;
import org.apache.xalan.utils.SystemIDResolver;
-
import org.apache.trax.Processor;
import org.apache.trax.ProcessorException;
import org.apache.trax.Templates;
@@ -79,64 +78,89 @@
import java.io.StringWriter;
import java.io.PrintWriter;
import java.io.StringReader;
+
import java.util.Properties;
import java.util.Enumeration;
/**
- * The StylesheetProcessor, which implements the TRaX Processor
- * interface, processes XSLT stylesheets into a Templates object
+ * The StylesheetProcessor, which implements the TRaX Processor
+ * interface, processes XSLT stylesheets into a Templates object
* (a StylesheetRoot).
*/
public class StylesheetProcessor extends Processor
-{
- public static String XSLT_PROPERTIES =
"/org/apache/xalan/res/XSLTInfo.properties";
+{
+ /** NEEDSDOC Field XSLT_PROPERTIES */
+ public static String XSLT_PROPERTIES =
+ "/org/apache/xalan/res/XSLTInfo.properties";
+
+ /** NEEDSDOC Field isInited */
private static boolean isInited = false;
-
+
+ /**
+ * Constructor StylesheetProcessor
+ *
+ */
public StylesheetProcessor()
{
loadPropertyFileToSystem(XSLT_PROPERTIES);
}
-
+
/*
- * Retrieve a propery bundle from a specified file and load it
+ * Retrieve a propery bundle from a specified file and load it
* int the System properties.
- * @param file The string name of the property file.
+ * @param file The string name of the property file.
*/
- private static void loadPropertyFileToSystem(String file)
+
+ /**
+ * NEEDSDOC Method loadPropertyFileToSystem
+ *
+ *
+ * NEEDSDOC @param file
+ */
+ private static void loadPropertyFileToSystem(String file)
{
- if(false == isInited)
+
+ if (false == isInited)
{
try
{
InputStream is;
+
try
- {
+ {
Properties props = new Properties();
- is = Process.class.getResourceAsStream(file);
+
+ is = Process.class.getResourceAsStream(file);
+
// get a buffered version
- BufferedInputStream bis = new BufferedInputStream (is);
- props.load (bis); // and load
up the property bag from this
- bis.close (); // close
out after reading
+ BufferedInputStream bis = new BufferedInputStream(is);
+
+ props.load(bis); // and load up the property bag from this
+ bis.close(); // close out after reading
+
// OK, now we only want to set system properties that
// are not already set.
Properties systemProps = System.getProperties();
Enumeration propEnum = props.propertyNames();
- while(propEnum.hasMoreElements())
+
+ while (propEnum.hasMoreElements())
{
- String prop = (String)propEnum.nextElement();
- if(!systemProps.containsKey(prop))
+ String prop = (String) propEnum.nextElement();
+
+ if (!systemProps.containsKey(prop))
systemProps.put(prop, props.getProperty(prop));
}
+
System.setProperties(systemProps);
+
isInited = true;
- }
- catch (Exception ex)
- {
}
+ catch (Exception ex){}
}
- catch(SecurityException se)
+ catch (SecurityException se)
{
+
// In this case the caller is required to have
// the needed attributes already defined.
}
@@ -145,205 +169,261 @@
/**
* Process the source into a templates object.
- *
+ *
* @param source An object that holds a URL, input stream, etc.
* @returns A Templates object capable of being used for transformation
purposes.
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws IOException
+ * @throws ProcessorException
+ * @throws SAXException
*/
public Templates process(InputSource source)
- throws ProcessorException, SAXException, IOException
+ throws ProcessorException, SAXException, IOException
{
+
TemplatesBuilder builder = getTemplatesBuilder();
+
builder.setBaseID(source.getSystemId());
+
XMLReader reader = this.getXMLReader();
- if(null == reader)
+
+ if (null == reader)
{
reader = XMLReaderFactory.createXMLReader();
}
+
// If you set the namespaces to true, we'll end up getting double
// xmlns attributes. Needs to be fixed. -sb
// reader.setFeature("http://xml.org/sax/features/namespace-prefixes",
true);
- try {
- reader.setFeature("http://apache.org/xml/features/validation/dynamic",
true);
- } catch( SAXException ex ) {
- // feature not recognized
+ try
+ {
+ reader.setFeature("http://apache.org/xml/features/validation/dynamic",
+ true);
+ }
+ catch (SAXException ex)
+ {
+
+ // feature not recognized
}
+
reader.setContentHandler(builder);
reader.parse(source);
+
return builder.getTemplates();
}
-
+
/**
- * Process the stylesheet from a DOM tree, if the
- * processor supports the "http://xml.org/trax/features/dom/input"
- * feature.
- *
- * @param node A DOM tree which must contain
+ * Process the stylesheet from a DOM tree, if the
+ * processor supports the "http://xml.org/trax/features/dom/input"
+ * feature.
+ *
+ * @param node A DOM tree which must contain
* valid transform instructions that this processor understands.
* @returns A Templates object capable of being used for transformation
purposes.
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws ProcessorException
*/
- public Templates processFromNode(Node node)
- throws ProcessorException
+ public Templates processFromNode(Node node) throws ProcessorException
{
+
try
{
TemplatesBuilder builder = getTemplatesBuilder();
TreeWalker walker = new TreeWalker(builder);
+
walker.traverse(node);
+
return builder.getTemplates();
}
- catch(SAXException se)
+ catch (SAXException se)
{
throw new ProcessorException("processFromNode failed", se);
}
}
-
+
/**
- * The systemID that was specified in
+ * The systemID that was specified in
* processFromNode(Node node, String systemID).
*/
private String m_DOMsystemID = "";
-
+
/**
- * The systemID that was specified in
+ * The systemID that was specified in
* processFromNode(Node node, String systemID).
+ *
+ * NEEDSDOC ($objectName$) @return
*/
String getDOMsystemID()
{
return m_DOMsystemID;
}
-
+
/**
- * Process the stylesheet from a DOM tree, if the
- * processor supports the "http://xml.org/trax/features/dom/input"
- * feature.
- *
- * @param node A DOM tree which must contain
+ * Process the stylesheet from a DOM tree, if the
+ * processor supports the "http://xml.org/trax/features/dom/input"
+ * feature.
+ *
+ * @param node A DOM tree which must contain
* valid transform instructions that this processor understands.
- * @param systemID The systemID from where xsl:includes and xsl:imports
+ * @param systemID The systemID from where xsl:includes and xsl:imports
* should be resolved from.
* @returns A Templates object capable of being used for transformation
purposes.
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws ProcessorException
*/
public Templates processFromNode(Node node, String systemID)
- throws ProcessorException
+ throws ProcessorException
{
+
m_DOMsystemID = systemID;
+
return processFromNode(node);
}
/**
- * Process a series of inputs, treating them in import or cascade
+ * Process a series of inputs, treating them in import or cascade
* order. This is mainly for support of the getAssociatedStylesheets
* method, but may be useful for other purposes.
- *
+ *
* @param sources An array of SAX InputSource objects.
* @returns A Templates object capable of being used for transformation
purposes.
+ *
+ * NEEDSDOC @param source
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws ProcessorException
*/
public Templates processMultiple(InputSource[] source)
- throws ProcessorException
+ throws ProcessorException
{
+
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
+
pw.println("<?xml version='1.0'?>");
- pw.println("<xsl:stylesheet
xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" version=\"1.0\">");
+ pw.println(
+ "<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"
version=\"1.0\">");
+
int n = source.length;
- for(int i = 0; i < n; i++)
+
+ for (int i = 0; i < n; i++)
{
pw.print("<xsl:import href=\"");
pw.print(source[i].getSystemId());
pw.println("\"/>");
}
+
pw.println("</xsl:stylesheet>");
pw.close();
+
String stylesheetString = sw.toString();
StringReader reader = new StringReader(stylesheetString);
+
try
{
return this.process(new InputSource(reader));
}
- catch(ProcessorException e)
+ catch (ProcessorException e)
{
throw e;
}
- catch(Exception e)
+ catch (Exception e)
{
throw new ProcessorException("processMultiple failed", e);
}
}
/**
- * Get InputSource specification(s) that are associated with the
+ * Get InputSource specification(s) that are associated with the
* given document specified in the source param,
- * via the xml-stylesheet processing instruction
- * (see http://www.w3.org/TR/xml-stylesheet/), and that matches
- * the given criteria. Note that it is possible to return several
stylesheets
- * that match the criteria, in which case they are applied as if they were
+ * via the xml-stylesheet processing instruction
+ * (see http://www.w3.org/TR/xml-stylesheet/), and that matches
+ * the given criteria. Note that it is possible to return several
stylesheets
+ * that match the criteria, in which case they are applied as if they were
* a list of imports or cascades.
- * <p>Note that DOM2 has it's own mechanism for discovering stylesheets.
+ * <p>Note that DOM2 has it's own mechanism for discovering stylesheets.
* Therefore, there isn't a DOM version of this method.</p>
- *
- * @param media The media attribute to be matched. May be null, in which
+ *
+ *
+ * NEEDSDOC @param source
+ * @param media The media attribute to be matched. May be null, in which
* case the prefered templates will be used (i.e. alternate =
no).
* @param title The value of the title attribute to match. May be null.
* @param charset The value of the charset attribute to match. May be
null.
* @returns An array of InputSources that can be passed to processMultiple
method.
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws ProcessorException
*/
- public InputSource[] getAssociatedStylesheets(InputSource source,
- String media,
- String title,
- String charset)
- throws ProcessorException
+ public InputSource[] getAssociatedStylesheets(
+ InputSource source, String media, String title, String charset)
+ throws ProcessorException
{
+
// What I try to do here is parse until the first startElement
// is found, then throw a special exception in order to terminate
// the parse.
- StylesheetPIHandler handler = new StylesheetPIHandler(source, media,
- title, charset);
+ StylesheetPIHandler handler = new StylesheetPIHandler(source, media,
+ title, charset);
+
try
{
XMLReader reader = this.getXMLReader();
- if(null == reader)
+
+ if (null == reader)
{
reader = XMLReaderFactory.createXMLReader();
}
-
+
// Need to set options!
reader.setContentHandler(handler);
reader.parse(source);
}
- catch(StopParseException spe)
+ catch (StopParseException spe)
{
+
// OK, good.
}
- catch(SAXException se)
+ catch (SAXException se)
{
throw new ProcessorException("getAssociatedStylesheets failed", se);
}
- catch(IOException ioe)
+ catch (IOException ioe)
{
throw new ProcessorException("getAssociatedStylesheets failed", ioe);
}
+
return handler.getAssociatedStylesheets();
}
-
+
/**
- * Get a TemplatesBuilder object that can process SAX
- * events into a Templates object, if the processor supports the
+ * Get a TemplatesBuilder object that can process SAX
+ * events into a Templates object, if the processor supports the
* "http://xml.org/trax/features/sax/input" feature.
- *
+ *
* <h3>Open issues:</h3>
- * <dl>
* <dt><h4>Should Processor derive from
org.xml.sax.ContentHandler?</h4></dt>
- * <dd>Instead of requesting an object from the Processor class, should
+ * <dl> * <dt><h4>Should Processor derive from
org.xml.sax.ContentHandler?</h4></dt>
+ * <dd>Instead of requesting an object from the Processor class, should
* the Processor class simply derive from
org.xml.sax.ContentHandler?</dd>
- * </dl>
* @return A TemplatesBuilder object, or null if not supported.
- * @exception May throw a ProcessorException if a StylesheetHandler can
+ * </dl> * @return A TemplatesBuilder object, or null if not supported.
+ * @exception May throw a ProcessorException if a StylesheetHandler can
* not be constructed for some reason.
+ *
+ * @throws ProcessorException
*/
- public TemplatesBuilder getTemplatesBuilder()
- throws ProcessorException
+ public TemplatesBuilder getTemplatesBuilder() throws ProcessorException
{
return new StylesheetHandler(this);
}
-
+
/**
* Look up the value of a feature.
*
@@ -352,30 +432,35 @@
* to be unable to return its value; this is especially true
* in the case of an adapter for a SAX1 Parser, which has
* no way of knowing whether the underlying parser is
- * validating, for example.</p>
*
* <h3>Open issues:</h3>
- * <dl>
* <dt><h4>Should getFeature be changed to hasFeature?</h4></dt>
- * <dd>Keith Visco writes: Should getFeature be changed to hasFeature?
- * It returns a boolean which indicated whether the "state"
- * of feature is "true or false". I assume this means whether
- * or not a feature is supported? I know SAX is using "getFeature",
+ * validating, for example.</p> * * <h3>Open issues:</h3>
+ * <dl> * <dt><h4>Should getFeature be changed to
hasFeature?</h4></dt>
+ * <dd>Keith Visco writes: Should getFeature be changed to hasFeature?
+ * It returns a boolean which indicated whether the "state"
+ * of feature is "true or false". I assume this means whether
+ * or not a feature is supported? I know SAX is using "getFeature",
* but to me "hasFeature" is cleaner.</dd>
- * </dl>
*
+ * </dl>
* @param name The feature name, which is a fully-qualified
* URI.
* @return The current state of the feature (true or false).
* @exception org.xml.sax.SAXNotRecognizedException When the
* Processor does not recognize the feature name.
* @exception org.xml.sax.SAXNotSupportedException When the
- * Processor recognizes the feature name but
+ * Processor recognizes the feature name but
* cannot determine its value at this time.
+ *
+ * @throws SAXNotRecognizedException
+ * @throws SAXNotSupportedException
*/
- public boolean getFeature (String name)
- throws SAXNotRecognizedException, SAXNotSupportedException
{
- if("http://xml.org/trax/features/sax/input".equals(name))
- return true;
- else if("http://xml.org/trax/features/dom/input".equals(name))
- return true;
throw new SAXNotRecognizedException(name);
- }
+ public boolean getFeature(String name)
+ throws SAXNotRecognizedException, SAXNotSupportedException
+ {
+ if ("http://xml.org/trax/features/sax/input".equals(name))
+ return true;
+ else if ("http://xml.org/trax/features/dom/input".equals(name))
+ return true;
+ throw new SAXNotRecognizedException(name);
+ }
}
1.2 +6 -2
xml-xalan/java/src/org/apache/xalan/processor/TemplateElementFactory.java
Index: TemplateElementFactory.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/processor/TemplateElementFactory.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TemplateElementFactory.java 2000/06/19 16:52:14 1.1
+++ TemplateElementFactory.java 2000/10/30 18:40:42 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,
@@ -56,6 +56,10 @@
*/
package org.apache.xalan.processor;
+/**
+ * <meta name="usage" content="internal"/>
+ * NEEDSDOC Class TemplateElementFactory <needs-comment/>
+ */
public class TemplateElementFactory
{
}
1.5 +10 -7
xml-xalan/java/src/org/apache/xalan/processor/XSLProcessorVersion.java
Index: XSLProcessorVersion.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/processor/XSLProcessorVersion.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XSLProcessorVersion.java 2000/10/27 20:30:24 1.4
+++ XSLProcessorVersion.java 2000/10/30 18:40:43 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",
@@ -64,14 +64,17 @@
*/
public class XSLProcessorVersion
{
+
/**
* Print the processor version to the command line.
+ *
+ * NEEDSDOC @param argv
*/
- public static void main( String argv[] )
+ public static void main(String argv[])
{
- System.out.println(PRODUCT + " "+LANGUAGE+" Version "+S_VERSION);
+ System.out.println(PRODUCT + " " + LANGUAGE + " Version " + S_VERSION);
}
-
+
/**
* Version String like <CODE>"<B>Xalan</B>i v.r[.dd| <B>D</B>nn]"</CODE>.
* <P>Semantics of the version string are identical to the Xerces
project.</P>
1.8 +573 -281
xml-xalan/java/src/org/apache/xalan/processor/XSLTAttributeDef.java
Index: XSLTAttributeDef.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/processor/XSLTAttributeDef.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- XSLTAttributeDef.java 2000/10/03 15:41:08 1.7
+++ XSLTAttributeDef.java 2000/10/30 18:40:43 1.8
@@ -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,6 +57,7 @@
package org.apache.xalan.processor;
import org.apache.xalan.utils.StringToIntTable;
+
import java.lang.IllegalAccessException;
import java.lang.IndexOutOfBoundsException;
import java.lang.InstantiationException;
@@ -64,28 +65,38 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.StringBuffer;
+
import java.util.StringTokenizer;
import java.util.Vector;
+
import org.apache.xalan.templates.AVT;
import org.apache.xalan.templates.ElemTemplateElement;
import org.apache.xalan.utils.QName;
import org.apache.xalan.utils.SystemIDResolver;
import org.apache.xalan.utils.StringVector;
import org.apache.xpath.XPath;
+
import org.xml.sax.SAXException;
/**
- * This class defines an attribute for an element in a XSLT stylesheet,
- * is meant to reflect the structure defined in
http://www.w3.org/TR/xslt#dtd, and the
+ * This class defines an attribute for an element in a XSLT stylesheet,
+ * is meant to reflect the structure defined in
http://www.w3.org/TR/xslt#dtd, and the
* mapping between Xalan classes and the markup attributes in the element.
*/
public class XSLTAttributeDef
{
+
/**
* Construct an instance of XSLTAttributeDef.
+ *
+ * NEEDSDOC @param namespace
+ * NEEDSDOC @param name
+ * NEEDSDOC @param type
+ * NEEDSDOC @param required
*/
XSLTAttributeDef(String namespace, String name, int type, boolean required)
{
+
this.m_namespace = namespace;
this.m_name = name;
this.m_type = type;
@@ -94,9 +105,15 @@
/**
* Construct an instance of XSLTAttributeDef.
+ *
+ * NEEDSDOC @param namespace
+ * NEEDSDOC @param name
+ * NEEDSDOC @param type
+ * NEEDSDOC @param defaultVal
*/
XSLTAttributeDef(String namespace, String name, int type, String
defaultVal)
{
+
this.m_namespace = namespace;
this.m_name = name;
this.m_type = type;
@@ -105,623 +122,898 @@
}
/**
- * Construct an instance of XSLTAttributeDef that uses two
+ * Construct an instance of XSLTAttributeDef that uses two
* enumerated values.
+ *
+ * NEEDSDOC @param namespace
+ * NEEDSDOC @param name
+ * NEEDSDOC @param required
+ * NEEDSDOC @param k1
+ * NEEDSDOC @param v1
+ * NEEDSDOC @param k2
+ * NEEDSDOC @param v2
*/
XSLTAttributeDef(String namespace, String name, boolean required,
- String k1, int v1,
- String k2, int v2)
+ String k1, int v1, String k2, int v2)
{
+
this.m_namespace = namespace;
this.m_name = name;
this.m_type = this.T_ENUM;
this.m_required = required;
m_enums = new StringToIntTable(2);
+
m_enums.put(k1, v1);
m_enums.put(k2, v2);
}
/**
- * Construct an instance of XSLTAttributeDef that uses three
+ * Construct an instance of XSLTAttributeDef that uses three
* enumerated values.
+ *
+ * NEEDSDOC @param namespace
+ * NEEDSDOC @param name
+ * NEEDSDOC @param required
+ * NEEDSDOC @param k1
+ * NEEDSDOC @param v1
+ * NEEDSDOC @param k2
+ * NEEDSDOC @param v2
+ * NEEDSDOC @param k3
+ * NEEDSDOC @param v3
*/
XSLTAttributeDef(String namespace, String name, boolean required,
- String k1, int v1,
- String k2, int v2,
- String k3, int v3)
+ String k1, int v1, String k2, int v2, String k3, int v3)
{
+
this.m_namespace = namespace;
this.m_name = name;
this.m_type = this.T_ENUM;
this.m_required = required;
m_enums = new StringToIntTable(3);
+
m_enums.put(k1, v1);
m_enums.put(k2, v2);
m_enums.put(k3, v3);
}
/**
- * Construct an instance of XSLTAttributeDef that uses three
+ * Construct an instance of XSLTAttributeDef that uses three
* enumerated values.
+ *
+ * NEEDSDOC @param namespace
+ * NEEDSDOC @param name
+ * NEEDSDOC @param required
+ * NEEDSDOC @param k1
+ * NEEDSDOC @param v1
+ * NEEDSDOC @param k2
+ * NEEDSDOC @param v2
+ * NEEDSDOC @param k3
+ * NEEDSDOC @param v3
+ * NEEDSDOC @param k4
+ * NEEDSDOC @param v4
*/
XSLTAttributeDef(String namespace, String name, boolean required,
- String k1, int v1,
- String k2, int v2,
- String k3, int v3,
+ String k1, int v1, String k2, int v2, String k3, int v3,
String k4, int v4)
{
+
this.m_namespace = namespace;
this.m_name = name;
this.m_type = this.T_ENUM;
this.m_required = required;
m_enums = new StringToIntTable(4);
+
m_enums.put(k1, v1);
m_enums.put(k2, v2);
m_enums.put(k3, v3);
m_enums.put(k4, v4);
}
+
+ /** NEEDSDOC Field T_CDATA, T_URL, T_AVT, T_PATTERN, T_EXPR, T_CHAR,
T_PRIORITY, T_YESNO, T_QNAME, T_QNAMES, T_ENUM, T_SIMPLEPATTERNLIST, T_NMTOKEN,
T_STRINGLIST, T_PREFIX_URLLIST */
+ static final int T_CDATA = 1,
+
+ // <!-- Used for the type of an attribute value that is a URI reference.-->
+ T_URL = 2,
+
+ // <!-- Used for the type of an attribute value that is an
+ // attribute value template.-->
+ T_AVT = 3, // Attribute Value Template
+
+ // <!-- Used for the type of an attribute value that is a pattern.-->
+ T_PATTERN = 4,
+
+ // <!-- Used for the type of an attribute value that is an expression.-->
+ T_EXPR = 5,
- static final int
- T_CDATA = 1,
-
- // <!-- Used for the type of an attribute value that is a URI
reference.-->
- T_URL = 2,
-
- // <!-- Used for the type of an attribute value that is an
- // attribute value template.-->
- T_AVT = 3, // Attribute Value Template
-
- // <!-- Used for the type of an attribute value that is a pattern.-->
- T_PATTERN = 4,
-
- // <!-- Used for the type of an attribute value that is an expression.-->
- T_EXPR = 5,
-
- // <!-- Used for the type of an attribute value that consists
- // of a single character.-->
- T_CHAR = 6,
-
- // <!-- Used for the type of an attribute value that is a priority. -->
- T_PRIORITY = 7,
-
- // Used for boolean values
- T_YESNO = 8,
-
- // <!-- Used for the type of an attribute value that is a QName; the
prefix
- // gets expanded by the XSLT processor. -->
- T_QNAME = 9,
-
- // <!-- Like qname but a whitespace-separated list of QNames. -->
- T_QNAMES = 10,
-
- // <!-- Used for enumerated values -->
- T_ENUM = 11,
-
- // Used for simple match patterns, i.e. xsl:strip-space spec.
- T_SIMPLEPATTERNLIST = 12,
-
- // Used for a known token.
- T_NMTOKEN = 13,
-
- // Used for a list of white-space delimited strings.
- T_STRINGLIST = 14,
-
- // Used for a list of white-space delimited strings.
- T_PREFIX_URLLIST = 15
- ;
+ // <!-- Used for the type of an attribute value that consists
+ // of a single character.-->
+ T_CHAR = 6,
- static XSLTAttributeDef m_foreignAttr
- = new XSLTAttributeDef("*", "*", XSLTAttributeDef.T_CDATA, false);
+ // <!-- Used for the type of an attribute value that is a priority. -->
+ T_PRIORITY = 7,
+ // Used for boolean values
+ T_YESNO = 8,
+
+ // <!-- Used for the type of an attribute value that is a QName; the prefix
+ // gets expanded by the XSLT processor. -->
+ T_QNAME = 9,
+
+ // <!-- Like qname but a whitespace-separated list of QNames. -->
+ T_QNAMES = 10,
+
+ // <!-- Used for enumerated values -->
+ T_ENUM = 11,
+
+ // Used for simple match patterns, i.e. xsl:strip-space spec.
+ T_SIMPLEPATTERNLIST = 12,
+
+ // Used for a known token.
+ T_NMTOKEN = 13,
+
+ // Used for a list of white-space delimited strings.
+ T_STRINGLIST = 14,
+
+ // Used for a list of white-space delimited strings.
+ T_PREFIX_URLLIST = 15;
+
+ /** NEEDSDOC Field m_foreignAttr */
+ static XSLTAttributeDef m_foreignAttr = new XSLTAttributeDef("*", "*",
+ XSLTAttributeDef.T_CDATA, false);
+
/**
* The allowed namespace for this element.
*/
private String m_namespace;
-
+
/**
* Get the allowed namespace for this element.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
- String getNamespace() {return m_namespace; }
-
+ String getNamespace()
+ {
+ return m_namespace;
+ }
+
/**
* The name of this element.
*/
private String m_name;
-
+
/**
* Get the name of this element.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
- String getName() {return m_name; }
-
+ String getName()
+ {
+ return m_name;
+ }
+
/**
* The type of this attribute value.
*/
private int m_type;
-
+
/**
* Get the type of this attribute value.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
- int getType() {return m_type; }
-
+ int getType()
+ {
+ return m_type;
+ }
+
/**
- * If this element is of type T_ENUM, this will contain
- * a map from the attribute string to the Xalan integer
+ * If this element is of type T_ENUM, this will contain
+ * a map from the attribute string to the Xalan integer
* value.
*/
private StringToIntTable m_enums;
/**
- * If this element is of type T_ENUM, this will return
- * a map from the attribute string to the Xalan integer
+ * If this element is of type T_ENUM, this will return
+ * a map from the attribute string to the Xalan integer
* value.
* @param key The XSLT attribute value.
+ *
+ * NEEDSDOC ($objectName$) @return
* @exception Throws NullPointerException if m_enums is null.
*/
- private int getEnum(String key) { return m_enums.get(key); }
-
+ private int getEnum(String key)
+ {
+ return m_enums.get(key);
+ }
+
/**
* The default value for this attribute.
*/
private String m_default;
-
+
/**
* Get the default value for this attribute.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
- String getDefault() { return m_default; }
+ String getDefault()
+ {
+ return m_default;
+ }
-
/**
* Set the default value for this attribute.
+ *
+ * NEEDSDOC @param def
*/
- void setDefault(String def) { m_default = def; }
+ void setDefault(String def)
+ {
+ m_default = def;
+ }
/**
* If true, this is a required attribute.
*/
private boolean m_required;
-
+
/**
* Get whether or not this is a required attribute.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
- boolean getRequired() { return m_required; }
-
+ boolean getRequired()
+ {
+ return m_required;
+ }
+
+ /** NEEDSDOC Field m_setterString */
String m_setterString = null;
/**
- * Return a string that should represent the setter method.
+ * Return a string that should represent the setter method.
* The setter method name will be created algorithmically
+ *
+ * NEEDSDOC ($objectName$) @return
*/
public String getSetterMethodName()
{
- if(null == m_setterString)
+
+ if (null == m_setterString)
{
- if(m_foreignAttr == this)
+ if (m_foreignAttr == this)
{
return null;
}
- else if(m_name.equals("*"))
+ else if (m_name.equals("*"))
{
m_setterString = "addLiteralResultAttribute";
+
return m_setterString;
}
+
StringBuffer outBuf = new StringBuffer();
+
outBuf.append("set");
+
int n = m_name.length();
- for(int i = 0; i < n; i++)
+
+ for (int i = 0; i < n; i++)
{
char c = m_name.charAt(i);
- if('-' == c)
+
+ if ('-' == c)
{
i++;
+
c = m_name.charAt(i);
c = Character.toUpperCase(c);
}
- else if(0 == i)
+ else if (0 == i)
{
c = Character.toUpperCase(c);
}
+
outBuf.append(c);
}
+
m_setterString = outBuf.toString();
}
+
return m_setterString;
}
-
+
/**
- * Process an attribute string of type T_AVT into
+ * Process an attribute string of type T_AVT into
* a AVT value.
- */
- AVT processAVT(StylesheetHandler handler,
- String uri, String name,
- String rawName, String value)
- throws SAXException
+ *
+ * NEEDSDOC @param handler
+ * NEEDSDOC @param uri
+ * NEEDSDOC @param name
+ * NEEDSDOC @param rawName
+ * NEEDSDOC @param value
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws SAXException
+ */
+ AVT processAVT(
+ StylesheetHandler handler, String uri, String name, String
rawName, String value)
+ throws SAXException
{
+
AVT avt = new AVT(handler, uri, name, rawName, value);
+
return avt;
}
-
+
/**
- * Process an attribute string of type T_CDATA into
+ * Process an attribute string of type T_CDATA into
* a String value.
- */
- Object processCDATA(StylesheetHandler handler,
- String uri, String name,
- String rawName, String value)
- throws SAXException
+ *
+ * NEEDSDOC @param handler
+ * NEEDSDOC @param uri
+ * NEEDSDOC @param name
+ * NEEDSDOC @param rawName
+ * NEEDSDOC @param value
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws SAXException
+ */
+ Object processCDATA(
+ StylesheetHandler handler, String uri, String name, String
rawName, String value)
+ throws SAXException
{
return value;
}
-
+
/**
- * Process an attribute string of type T_CHAR into
+ * Process an attribute string of type T_CHAR into
* a Character value.
- */
- Object processCHAR(StylesheetHandler handler,
- String uri, String name,
- String rawName, String value)
- throws SAXException
- {
- if(value.length() != 1)
+ *
+ * NEEDSDOC @param handler
+ * NEEDSDOC @param uri
+ * NEEDSDOC @param name
+ * NEEDSDOC @param rawName
+ * NEEDSDOC @param value
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws SAXException
+ */
+ Object processCHAR(
+ StylesheetHandler handler, String uri, String name, String
rawName, String value)
+ throws SAXException
+ {
+
+ if (value.length() != 1)
{
- handler.error("An XSLT attribute of type T_CHAR must be only 1
character!", null);
+ handler.error(
+ "An XSLT attribute of type T_CHAR must be only 1 character!", null);
}
-
+
return new Character(value.charAt(0));
}
-
+
/**
- * Process an attribute string of type T_ENUM into
+ * Process an attribute string of type T_ENUM into
* a int value.
- */
- Object processENUM(StylesheetHandler handler,
- String uri, String name,
- String rawName, String value)
- throws SAXException
+ *
+ * NEEDSDOC @param handler
+ * NEEDSDOC @param uri
+ * NEEDSDOC @param name
+ * NEEDSDOC @param rawName
+ * NEEDSDOC @param value
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws SAXException
+ */
+ Object processENUM(
+ StylesheetHandler handler, String uri, String name, String
rawName, String value)
+ throws SAXException
{
+
int enum = this.getEnum(value);
+
return new Integer(enum);
}
-
+
/**
- * Process an attribute string of type T_EXPR into
+ * Process an attribute string of type T_EXPR into
* an XPath value.
- */
- Object processEXPR(StylesheetHandler handler,
- String uri, String name,
- String rawName, String value)
- throws SAXException
+ *
+ * NEEDSDOC @param handler
+ * NEEDSDOC @param uri
+ * NEEDSDOC @param name
+ * NEEDSDOC @param rawName
+ * NEEDSDOC @param value
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws SAXException
+ */
+ Object processEXPR(
+ StylesheetHandler handler, String uri, String name, String
rawName, String value)
+ throws SAXException
{
+
XPath expr = handler.createXPath(value);
+
return expr;
}
-
+
/**
- * Process an attribute string of type T_NMTOKEN into
+ * Process an attribute string of type T_NMTOKEN into
* a String value.
- */
- Object processNMTOKEN(StylesheetHandler handler,
- String uri, String name,
- String rawName, String value)
- throws SAXException
+ *
+ * NEEDSDOC @param handler
+ * NEEDSDOC @param uri
+ * NEEDSDOC @param name
+ * NEEDSDOC @param rawName
+ * NEEDSDOC @param value
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws SAXException
+ */
+ Object processNMTOKEN(
+ StylesheetHandler handler, String uri, String name, String
rawName, String value)
+ throws SAXException
{
return value;
}
-
+
/**
- * Process an attribute string of type T_PATTERN into
+ * Process an attribute string of type T_PATTERN into
* an XPath match pattern value.
- */
- Object processPATTERN(StylesheetHandler handler,
- String uri, String name,
- String rawName, String value)
- throws SAXException
+ *
+ * NEEDSDOC @param handler
+ * NEEDSDOC @param uri
+ * NEEDSDOC @param name
+ * NEEDSDOC @param rawName
+ * NEEDSDOC @param value
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws SAXException
+ */
+ Object processPATTERN(
+ StylesheetHandler handler, String uri, String name, String
rawName, String value)
+ throws SAXException
{
+
XPath pattern = handler.createMatchPatternXPath(value);
+
return pattern;
}
-
+
/**
- * Process an attribute string of type T_PRIORITY into
+ * Process an attribute string of type T_PRIORITY into
* a double value.
- */
- Object processPRIORITY(StylesheetHandler handler,
- String uri, String name,
- String rawName, String value)
- throws SAXException
+ *
+ * NEEDSDOC @param handler
+ * NEEDSDOC @param uri
+ * NEEDSDOC @param name
+ * NEEDSDOC @param rawName
+ * NEEDSDOC @param value
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws SAXException
+ */
+ Object processPRIORITY(
+ StylesheetHandler handler, String uri, String name, String
rawName, String value)
+ throws SAXException
{
return Double.valueOf(value);
}
-
+
/**
- * Process an attribute string of type T_QNAME into
+ * Process an attribute string of type T_QNAME into
* a QName value.
- */
- Object processQNAME(StylesheetHandler handler,
- String uri, String name,
- String rawName, String value)
- throws SAXException
+ *
+ * NEEDSDOC @param handler
+ * NEEDSDOC @param uri
+ * NEEDSDOC @param name
+ * NEEDSDOC @param rawName
+ * NEEDSDOC @param value
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws SAXException
+ */
+ Object processQNAME(
+ StylesheetHandler handler, String uri, String name, String
rawName, String value)
+ throws SAXException
{
return new QName(value, handler);
}
-
+
/**
- * Process an attribute string of type T_QNAMES into
+ * Process an attribute string of type T_QNAMES into
* a vector of QNames.
- */
- Vector processQNAMES(StylesheetHandler handler,
- String uri, String name,
- String rawName, String value)
- throws SAXException
+ *
+ * NEEDSDOC @param handler
+ * NEEDSDOC @param uri
+ * NEEDSDOC @param name
+ * NEEDSDOC @param rawName
+ * NEEDSDOC @param value
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws SAXException
+ */
+ Vector processQNAMES(
+ StylesheetHandler handler, String uri, String name, String
rawName, String value)
+ throws SAXException
{
+
StringTokenizer tokenizer = new StringTokenizer(value, " \t\n\r\f");
int nQNames = tokenizer.countTokens();
Vector qnames = new Vector(nQNames);
- for(int i = 0; i < nQNames; i++)
+
+ for (int i = 0; i < nQNames; i++)
{
qnames.addElement(new QName(tokenizer.nextToken()));
}
+
return qnames;
}
-
+
/**
- * Process an attribute string of type T_SIMPLEPATTERNLIST into
+ * Process an attribute string of type T_SIMPLEPATTERNLIST into
* a vector of XPath match patterns.
- */
- Vector processSIMPLEPATTERNLIST(StylesheetHandler handler,
- String uri, String name,
- String rawName, String value)
- throws SAXException
+ *
+ * NEEDSDOC @param handler
+ * NEEDSDOC @param uri
+ * NEEDSDOC @param name
+ * NEEDSDOC @param rawName
+ * NEEDSDOC @param value
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws SAXException
+ */
+ Vector processSIMPLEPATTERNLIST(
+ StylesheetHandler handler, String uri, String name, String
rawName, String value)
+ throws SAXException
{
+
StringTokenizer tokenizer = new StringTokenizer(value, " \t\n\r\f");
int nPatterns = tokenizer.countTokens();
Vector patterns = new Vector(nPatterns);
- for(int i = 0; i < nPatterns; i++)
+
+ for (int i = 0; i < nPatterns; i++)
{
XPath pattern = handler.createMatchPatternXPath(tokenizer.nextToken());
+
patterns.addElement(pattern);
}
+
return patterns;
}
-
+
/**
- * Process an attribute string of type T_STRINGLIST into
+ * Process an attribute string of type T_STRINGLIST into
* a vector of XPath match patterns.
- */
- StringVector processSTRINGLIST(StylesheetHandler handler,
- String uri, String name,
- String rawName, String value)
- throws SAXException
+ *
+ * NEEDSDOC @param handler
+ * NEEDSDOC @param uri
+ * NEEDSDOC @param name
+ * NEEDSDOC @param rawName
+ * NEEDSDOC @param value
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws SAXException
+ */
+ StringVector processSTRINGLIST(
+ StylesheetHandler handler, String uri, String name, String
rawName, String value)
+ throws SAXException
{
+
StringTokenizer tokenizer = new StringTokenizer(value, " \t\n\r\f");
int nStrings = tokenizer.countTokens();
StringVector strings = new StringVector(nStrings);
- for(int i = 0; i < nStrings; i++)
+
+ for (int i = 0; i < nStrings; i++)
{
strings.addElement(tokenizer.nextToken());
}
+
return strings;
}
-
+
/**
- * Process an attribute string of type T_URLLIST into
+ * Process an attribute string of type T_URLLIST into
* a vector of XPath match patterns.
- */
- StringVector processPREFIX_URLLIST(StylesheetHandler handler,
- String uri, String name,
- String rawName, String value)
- throws SAXException
+ *
+ * NEEDSDOC @param handler
+ * NEEDSDOC @param uri
+ * NEEDSDOC @param name
+ * NEEDSDOC @param rawName
+ * NEEDSDOC @param value
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws SAXException
+ */
+ StringVector processPREFIX_URLLIST(
+ StylesheetHandler handler, String uri, String name, String
rawName, String value)
+ throws SAXException
{
+
StringTokenizer tokenizer = new StringTokenizer(value, " \t\n\r\f");
int nStrings = tokenizer.countTokens();
StringVector strings = new StringVector(nStrings);
- for(int i = 0; i < nStrings; i++)
+
+ for (int i = 0; i < nStrings; i++)
{
String prefix = tokenizer.nextToken();
String url = handler.getNamespaceForPrefix(prefix);
+
strings.addElement(url);
}
+
return strings;
}
-
/**
- * Process an attribute string of type T_URL into
+ * Process an attribute string of type T_URL into
* a URL value.
- */
- String processURL(StylesheetHandler handler,
- String uri, String name,
- String rawName, String value)
- throws SAXException
+ *
+ * NEEDSDOC @param handler
+ * NEEDSDOC @param uri
+ * NEEDSDOC @param name
+ * NEEDSDOC @param rawName
+ * NEEDSDOC @param value
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws SAXException
+ */
+ String processURL(
+ StylesheetHandler handler, String uri, String name, String
rawName, String value)
+ throws SAXException
{
+
// return SystemIDResolver.getAbsoluteURI(value,
// handler.getBaseIdentifier());
return value;
}
-
+
/**
- * Process an attribute string of type T_YESNO into
+ * Process an attribute string of type T_YESNO into
* a Boolean value.
- */
- private Boolean processYESNO(StylesheetHandler handler,
- String uri, String name,
- String rawName, String value)
- throws SAXException
+ *
+ * NEEDSDOC @param handler
+ * NEEDSDOC @param uri
+ * NEEDSDOC @param name
+ * NEEDSDOC @param rawName
+ * NEEDSDOC @param value
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws SAXException
+ */
+ private Boolean processYESNO(
+ StylesheetHandler handler, String uri, String name, String
rawName, String value)
+ throws SAXException
{
return new Boolean(value.equals("yes") ? true : false);
}
-
+
/**
* Process an attribute value.
- */
- Object processValue(StylesheetHandler handler,
- String uri, String name,
- String rawName, String value)
- throws SAXException
+ *
+ * NEEDSDOC @param handler
+ * NEEDSDOC @param uri
+ * NEEDSDOC @param name
+ * NEEDSDOC @param rawName
+ * NEEDSDOC @param value
+ *
+ * NEEDSDOC ($objectName$) @return
+ *
+ * @throws SAXException
+ */
+ Object processValue(
+ StylesheetHandler handler, String uri, String name, String
rawName, String value)
+ throws SAXException
{
+
int type = getType();
Object processedValue = null;
- switch(type)
+
+ switch (type)
{
- case T_AVT:
+ case T_AVT :
processedValue = processAVT(handler, uri, name, rawName, value);
break;
- case T_CDATA:
+ case T_CDATA :
processedValue = processCDATA(handler, uri, name, rawName, value);
break;
- case T_CHAR:
+ case T_CHAR :
processedValue = processCHAR(handler, uri, name, rawName, value);
break;
- case T_ENUM:
+ case T_ENUM :
processedValue = processENUM(handler, uri, name, rawName, value);
break;
- case T_EXPR:
+ case T_EXPR :
processedValue = processEXPR(handler, uri, name, rawName, value);
break;
- case T_NMTOKEN:
+ case T_NMTOKEN :
processedValue = processNMTOKEN(handler, uri, name, rawName, value);
break;
- case T_PATTERN:
+ case T_PATTERN :
processedValue = processPATTERN(handler, uri, name, rawName, value);
break;
- case T_PRIORITY:
+ case T_PRIORITY :
processedValue = processPRIORITY(handler, uri, name, rawName, value);
break;
- case T_QNAME:
+ case T_QNAME :
processedValue = processQNAME(handler, uri, name, rawName, value);
break;
- case T_QNAMES:
+ case T_QNAMES :
processedValue = processQNAMES(handler, uri, name, rawName, value);
break;
- case T_SIMPLEPATTERNLIST:
- processedValue = processSIMPLEPATTERNLIST(handler, uri, name, rawName,
value);
+ case T_SIMPLEPATTERNLIST :
+ processedValue = processSIMPLEPATTERNLIST(handler, uri, name, rawName,
+ value);
break;
- case T_URL:
+ case T_URL :
processedValue = processURL(handler, uri, name, rawName, value);
break;
- case T_YESNO:
+ case T_YESNO :
processedValue = processYESNO(handler, uri, name, rawName, value);
break;
- case T_STRINGLIST:
+ case T_STRINGLIST :
processedValue = processSTRINGLIST(handler, uri, name, rawName, value);
break;
- case T_PREFIX_URLLIST:
- processedValue = processPREFIX_URLLIST(handler, uri, name, rawName,
value);
+ case T_PREFIX_URLLIST :
+ processedValue = processPREFIX_URLLIST(handler, uri, name, rawName,
+ value);
break;
- default:
+ default :
}
+
return processedValue;
}
-
+
/**
* Set the default value of an attribute.
+ *
+ * NEEDSDOC @param handler
+ * NEEDSDOC @param elem
+ *
+ * @throws SAXException
*/
- void setDefAttrValue(StylesheetHandler handler,
- Object elem)
- throws SAXException
- {
- setAttrValue(handler, this.getNamespace(), this.getName(),
this.getName(),
- this.getDefault(), elem);
- }
-
- /**
- * Get the primative type for the class, if there
- * is one. If the class is a Double, for instance,
- * this will return double.class. If the class is not one
- * of the 9 primative types, it will return the same
+ void setDefAttrValue(StylesheetHandler handler, Object elem)
+ throws SAXException
+ {
+ setAttrValue(handler, this.getNamespace(), this.getName(),
+ this.getName(), this.getDefault(), elem);
+ }
+
+ /**
+ * Get the primative type for the class, if there
+ * is one. If the class is a Double, for instance,
+ * this will return double.class. If the class is not one
+ * of the 9 primative types, it will return the same
* class that was passed in.
+ *
+ * NEEDSDOC @param obj
+ *
+ * NEEDSDOC ($objectName$) @return
*/
private Class getPrimativeClass(Object obj)
{
- if(obj instanceof XPath)
+
+ if (obj instanceof XPath)
return XPath.class;
-
+
Class cl = obj.getClass();
- if (cl == Double.class)
+
+ if (cl == Double.class)
{
cl = double.class;
}
- if (cl == Float.class)
+
+ if (cl == Float.class)
{
cl = float.class;
}
- else if (cl == Boolean.class)
+ else if (cl == Boolean.class)
{
cl = boolean.class;
}
- else if (cl == Byte.class)
+ else if (cl == Byte.class)
{
cl = byte.class;
}
- else if (cl == Character.class)
+ else if (cl == Character.class)
{
cl = char.class;
}
- else if (cl == Short.class)
+ else if (cl == Short.class)
{
cl = short.class;
}
- else if (cl == Integer.class)
+ else if (cl == Integer.class)
{
cl = int.class;
}
- else if (cl == Long.class)
+ else if (cl == Long.class)
{
cl = long.class;
}
+
return cl;
}
-
+
/**
* Set a value on an attribute.
- */
- void setAttrValue(StylesheetHandler handler,
- String attrUri, String attrLocalName, String attrRawName,
- String attrValue,
- Object elem)
- throws SAXException
+ *
+ * NEEDSDOC @param handler
+ * NEEDSDOC @param attrUri
+ * NEEDSDOC @param attrLocalName
+ * NEEDSDOC @param attrRawName
+ * NEEDSDOC @param attrValue
+ * NEEDSDOC @param elem
+ *
+ * @throws SAXException
+ */
+ void setAttrValue(
+ StylesheetHandler handler, String attrUri, String attrLocalName,
String attrRawName, String attrValue, Object elem)
+ throws SAXException
{
+
String setterString = getSetterMethodName();
-
+
// If this is null, then it is a foreign namespace and we
// do not process it.
- if(null != setterString)
+ if (null != setterString)
{
- Object value = processValue(handler,
- attrUri, attrLocalName,
- attrRawName,
- attrValue);
+ Object value = processValue(handler, attrUri, attrLocalName,
+ attrRawName, attrValue);
+
try
{
Method meth;
+
// First try to match with the primative value.
- Class[] argTypes = new Class[] { getPrimativeClass(value) };
+ Class[] argTypes = new Class[]{ getPrimativeClass(value) };
+
try
{
meth = elem.getClass().getMethod(setterString, argTypes);
- }
- catch(NoSuchMethodException nsme)
+ }
+ catch (NoSuchMethodException nsme)
{
- Class cl = ((Object)value).getClass();
+ Class cl = ((Object) value).getClass();
+
// If this doesn't work, try it with the non-primative value;
argTypes[0] = cl;
meth = elem.getClass().getMethod(setterString, argTypes);
}
- Object[] args = new Object[] { value };
+
+ Object[] args = new Object[]{ value };
+
meth.invoke(elem, args);
}
- catch(NoSuchMethodException nsme)
+ catch (NoSuchMethodException nsme)
{
- handler.error("Failed calling "+setterString+" method!", nsme);
+ handler.error("Failed calling " + setterString + " method!", nsme);
}
- catch(IllegalAccessException iae)
+ catch (IllegalAccessException iae)
{
- handler.error("Failed calling "+setterString+" method!", iae);
+ handler.error("Failed calling " + setterString + " method!", iae);
}
- catch(InvocationTargetException nsme)
+ catch (InvocationTargetException nsme)
{
- handler.error("Failed calling "+setterString+" method!", nsme);
+ handler.error("Failed calling " + setterString + " method!", nsme);
}
}
}
-
}
1.6 +212 -94
xml-xalan/java/src/org/apache/xalan/processor/XSLTElementDef.java
Index: XSLTElementDef.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/processor/XSLTElementDef.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- XSLTElementDef.java 2000/10/04 23:20:08 1.5
+++ XSLTElementDef.java 2000/10/30 18:40:43 1.6
@@ -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,270 +57,374 @@
package org.apache.xalan.processor;
import org.xml.sax.ContentHandler;
+
import org.apache.xalan.templates.Constants;
/**
- * This class defines the allowed structure for an element in a XSLT
stylesheet,
- * is meant to reflect the structure defined in
http://www.w3.org/TR/xslt#dtd, and the
+ * This class defines the allowed structure for an element in a XSLT
stylesheet,
+ * is meant to reflect the structure defined in
http://www.w3.org/TR/xslt#dtd, and the
* mapping between Xalan classes and the markup elements in the XSLT
instance.
* This actually represents both text nodes and elements.
*/
class XSLTElementDef
{
-
+
/**
* Construct an instance of XSLTElementDef. This must be followed by a
* call to build().
*/
- XSLTElementDef()
- {
- }
+ XSLTElementDef(){}
/**
* Construct an instance of XSLTElementDef.
+ *
+ * NEEDSDOC @param namespace
+ * NEEDSDOC @param name
+ * NEEDSDOC @param nameAlias
+ * NEEDSDOC @param elements
+ * NEEDSDOC @param attributes
+ * NEEDSDOC @param contentHandler
+ * NEEDSDOC @param classObject
*/
XSLTElementDef(String namespace, String name, String nameAlias,
- XSLTElementDef[] elements,
- XSLTAttributeDef[] attributes,
- XSLTElementProcessor contentHandler,
- Class classObject)
+ XSLTElementDef[] elements, XSLTAttributeDef[] attributes,
+ XSLTElementProcessor contentHandler, Class classObject)
{
- build(namespace, name, nameAlias, elements,
- attributes, contentHandler, classObject);
+ build(namespace, name, nameAlias, elements, attributes, contentHandler,
+ classObject);
}
-
+
/**
* Construct an instance of XSLTElementDef that represents text.
+ *
+ * NEEDSDOC @param classObject
+ * NEEDSDOC @param contentHandler
+ * NEEDSDOC @param type
*/
- XSLTElementDef(Class classObject,
- XSLTElementProcessor contentHandler, int type)
+ XSLTElementDef(Class classObject, XSLTElementProcessor contentHandler,
+ int type)
{
+
this.m_classObject = classObject;
this.m_type = type;
+
setElementProcessor(contentHandler);
}
-
/**
* Construct an instance of XSLTElementDef.
+ *
+ * NEEDSDOC @param namespace
+ * NEEDSDOC @param name
+ * NEEDSDOC @param nameAlias
+ * NEEDSDOC @param elements
+ * NEEDSDOC @param attributes
+ * NEEDSDOC @param contentHandler
+ * NEEDSDOC @param classObject
*/
void build(String namespace, String name, String nameAlias,
- XSLTElementDef[] elements,
- XSLTAttributeDef[] attributes,
- XSLTElementProcessor contentHandler,
- Class classObject)
+ XSLTElementDef[] elements, XSLTAttributeDef[] attributes,
+ XSLTElementProcessor contentHandler, Class classObject)
{
+
this.m_namespace = namespace;
this.m_name = name;
this.m_nameAlias = nameAlias;
this.m_elements = elements;
this.m_attributes = attributes;
+
setElementProcessor(contentHandler);
+
this.m_classObject = classObject;
}
-
+
/**
- * Tell if two objects are equal, when either one may be null.
+ * Tell if two objects are equal, when either one may be null.
* If both are null, they are considered equal.
+ *
+ * NEEDSDOC @param obj1
+ * NEEDSDOC @param obj2
+ *
+ * NEEDSDOC ($objectName$) @return
*/
private static boolean equalsMayBeNull(Object obj1, Object obj2)
{
- return ((null == obj1) && (null == obj2)) ||
- ((null != obj1) && (null != obj2) && obj2.equals(obj1));
+ return ((null == obj1) && (null == obj2))
+ || ((null != obj1) && (null != obj2) && obj2.equals(obj1));
}
/**
- * Tell if the two string refs are equal,
+ * Tell if the two string refs are equal,
* equality being defined as:
* 1) Both strings are null.
* 2) One string is null and the other is empty.
* 3) Both strings are non-null, and equal.
+ *
+ * NEEDSDOC @param s1
+ * NEEDSDOC @param s2
+ *
+ * NEEDSDOC ($objectName$) @return
*/
- private static boolean equalsMayBeNullOrZeroLen( String s1, String s2 )
+ private static boolean equalsMayBeNullOrZeroLen(String s1, String s2)
{
+
int len1 = (s1 == null) ? 0 : s1.length();
int len2 = (s2 == null) ? 0 : s2.length();
+
return (len1 != len2) ? false : (len1 == 0) ? true : s1.equals(s2);
}
-
- static final int
- T_ELEMENT = 1,
- T_PCDATA = 2,
- T_ANY = 3;
-
+
+ /** NEEDSDOC Field T_ELEMENT, T_PCDATA, T_ANY */
+ static final int T_ELEMENT = 1, T_PCDATA = 2, T_ANY = 3;
+
/**
* The type of this element.
*/
private int m_type = T_ELEMENT;
-
+
/**
* Get the type of this element.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
- int getType() {return m_type; }
-
+ int getType()
+ {
+ return m_type;
+ }
+
/**
* Set the type of this element.
+ *
+ * NEEDSDOC @param t
*/
- void setType(int t) { m_type = t; }
-
+ void setType(int t)
+ {
+ m_type = t;
+ }
/**
* The allowed namespace for this element.
*/
private String m_namespace;
-
+
/**
* Get the allowed namespace for this element.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
- String getNamespace() {return m_namespace; }
-
+ String getNamespace()
+ {
+ return m_namespace;
+ }
+
/**
* The name of this element.
*/
private String m_name;
-
+
/**
* Get the name of this element.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
- String getName() {return m_name; }
+ String getName()
+ {
+ return m_name;
+ }
/**
* The name of this element.
*/
private String m_nameAlias;
-
+
/**
* Get the name of this element.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
- String getNameAlias() {return m_nameAlias; }
+ String getNameAlias()
+ {
+ return m_nameAlias;
+ }
/**
* The allowed elements for this type.
*/
private XSLTElementDef[] m_elements;
-
+
/**
* Get the allowed elements for this type.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
- XSLTElementDef[] getElements() { return m_elements; }
+ XSLTElementDef[] getElements()
+ {
+ return m_elements;
+ }
/**
* Set the allowed elements for this type.
+ *
+ * NEEDSDOC @param defs
*/
- void setElements(XSLTElementDef[] defs) { m_elements = defs; }
+ void setElements(XSLTElementDef[] defs)
+ {
+ m_elements = defs;
+ }
/**
- * Tell if the namespace URI and local name match this
+ * Tell if the namespace URI and local name match this
* element.
* @param uri The namespace uri, which may be null.
* @param localName The local name of an element, which may be null.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
- private boolean QNameEquals( String uri, String localName )
+ private boolean QNameEquals(String uri, String localName)
{
- return (equalsMayBeNullOrZeroLen(m_namespace, uri) &&
- (equalsMayBeNullOrZeroLen(m_name, localName) ||
- equalsMayBeNullOrZeroLen(m_nameAlias, localName)));
+
+ return (equalsMayBeNullOrZeroLen(m_namespace, uri)
+ && (equalsMayBeNullOrZeroLen(m_name, localName)
+ || equalsMayBeNullOrZeroLen(m_nameAlias, localName)));
}
-
+
/**
- * Given a namespace URI, and a local name, get the processor
+ * Given a namespace URI, and a local name, get the processor
* for the element, or return null if not allowed.
+ *
+ * NEEDSDOC @param uri
+ * NEEDSDOC @param localName
+ *
+ * NEEDSDOC ($objectName$) @return
*/
- XSLTElementProcessor getProcessorFor( String uri, String localName )
+ XSLTElementProcessor getProcessorFor(String uri, String localName)
{
- XSLTElementProcessor lreDef = null; // return value
- if(null == m_elements)
+
+ XSLTElementProcessor lreDef = null; // return value
+
+ if (null == m_elements)
return null;
+
int n = m_elements.length;
- for(int i = 0; i < n; i++)
+
+ for (int i = 0; i < n; i++)
{
XSLTElementDef def = m_elements[i];
+
// A "*" signals that the element allows literal result
// elements, so just assign the def, and continue to
// see if anything else matches.
- if(def.m_name.equals("*"))
+ if (def.m_name.equals("*"))
{
+
// Don't allow xsl elements
- if(!equalsMayBeNullOrZeroLen(uri, Constants.S_XSLNAMESPACEURL))
+ if (!equalsMayBeNullOrZeroLen(uri, Constants.S_XSLNAMESPACEURL))
lreDef = def.m_elementProcessor;
- }
- else if(def.QNameEquals(uri, localName))
+ }
+ else if (def.QNameEquals(uri, localName))
return def.m_elementProcessor;
}
+
return lreDef;
}
-
+
/**
- * Given an unknown element , get the processor
+ * Given an unknown element , get the processor
* for the element
+ *
+ * NEEDSDOC @param uri
+ * NEEDSDOC @param localName
+ *
+ * NEEDSDOC ($objectName$) @return
*/
- XSLTElementProcessor getProcessorForUnknown( String uri, String localName )
+ XSLTElementProcessor getProcessorForUnknown(String uri, String localName)
{
- XSLTElementProcessor lreDef = null; // return value
- if(null == m_elements)
+
+ // XSLTElementProcessor lreDef = null; // return value
+ if (null == m_elements)
return null;
+
int n = m_elements.length;
- for(int i = 0; i < n; i++)
+
+ for (int i = 0; i < n; i++)
{
XSLTElementDef def = m_elements[i];
- if(def.m_name.equals("unknown"))
+
+ if (def.m_name.equals("unknown"))
{
return def.m_elementProcessor;
}
}
+
return null;
- }
-
+ }
+
/**
* The allowed attributes for this type.
*/
private XSLTAttributeDef[] m_attributes;
-
+
/**
* Get the allowed attributes for this type.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
- XSLTAttributeDef[] getAttributes() {return m_attributes; }
-
+ XSLTAttributeDef[] getAttributes()
+ {
+ return m_attributes;
+ }
+
/**
- * Given a namespace URI, and a local name, return the element's
+ * Given a namespace URI, and a local name, return the element's
* attribute definition, if it has one.
+ *
+ * NEEDSDOC @param uri
+ * NEEDSDOC @param localName
+ *
+ * NEEDSDOC ($objectName$) @return
*/
- XSLTAttributeDef getAttributeDef( String uri, String localName )
+ XSLTAttributeDef getAttributeDef(String uri, String localName)
{
+
XSLTAttributeDef defaultDef = null;
XSLTAttributeDef[] attrDefs = getAttributes();
int nAttrDefs = attrDefs.length;
- for(int k = 0; k < nAttrDefs; k++)
+
+ for (int k = 0; k < nAttrDefs; k++)
{
XSLTAttributeDef attrDef = attrDefs[k];
String uriDef = attrDef.getNamespace();
String nameDef = attrDef.getName();
- if(nameDef.equals("*") && equalsMayBeNullOrZeroLen(uri, uriDef))
+
+ if (nameDef.equals("*") && equalsMayBeNullOrZeroLen(uri, uriDef))
{
return attrDef;
}
- else if(nameDef.equals("*") )
+ else if (nameDef.equals("*"))
{
+
// In this case, all attributes are legal, so return
// this as the last resort.
defaultDef = attrDef;
}
- else if(equalsMayBeNullOrZeroLen(uri, uriDef) &&
localName.equals(nameDef))
+ else if (equalsMayBeNullOrZeroLen(uri, uriDef)
+ && localName.equals(nameDef))
{
return attrDef;
}
}
- if(null == defaultDef)
+
+ if (null == defaultDef)
{
- if(!equalsMayBeNullOrZeroLen(uri, Constants.S_XSLNAMESPACEURL))
+ if (!equalsMayBeNullOrZeroLen(uri, Constants.S_XSLNAMESPACEURL))
{
return XSLTAttributeDef.m_foreignAttr;
}
}
+
return defaultDef;
}
-
/**
* If non-null, the ContentHandler/Processor for this element.
*/
@@ -328,30 +432,44 @@
/**
* Return the ContentHandler/Processor for this element.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
- XSLTElementProcessor getElementProcessor() {return m_elementProcessor; }
+ XSLTElementProcessor getElementProcessor()
+ {
+ return m_elementProcessor;
+ }
/**
* Return the ContentHandler/Processor for this element.
+ *
+ * NEEDSDOC @param handler
*/
- void setElementProcessor(XSLTElementProcessor handler)
+ void setElementProcessor(XSLTElementProcessor handler)
{
+
if (handler != null)
- {
- m_elementProcessor = handler;
+ {
+ m_elementProcessor = handler;
+
m_elementProcessor.setElemDef(this);
- }
+ }
}
/**
- * If non-null, the class object that should in instantiated for
+ * If non-null, the class object that should in instantiated for
* a Xalan instance of this element.
*/
private Class m_classObject;
-
+
/**
- * Return the class object that should in instantiated for
+ * Return the class object that should in instantiated for
* a Xalan instance of this element.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
- Class getClassObject() {return m_classObject; }
+ Class getClassObject()
+ {
+ return m_classObject;
+ }
}
1.5 +145 -94
xml-xalan/java/src/org/apache/xalan/processor/XSLTElementProcessor.java
Index: XSLTElementProcessor.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/processor/XSLTElementProcessor.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XSLTElementProcessor.java 2000/10/23 15:23:27 1.4
+++ XSLTElementProcessor.java 2000/10/30 18:40:43 1.5
@@ -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,
@@ -73,20 +73,19 @@
import java.util.Vector;
/**
- * This class acts as the superclass for all stylesheet element
+ * This class acts as the superclass for all stylesheet element
* processors, and deals with things that are common to all elements.
* @see <a href="http://www.w3.org/TR/xslt#dtd">XSLT DTD</a>
*/
public class XSLTElementProcessor
-{
+{
+
/**
* Construct a processor for top-level elements.
* @see <a href="http://www.w3.org/TR/xslt#dtd">XSLT DTD</a>
*/
- XSLTElementProcessor()
- {
- }
-
+ XSLTElementProcessor(){}
+
/**
* The element definition that this processor conforms to.
*/
@@ -94,6 +93,8 @@
/**
* Get the element definition that belongs to this element.
+ *
+ * NEEDSDOC ($objectName$) @return
*/
XSLTElementDef getElemDef()
{
@@ -102,52 +103,61 @@
/**
* Set the element definition that belongs to this element.
+ *
+ * NEEDSDOC @param def
*/
void setElemDef(XSLTElementDef def)
{
m_elemDef = def;
}
-
+
/**
* Resolve an external entity.
*
+ *
+ * NEEDSDOC @param handler
* @param publicId The public identifer, or null if none is
* available.
- * @param systemId The system identifier provided in the XML
+ * @param systemId The system identifier provided in the XML
* document.
* @return The new input source, or null to require the
* default behaviour.
* @exception org.xml.sax.SAXException Any SAX exception, possibly
* wrapping another exception.
* @see org.xml.sax.EntityResolver#resolveEntity
+ *
+ * @throws SAXException
*/
- public InputSource resolveEntity (StylesheetHandler handler,
- String publicId, String systemId)
- throws SAXException
+ public InputSource resolveEntity(
+ StylesheetHandler handler, String publicId, String systemId)
+ throws SAXException
{
return null;
}
-
-
+
/**
* Receive notification of a notation declaration.
*
+ *
+ * NEEDSDOC @param handler
* @param name The notation name.
* @param publicId The notation public identifier, or null if not
* available.
* @param systemId The notation system identifier.
* @see org.xml.sax.DTDHandler#notationDecl
*/
- public void notationDecl (StylesheetHandler handler,
- String name, String publicId, String systemId)
+ public void notationDecl(StylesheetHandler handler, String name,
+ String publicId, String systemId)
{
+
// no op
}
-
-
+
/**
* Receive notification of an unparsed entity declaration.
*
+ *
+ * NEEDSDOC @param handler
* @param name The entity name.
* @param publicId The entity public identifier, or null if not
* available.
@@ -155,20 +165,25 @@
* @param notationName The name of the associated notation.
* @see org.xml.sax.DTDHandler#unparsedEntityDecl
*/
- public void unparsedEntityDecl (StylesheetHandler handler,
- String name, String publicId,
- String systemId, String notationName)
+ public void unparsedEntityDecl(StylesheetHandler handler, String name,
+ String publicId, String systemId,
+ String notationName)
{
+
// no op
}
-
+
/**
- * Receive notification of the start of the non-text event. This
+ * Receive notification of the start of the non-text event. This
* is sent to the current processor when any non-text event occurs.
+ *
+ * NEEDSDOC @param handler
+ *
+ * @throws SAXException
*/
- public void startNonText(StylesheetHandler handler)
- throws SAXException
+ public void startNonText(StylesheetHandler handler) throws SAXException
{
+
// no op
}
@@ -176,40 +191,55 @@
* Receive notification of the start of an element.
*
* @param name The element type name.
+ *
+ * NEEDSDOC @param handler
+ * NEEDSDOC @param uri
+ * NEEDSDOC @param localName
+ * NEEDSDOC @param rawName
* @param attributes The specified or defaulted attributes.
* @exception org.xml.sax.SAXException Any SAX exception, possibly
* wrapping another exception.
* @see org.xml.sax.ContentHandler#startElement
+ *
+ * @throws SAXException
*/
- public void startElement (StylesheetHandler handler,
- String uri, String localName,
- String rawName, Attributes attributes)
- throws SAXException
+ public void startElement(
+ StylesheetHandler handler, String uri, String localName, String
rawName, Attributes attributes)
+ throws SAXException
{
+
// no op
}
-
-
+
/**
* Receive notification of the end of an element.
*
* @param name The element type name.
* @param attributes The specified or defaulted attributes.
+ *
+ * NEEDSDOC @param handler
+ * NEEDSDOC @param uri
+ * NEEDSDOC @param localName
+ * NEEDSDOC @param rawName
* @exception org.xml.sax.SAXException Any SAX exception, possibly
* wrapping another exception.
* @see org.xml.sax.ContentHandler#endElement
+ *
+ * @throws SAXException
*/
- public void endElement (StylesheetHandler handler,
- String uri, String localName, String rawName)
- throws SAXException
+ public void endElement(
+ StylesheetHandler handler, String uri, String localName, String
rawName)
+ throws SAXException
{
+
// no op
}
-
-
+
/**
* Receive notification of character data inside an element.
*
+ *
+ * NEEDSDOC @param handler
* @param ch The characters.
* @param start The start position in the character array.
* @param length The number of characters to use from the
@@ -217,18 +247,22 @@
* @exception org.xml.sax.SAXException Any SAX exception, possibly
* wrapping another exception.
* @see org.xml.sax.ContentHandler#characters
+ *
+ * @throws SAXException
*/
- public void characters (StylesheetHandler handler,
- char ch[], int start, int length)
- throws SAXException
+ public void characters(
+ StylesheetHandler handler, char ch[], int start, int length)
+ throws SAXException
{
- handler.error("Characters are not allowed at this point in the
document!", null);
+ handler.error("Characters are not allowed at this point in the
document!",
+ null);
}
-
-
+
/**
* Receive notification of ignorable whitespace in element content.
*
+ *
+ * NEEDSDOC @param handler
* @param ch The whitespace characters.
* @param start The start position in the character array.
* @param length The number of characters to use from the
@@ -236,85 +270,95 @@
* @exception org.xml.sax.SAXException Any SAX exception, possibly
* wrapping another exception.
* @see org.xml.sax.ContentHandler#ignorableWhitespace
+ *
+ * @throws SAXException
*/
- public void ignorableWhitespace (StylesheetHandler handler,
- char ch[], int start, int length)
- throws SAXException
+ public void ignorableWhitespace(
+ StylesheetHandler handler, char ch[], int start, int length)
+ throws SAXException
{
+
// no op
}
-
-
+
/**
* Receive notification of a processing instruction.
*
+ *
+ * NEEDSDOC @param handler
* @param target The processing instruction target.
* @param data The processing instruction data, or null if
* none is supplied.
* @exception org.xml.sax.SAXException Any SAX exception, possibly
* wrapping another exception.
* @see org.xml.sax.ContentHandler#processingInstruction
+ *
+ * @throws SAXException
*/
- public void processingInstruction (StylesheetHandler handler,
- String target, String data)
- throws SAXException
+ public void processingInstruction(
+ StylesheetHandler handler, String target, String data)
+ throws SAXException
{
+
// no op
}
-
/**
* Receive notification of a skipped entity.
*
+ *
+ * NEEDSDOC @param handler
* @param name The name of the skipped entity.
* @exception org.xml.sax.SAXException Any SAX exception, possibly
* wrapping another exception.
* @see org.xml.sax.ContentHandler#processingInstruction
+ *
+ * @throws SAXException
*/
- public void skippedEntity (StylesheetHandler handler,
- String name)
- throws SAXException
+ public void skippedEntity(StylesheetHandler handler, String name)
+ throws SAXException
{
+
// no op
}
-
+
/**
* Set the properties of an object from the given attribute list.
- * @param handler The stylesheet's Content handler, needed for
+ * @param handler The stylesheet's Content handler, needed for
* error reporting.
- * @param rawName The raw name of the owner element, needed for
+ * @param rawName The raw name of the owner element, needed for
* error reporting.
* @param attributes The list of attributes.
* @param target The target element where the properties will be set.
+ *
+ * @throws SAXException
*/
- void setPropertiesFromAttributes(StylesheetHandler handler,
- String rawName,
- Attributes attributes,
- Object target)
- throws SAXException
+ void setPropertiesFromAttributes(
+ StylesheetHandler handler, String rawName, Attributes attributes,
Object target)
+ throws SAXException
{
setPropertiesFromAttributes(handler, rawName, attributes, target, true);
}
-
+
/**
* Set the properties of an object from the given attribute list.
- * @param handler The stylesheet's Content handler, needed for
+ * @param handler The stylesheet's Content handler, needed for
* error reporting.
- * @param rawName The raw name of the owner element, needed for
+ * @param rawName The raw name of the owner element, needed for
* error reporting.
* @param attributes The list of attributes.
* @param target The target element where the properties will be set.
- * @param throwError True if it should throw an error if an
+ * @param throwError True if it should throw an error if an
* attribute is not defined.
* @return the attributes not allowed on this element.
+ *
+ * @throws SAXException
*/
- Attributes setPropertiesFromAttributes(StylesheetHandler handler,
- String rawName,
- Attributes attributes,
- Object target,
- boolean throwError)
- throws SAXException
+ Attributes setPropertiesFromAttributes(
+ StylesheetHandler handler, String rawName, Attributes attributes,
Object target, boolean throwError)
+ throws SAXException
{
+
XSLTElementDef def = getElemDef();
AttributesImpl undefines = throwError ? null : new AttributesImpl();
@@ -322,26 +366,28 @@
// I can see which default values need to be set.
Vector processedDefs = new Vector();
int nAttrs = attributes.getLength();
- for(int i = 0; i < nAttrs; i++)
+
+ for (int i = 0; i < nAttrs; i++)
{
String attrUri = attributes.getURI(i);
String attrLocalName = attributes.getLocalName(i);
- XSLTAttributeDef attrDef = def.getAttributeDef( attrUri, attrLocalName
);
-
- if(null == attrDef)
+ XSLTAttributeDef attrDef = def.getAttributeDef(attrUri, attrLocalName);
+
+ if (null == attrDef)
{
- if(throwError)
+ if (throwError)
{
+
// Then barf, because this element does not allow this attribute.
- handler.error(attributes.getQName(i)+
- "attribute is not allowed on the "+
- rawName+" element!", null);
+ handler.error(attributes.getQName(i)
+ + "attribute is not allowed on the " + rawName
+ + " element!", null);
}
else
{
- undefines.addAttribute(attrUri, attrLocalName,
- attributes.getQName(i),
- attributes.getType(i),
+ undefines.addAttribute(attrUri, attrLocalName,
+ attributes.getQName(i),
+ attributes.getType(i),
attributes.getValue(i));
}
}
@@ -349,32 +395,37 @@
{
processedDefs.addElement(attrDef);
attrDef.setAttrValue(handler, attrUri, attrLocalName,
- attributes.getQName(i),
- attributes.getValue(i),
+ attributes.getQName(i), attributes.getValue(i),
target);
}
}
-
+
XSLTAttributeDef[] attrDefs = def.getAttributes();
int nAttrDefs = attrDefs.length;
- for(int i = 0; i < nAttrDefs; i++)
+
+ for (int i = 0; i < nAttrDefs; i++)
{
XSLTAttributeDef attrDef = attrDefs[i];
String defVal = attrDef.getDefault();
- if(null != defVal)
+
+ if (null != defVal)
{
- if(!processedDefs.contains(attrDef))
+ if (!processedDefs.contains(attrDef))
{
attrDef.setDefAttrValue(handler, target);
}
}
+
if (attrDef.getRequired())
{
- if(!processedDefs.contains(attrDef))
-
handler.error(XSLMessages.createMessage(XSLTErrorResources.ER_REQUIRES_ATTRIB,
new Object[]{rawName, attrDef.getName()}) , null);
- }
+ if (!processedDefs.contains(attrDef))
+ handler.error(
+ XSLMessages.createMessage(
+ XSLTErrorResources.ER_REQUIRES_ATTRIB, new Object[]{ rawName,
+
attrDef.getName() }), null);
+ }
}
+
return undefines;
}
-
}
1.11 +547 -561
xml-xalan/java/src/org/apache/xalan/processor/XSLTSchema.java
Index: XSLTSchema.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/processor/XSLTSchema.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- XSLTSchema.java 2000/10/04 23:20:08 1.10
+++ XSLTSchema.java 2000/10/30 18:40:44 1.11
@@ -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,12 +59,13 @@
import org.apache.xalan.templates.*;
/**
- * This class defines the allowed structure for a stylesheet, and the
+ * This class defines the allowed structure for a stylesheet, and the
* mapping between Xalan classes and the markup elements in the stylesheet.
* @see <a href="http://www.w3.org/TR/xslt#dtd">XSLT DTD</a>
*/
public class XSLTSchema extends XSLTElementDef
{
+
/**
* Construct a XSLTSchema which represents the XSLT "schema".
*/
@@ -72,411 +73,384 @@
{
build();
}
-
+
/**
- * This method builds an XSLT "schema" according to
http://www.w3.org/TR/xslt#dtd. This
+ * This method builds an XSLT "schema" according to
http://www.w3.org/TR/xslt#dtd. This
* schema provides instructions for building the Xalan Stylesheet
(Templates) structure.
*/
void build()
{
- XSLTAttributeDef hrefAttr
- = new XSLTAttributeDef(null, "href", XSLTAttributeDef.T_URL, true);
-
- XSLTAttributeDef elementsAttr
- = new XSLTAttributeDef(null, "elements",
XSLTAttributeDef.T_SIMPLEPATTERNLIST, true);
-
- XSLTAttributeDef methodAttr
- = new XSLTAttributeDef(null, "method", XSLTAttributeDef.T_QNAME,
false);
- XSLTAttributeDef versionAttr
- = new XSLTAttributeDef(null, "version", XSLTAttributeDef.T_NMTOKEN,
false);
- XSLTAttributeDef encodingAttr
- = new XSLTAttributeDef(null, "encoding", XSLTAttributeDef.T_CDATA,
false);
- XSLTAttributeDef omitXmlDeclarationAttr
- = new XSLTAttributeDef(null, "omit-xml-declaration",
XSLTAttributeDef.T_YESNO, false);
- XSLTAttributeDef standaloneAttr
- = new XSLTAttributeDef(null, "standalone", XSLTAttributeDef.T_YESNO,
false);
- XSLTAttributeDef doctypePublicAttr
- = new XSLTAttributeDef(null, "doctype-public",
XSLTAttributeDef.T_CDATA, false);
- XSLTAttributeDef doctypeSystemAttr
- = new XSLTAttributeDef(null, "doctype-system",
XSLTAttributeDef.T_CDATA, false);
- XSLTAttributeDef cdataSectionElementsAttr
- = new XSLTAttributeDef(null, "cdata-section-elements",
XSLTAttributeDef.T_QNAMES, false);
- XSLTAttributeDef indentAttr
- = new XSLTAttributeDef(null, "indent", XSLTAttributeDef.T_YESNO,
false);
- XSLTAttributeDef mediaTypeAttr
- = new XSLTAttributeDef(null, "media-type", XSLTAttributeDef.T_CDATA,
false);
-
- XSLTAttributeDef nameAttrRequired
- = new XSLTAttributeDef(null, "name", XSLTAttributeDef.T_QNAME, true);
- XSLTAttributeDef nameAttrOpt
- = new XSLTAttributeDef(null, "name", XSLTAttributeDef.T_QNAME, false);
- XSLTAttributeDef useAttr
- = new XSLTAttributeDef(null, "use", XSLTAttributeDef.T_EXPR, true);
-
- XSLTAttributeDef nameAVTRequired
- = new XSLTAttributeDef(null, "name", XSLTAttributeDef.T_AVT, true);
- XSLTAttributeDef namespaceAVTOpt
- = new XSLTAttributeDef(null, "namespace", XSLTAttributeDef.T_AVT,
false);
-
- XSLTAttributeDef decimalSeparatorAttr
- = new XSLTAttributeDef(null, "decimal-separator",
XSLTAttributeDef.T_CHAR, ".");
- XSLTAttributeDef groupingSeparatorAttr
- = new XSLTAttributeDef(null, "grouping-separator",
XSLTAttributeDef.T_CHAR, ",");
- XSLTAttributeDef infinityAttr
- = new XSLTAttributeDef(null, "infinity", XSLTAttributeDef.T_CDATA,
"Infinity");
- XSLTAttributeDef minusSignAttr
- = new XSLTAttributeDef(null, "minus-sign", XSLTAttributeDef.T_CHAR,
"-");
- XSLTAttributeDef NaNAttr
- = new XSLTAttributeDef(null, "NaN", XSLTAttributeDef.T_CDATA, "NaN");
- XSLTAttributeDef percentAttr
- = new XSLTAttributeDef(null, "percent", XSLTAttributeDef.T_CHAR, "%");
- XSLTAttributeDef perMilleAttr
- = new XSLTAttributeDef(null, "per-mille", XSLTAttributeDef.T_CHAR,
false /* ,"‰" */);
- XSLTAttributeDef zeroDigitAttr
- = new XSLTAttributeDef(null, "zero-digit", XSLTAttributeDef.T_CHAR,
"0");
- XSLTAttributeDef digitAttr
- = new XSLTAttributeDef(null, "digit", XSLTAttributeDef.T_CHAR, "#");
- XSLTAttributeDef patternSeparatorAttr
- = new XSLTAttributeDef(null, "pattern-separator",
XSLTAttributeDef.T_CHAR, ";");
-
- XSLTAttributeDef useAttributeSetsAttr
- = new XSLTAttributeDef(null, "use-attribute-sets",
XSLTAttributeDef.T_QNAMES, false);
-
- XSLTAttributeDef selectAttrRequired
- = new XSLTAttributeDef(null, "select", XSLTAttributeDef.T_EXPR, true);
- XSLTAttributeDef testAttrRequired
- = new XSLTAttributeDef(null, "test", XSLTAttributeDef.T_EXPR, true);
- XSLTAttributeDef selectAttrOpt
- = new XSLTAttributeDef(null, "select", XSLTAttributeDef.T_EXPR, false);
- XSLTAttributeDef selectAttrDefNode
- = new XSLTAttributeDef(null, "select", XSLTAttributeDef.T_EXPR,
"node()");
- XSLTAttributeDef selectAttrDefDot
- = new XSLTAttributeDef(null, "select", XSLTAttributeDef.T_EXPR, ".");
-
- XSLTAttributeDef matchAttrRequired
- = new XSLTAttributeDef(null, "match", XSLTAttributeDef.T_PATTERN,
true);
- XSLTAttributeDef matchAttrOpt
- = new XSLTAttributeDef(null, "match", XSLTAttributeDef.T_PATTERN,
false);
- XSLTAttributeDef priorityAttr
- = new XSLTAttributeDef(null, "priority", XSLTAttributeDef.T_PRIORITY,
false);
- XSLTAttributeDef modeAttr
- = new XSLTAttributeDef(null, "mode", XSLTAttributeDef.T_QNAME, false);
- XSLTAttributeDef spaceAttr
- = new XSLTAttributeDef(Constants.S_XMLNAMESPACEURI, "space", false,
- "default", Constants.ATTRVAL_STRIP,
- "preserve", Constants.ATTRVAL_PRESERVE);
-
- XSLTAttributeDef stylesheetPrefixAttr
- = new XSLTAttributeDef(null, "stylesheet-prefix",
XSLTAttributeDef.T_CDATA, true);
- XSLTAttributeDef resultPrefixAttr
- = new XSLTAttributeDef(null, "result-prefix",
XSLTAttributeDef.T_CDATA, true);
-
- XSLTAttributeDef disableOutputEscapingAttr
- = new XSLTAttributeDef(null, "disable-output-escaping",
XSLTAttributeDef.T_YESNO, false);
-
- XSLTAttributeDef levelAttr
- = new XSLTAttributeDef(null, "level", false,
- "single", Constants.NUMBERLEVEL_SINGLE,
- "multiple", Constants.NUMBERLEVEL_MULTI,
- "any", Constants.NUMBERLEVEL_ANY);
+
+ XSLTAttributeDef hrefAttr = new XSLTAttributeDef(null, "href",
+ XSLTAttributeDef.T_URL, true);
+ XSLTAttributeDef elementsAttr = new XSLTAttributeDef(null, "elements",
+ XSLTAttributeDef.T_SIMPLEPATTERNLIST,
+ true);
+ XSLTAttributeDef methodAttr = new XSLTAttributeDef(null, "method",
+ XSLTAttributeDef.T_QNAME, false);
+ XSLTAttributeDef versionAttr = new XSLTAttributeDef(null, "version",
+ XSLTAttributeDef.T_NMTOKEN, false);
+ XSLTAttributeDef encodingAttr = new XSLTAttributeDef(null, "encoding",
+ XSLTAttributeDef.T_CDATA, false);
+ XSLTAttributeDef omitXmlDeclarationAttr = new XSLTAttributeDef(null,
+ "omit-xml-declaration",
+ XSLTAttributeDef.T_YESNO,
+ false);
+ XSLTAttributeDef standaloneAttr = new XSLTAttributeDef(null,
+ "standalone",
+ XSLTAttributeDef.T_YESNO, false);
+ XSLTAttributeDef doctypePublicAttr = new XSLTAttributeDef(null,
+ "doctype-public",
+ XSLTAttributeDef.T_CDATA, false);
+ XSLTAttributeDef doctypeSystemAttr = new XSLTAttributeDef(null,
+ "doctype-system",
+ XSLTAttributeDef.T_CDATA, false);
+ XSLTAttributeDef cdataSectionElementsAttr = new XSLTAttributeDef(null,
+ "cdata-section-elements",
+ XSLTAttributeDef.T_QNAMES,
+ false);
+ XSLTAttributeDef indentAttr = new XSLTAttributeDef(null, "indent",
+ XSLTAttributeDef.T_YESNO, false);
+ XSLTAttributeDef mediaTypeAttr = new XSLTAttributeDef(null, "media-type",
+ XSLTAttributeDef.T_CDATA, false);
+ XSLTAttributeDef nameAttrRequired = new XSLTAttributeDef(null, "name",
+ XSLTAttributeDef.T_QNAME, true);
+ XSLTAttributeDef nameAttrOpt = new XSLTAttributeDef(null, "name",
+ XSLTAttributeDef.T_QNAME, false);
+ XSLTAttributeDef useAttr = new XSLTAttributeDef(null, "use",
+ XSLTAttributeDef.T_EXPR, true);
+ XSLTAttributeDef nameAVTRequired = new XSLTAttributeDef(null, "name",
+ XSLTAttributeDef.T_AVT, true);
+ XSLTAttributeDef namespaceAVTOpt = new XSLTAttributeDef(null,
+ "namespace", XSLTAttributeDef.T_AVT,
+ false);
+ XSLTAttributeDef decimalSeparatorAttr = new XSLTAttributeDef(null,
+ "decimal-separator",
+ XSLTAttributeDef.T_CHAR, ".");
+ XSLTAttributeDef groupingSeparatorAttr = new XSLTAttributeDef(null,
+ "grouping-separator",
+ XSLTAttributeDef.T_CHAR, ",");
+ XSLTAttributeDef infinityAttr = new XSLTAttributeDef(null, "infinity",
+ XSLTAttributeDef.T_CDATA, "Infinity");
+ XSLTAttributeDef minusSignAttr = new XSLTAttributeDef(null, "minus-sign",
+ XSLTAttributeDef.T_CHAR, "-");
+ XSLTAttributeDef NaNAttr = new XSLTAttributeDef(null, "NaN",
+ XSLTAttributeDef.T_CDATA, "NaN");
+ XSLTAttributeDef percentAttr = new XSLTAttributeDef(null, "percent",
+ XSLTAttributeDef.T_CHAR, "%");
+ XSLTAttributeDef perMilleAttr = new XSLTAttributeDef(null, "per-mille",
+ XSLTAttributeDef.T_CHAR,
+ false /* ,"‰" */);
+ XSLTAttributeDef zeroDigitAttr = new XSLTAttributeDef(null, "zero-digit",
+ XSLTAttributeDef.T_CHAR, "0");
+ XSLTAttributeDef digitAttr = new XSLTAttributeDef(null, "digit",
+ XSLTAttributeDef.T_CHAR, "#");
+ XSLTAttributeDef patternSeparatorAttr = new XSLTAttributeDef(null,
+ "pattern-separator",
+ XSLTAttributeDef.T_CHAR, ";");
+ XSLTAttributeDef useAttributeSetsAttr = new XSLTAttributeDef(null,
+ "use-attribute-sets",
+ XSLTAttributeDef.T_QNAMES,
+ false);
+ XSLTAttributeDef selectAttrRequired = new XSLTAttributeDef(null,
+ "select",
+ XSLTAttributeDef.T_EXPR, true);
+ XSLTAttributeDef testAttrRequired = new XSLTAttributeDef(null, "test",
+ XSLTAttributeDef.T_EXPR, true);
+ XSLTAttributeDef selectAttrOpt = new XSLTAttributeDef(null, "select",
+ XSLTAttributeDef.T_EXPR, false);
+ XSLTAttributeDef selectAttrDefNode = new XSLTAttributeDef(null, "select",
+ XSLTAttributeDef.T_EXPR,
"node()");
+ XSLTAttributeDef selectAttrDefDot = new XSLTAttributeDef(null, "select",
+ XSLTAttributeDef.T_EXPR, ".");
+ XSLTAttributeDef matchAttrRequired = new XSLTAttributeDef(null, "match",
+ XSLTAttributeDef.T_PATTERN, true);
+ XSLTAttributeDef matchAttrOpt = new XSLTAttributeDef(null, "match",
+ XSLTAttributeDef.T_PATTERN, false);
+ XSLTAttributeDef priorityAttr = new XSLTAttributeDef(null, "priority",
+ XSLTAttributeDef.T_PRIORITY, false);
+ XSLTAttributeDef modeAttr = new XSLTAttributeDef(null, "mode",
+ XSLTAttributeDef.T_QNAME, false);
+ XSLTAttributeDef spaceAttr =
+ new XSLTAttributeDef(Constants.S_XMLNAMESPACEURI, "space", false,
+ "default", Constants.ATTRVAL_STRIP, "preserve",
+ Constants.ATTRVAL_PRESERVE);
+ XSLTAttributeDef stylesheetPrefixAttr = new XSLTAttributeDef(null,
+ "stylesheet-prefix",
+ XSLTAttributeDef.T_CDATA,
true);
+ XSLTAttributeDef resultPrefixAttr = new XSLTAttributeDef(null,
+ "result-prefix",
+ XSLTAttributeDef.T_CDATA, true);
+ XSLTAttributeDef disableOutputEscapingAttr = new XSLTAttributeDef(null,
+ "disable-output-escaping",
+ XSLTAttributeDef.T_YESNO,
+ false);
+ XSLTAttributeDef levelAttr = new XSLTAttributeDef(null, "level", false,
+ "single", Constants.NUMBERLEVEL_SINGLE,
+ "multiple", Constants.NUMBERLEVEL_MULTI,
+ "any", Constants.NUMBERLEVEL_ANY);
+
levelAttr.setDefault("single");
-
- XSLTAttributeDef countAttr
- = new XSLTAttributeDef(null, "count", XSLTAttributeDef.T_PATTERN,
false);
- XSLTAttributeDef fromAttr
- = new XSLTAttributeDef(null, "from", XSLTAttributeDef.T_PATTERN,
false);
- XSLTAttributeDef valueAttr
- = new XSLTAttributeDef(null, "value", XSLTAttributeDef.T_EXPR, false);
- XSLTAttributeDef formatAttr
- = new XSLTAttributeDef(null, "format", XSLTAttributeDef.T_AVT, false);
+
+ XSLTAttributeDef countAttr = new XSLTAttributeDef(null, "count",
+ XSLTAttributeDef.T_PATTERN, false);
+ XSLTAttributeDef fromAttr = new XSLTAttributeDef(null, "from",
+ XSLTAttributeDef.T_PATTERN, false);
+ XSLTAttributeDef valueAttr = new XSLTAttributeDef(null, "value",
+ XSLTAttributeDef.T_EXPR, false);
+ XSLTAttributeDef formatAttr = new XSLTAttributeDef(null, "format",
+ XSLTAttributeDef.T_AVT, false);
+
formatAttr.setDefault("1");
- XSLTAttributeDef langAttr
- = new XSLTAttributeDef(null, "lang", XSLTAttributeDef.T_AVT, false);
- XSLTAttributeDef letterValueAttr
- = new XSLTAttributeDef(null, "letter-value", XSLTAttributeDef.T_AVT,
false);
- XSLTAttributeDef groupingSeparatorAVT
- = new XSLTAttributeDef(null, "grouping-separator",
XSLTAttributeDef.T_AVT, false);
- XSLTAttributeDef groupingSizeAttr
- = new XSLTAttributeDef(null, "grouping-size", XSLTAttributeDef.T_AVT,
false);
-
- XSLTAttributeDef dataTypeAttr
- = new XSLTAttributeDef(null, "data-type", XSLTAttributeDef.T_AVT,
"text");
- XSLTAttributeDef orderAttr
- = new XSLTAttributeDef(null, "order", XSLTAttributeDef.T_AVT,
"ascending");
- XSLTAttributeDef caseOrderAttr
- = new XSLTAttributeDef(null, "case-order", XSLTAttributeDef.T_AVT,
false);
-
- XSLTAttributeDef terminateAttr
- = new XSLTAttributeDef(null, "terminate", XSLTAttributeDef.T_YESNO,
false);
+
+ XSLTAttributeDef langAttr = new XSLTAttributeDef(null, "lang",
+ XSLTAttributeDef.T_AVT, false);
+ XSLTAttributeDef letterValueAttr = new XSLTAttributeDef(null,
+ "letter-value",
+ XSLTAttributeDef.T_AVT, false);
+ XSLTAttributeDef groupingSeparatorAVT = new XSLTAttributeDef(null,
+ "grouping-separator",
+ XSLTAttributeDef.T_AVT, false);
+ XSLTAttributeDef groupingSizeAttr = new XSLTAttributeDef(null,
+ "grouping-size",
+ XSLTAttributeDef.T_AVT, false);
+ XSLTAttributeDef dataTypeAttr = new XSLTAttributeDef(null, "data-type",
+ XSLTAttributeDef.T_AVT, "text");
+ XSLTAttributeDef orderAttr = new XSLTAttributeDef(null, "order",
+ XSLTAttributeDef.T_AVT, "ascending");
+ XSLTAttributeDef caseOrderAttr = new XSLTAttributeDef(null, "case-order",
+ XSLTAttributeDef.T_AVT, false);
+ XSLTAttributeDef terminateAttr = new XSLTAttributeDef(null, "terminate",
+ XSLTAttributeDef.T_YESNO, false);
+
terminateAttr.setDefault("no");
- XSLTAttributeDef xslExcludeResultPrefixesAttr
- = new XSLTAttributeDef(Constants.S_XSLNAMESPACEURL,
- "exclude-result-prefixes",
- XSLTAttributeDef.T_STRINGLIST, false);
-
- XSLTAttributeDef xslExtensionElementPrefixesAttr
- = new XSLTAttributeDef(Constants.S_XSLNAMESPACEURL,
- "extension-element-prefixes",
- XSLTAttributeDef.T_PREFIX_URLLIST, false);
-
- XSLTAttributeDef xslUseAttributeSetsAttr
- = new XSLTAttributeDef(Constants.S_XSLNAMESPACEURL,
- "use-attribute-sets",
- XSLTAttributeDef.T_QNAMES, false);
-
- XSLTAttributeDef xslVersionAttr
- = new XSLTAttributeDef(Constants.S_XSLNAMESPACEURL,
- "version",
- XSLTAttributeDef.T_NMTOKEN, false);
-
- XSLTElementDef charData
- = new XSLTElementDef(null, "text()",
- null /*alias */,
- null /* elements */,
- null, /* attributes */
- new ProcessorCharacters(),
- ElemTextLiteral.class /* class object */ );
- charData.setType(XSLTElementDef.T_PCDATA);
+ XSLTAttributeDef xslExcludeResultPrefixesAttr =
+ new XSLTAttributeDef(Constants.S_XSLNAMESPACEURL,
+ "exclude-result-prefixes",
+ XSLTAttributeDef.T_STRINGLIST, false);
+ XSLTAttributeDef xslExtensionElementPrefixesAttr =
+ new XSLTAttributeDef(Constants.S_XSLNAMESPACEURL,
+ "extension-element-prefixes",
+ XSLTAttributeDef.T_PREFIX_URLLIST, false);
+ XSLTAttributeDef xslUseAttributeSetsAttr =
+ new XSLTAttributeDef(Constants.S_XSLNAMESPACEURL, "use-attribute-sets",
+ XSLTAttributeDef.T_QNAMES, false);
+ XSLTAttributeDef xslVersionAttr =
+ new XSLTAttributeDef(Constants.S_XSLNAMESPACEURL, "version",
+ XSLTAttributeDef.T_NMTOKEN, false);
+ XSLTElementDef charData = new XSLTElementDef(null, "text()",
+ null /*alias */, null /* elements */, null,
/* attributes */
+ new ProcessorCharacters(),
+ ElemTextLiteral.class /* class object */);
- XSLTElementDef whiteSpaceOnly
- = new XSLTElementDef(null, "text()",
- null /*alias */,
- null /* elements */,
- null, /* attributes */
- null,
- ElemTextLiteral.class /* should be null? -sb */ );
charData.setType(XSLTElementDef.T_PCDATA);
+
+ XSLTElementDef whiteSpaceOnly = new XSLTElementDef(null, "text()",
+ null /*alias */, null /* elements */,
+ null, /* attributes */
+ null,
+ ElemTextLiteral.class /* should be
null? -sb */);
- XSLTAttributeDef resultAttr
- = new XSLTAttributeDef(null, "*", XSLTAttributeDef.T_AVT, false);
-
- XSLTAttributeDef xslResultAttr
- = new XSLTAttributeDef(Constants.S_XSLNAMESPACEURL, "*",
XSLTAttributeDef.T_CDATA, false);
+ charData.setType(XSLTElementDef.T_PCDATA);
+ XSLTAttributeDef resultAttr = new XSLTAttributeDef(null, "*",
+ XSLTAttributeDef.T_AVT, false);
+ XSLTAttributeDef xslResultAttr =
+ new XSLTAttributeDef(Constants.S_XSLNAMESPACEURL, "*",
+ XSLTAttributeDef.T_CDATA, false);
XSLTElementDef[] templateElements = new XSLTElementDef[21];
XSLTElementDef[] templateElementsAndParams = new XSLTElementDef[22];
XSLTElementDef[] templateElementsAndSort = new XSLTElementDef[22];
XSLTElementDef[] charTemplateElements = new XSLTElementDef[15];
+ XSLTElementDef resultElement = new XSLTElementDef(null, "*",
+ null /*alias */,
+ templateElementsAndParams /* elements
*/,
+ new XSLTAttributeDef[]{
+ xslExcludeResultPrefixesAttr,
+ xslExtensionElementPrefixesAttr,
+ xslUseAttributeSetsAttr,
+ xslVersionAttr,
+ xslResultAttr,
+ resultAttr }, new ProcessorLRE(),
+ ElemLiteralResult.class
/* class object */);
+ XSLTElementDef unknownElement =
+ new XSLTElementDef(null, "unknown", null /*alias */,
+ templateElementsAndParams /* elements */,
+ new XSLTAttributeDef[]{
xslExcludeResultPrefixesAttr,
+
xslExtensionElementPrefixesAttr,
+ xslUseAttributeSetsAttr,
+ xslVersionAttr,
+ xslResultAttr,
+ resultAttr }, new
ProcessorUnknown(),
+
ElemUnknown.class /* class object */);
+ XSLTElementDef xslValueOf =
+ new XSLTElementDef(Constants.S_XSLNAMESPACEURL, "value-of",
+ null /*alias */, null /* elements */,
+ new XSLTAttributeDef[]{ selectAttrRequired,
+ disableOutputEscapingAttr
}, new ProcessorTemplateElem(),
+
ElemValueOf.class /* class object */);
+ XSLTElementDef xslCopyOf = new
XSLTElementDef(Constants.S_XSLNAMESPACEURL,
+ "copy-of", null /*alias */,
+ null /* elements */,
+ new XSLTAttributeDef[]{ selectAttrRequired
},
+ new ProcessorTemplateElem(),
+ ElemCopyOf.class /* class object */);
+ XSLTElementDef xslNumber = new
XSLTElementDef(Constants.S_XSLNAMESPACEURL,
+ "number", null /*alias */,
+ null /* elements */,
+ new XSLTAttributeDef[]{ levelAttr,
+ countAttr,
+ fromAttr,
+ valueAttr,
+ formatAttr,
+ langAttr,
+ letterValueAttr,
+
groupingSeparatorAVT,
+ groupingSizeAttr },
new ProcessorTemplateElem(),
+
ElemNumber.class /* class object */);
- XSLTElementDef resultElement
- = new XSLTElementDef(null, "*",
- null /*alias */,
- templateElementsAndParams /* elements */,
- new XSLTAttributeDef[] {
- xslExcludeResultPrefixesAttr,
- xslExtensionElementPrefixesAttr,
- xslUseAttributeSetsAttr,
- xslVersionAttr, xslResultAttr, resultAttr},
- new ProcessorLRE(),
- ElemLiteralResult.class /* class object */ );
-
- XSLTElementDef unknownElement
- = new XSLTElementDef(null, "unknown",
- null /*alias */,
- templateElementsAndParams /* elements */,
- new XSLTAttributeDef[] {
- xslExcludeResultPrefixesAttr,
- xslExtensionElementPrefixesAttr,
- xslUseAttributeSetsAttr,
- xslVersionAttr, xslResultAttr, resultAttr},
- new ProcessorUnknown(),
- ElemUnknown.class /* class object */ );
-
- XSLTElementDef xslValueOf
- = new XSLTElementDef(Constants.S_XSLNAMESPACEURL, "value-of",
- null /*alias */,
- null /* elements */,
- new XSLTAttributeDef[] {selectAttrRequired,
disableOutputEscapingAttr},
- new ProcessorTemplateElem(),
- ElemValueOf.class /* class object */ );
-
- XSLTElementDef xslCopyOf
- = new XSLTElementDef(Constants.S_XSLNAMESPACEURL, "copy-of",
- null /*alias */,
- null /* elements */,
- new XSLTAttributeDef[] {selectAttrRequired},
- new ProcessorTemplateElem(),
- ElemCopyOf.class /* class object */ );
-
- XSLTElementDef xslNumber
- = new XSLTElementDef(Constants.S_XSLNAMESPACEURL, "number",
- null /*alias */,
- null /* elements */,
- new XSLTAttributeDef[] {
- levelAttr, countAttr, fromAttr, valueAttr,
formatAttr,
- langAttr, letterValueAttr, groupingSeparatorAVT,
- groupingSizeAttr},
- new ProcessorTemplateElem(),
- ElemNumber.class /* class object */ );
-
// <!-- xsl:sort cannot occur after any other elements or
// any non-whitespace character -->
- XSLTElementDef xslSort
- = new XSLTElementDef(Constants.S_XSLNAMESPACEURL, "sort",
- null /*alias */,
- null /* elements */,
- new XSLTAttributeDef[] {
- selectAttrDefDot, langAttr, dataTypeAttr,
orderAttr, caseOrderAttr},
- new ProcessorTemplateElem(),
- ElemSort.class /* class object */ );
-
- XSLTElementDef xslWithParam
- = new XSLTElementDef(Constants.S_XSLNAMESPACEURL, "with-param",
- null /*alias */,
- templateElements /* elements */, // %template;>
- new XSLTAttributeDef[] {nameAttrRequired,
selectAttrOpt},
- new ProcessorTemplateElem(),
- ElemWithParam.class /* class object */ );
-
- XSLTElementDef xslApplyTemplates
- = new XSLTElementDef(Constants.S_XSLNAMESPACEURL, "apply-templates",
- null /*alias */,
- new XSLTElementDef[] {xslSort, xslWithParam} /*
elements */,
- new XSLTAttributeDef[] {selectAttrDefNode,
modeAttr},
- new ProcessorTemplateElem(),
- ElemApplyTemplates.class /* class object */ );
-
- XSLTElementDef xslApplyImports
- = new XSLTElementDef(Constants.S_XSLNAMESPACEURL, "apply-imports",
- null /*alias */,
- null /* elements */,
- new XSLTAttributeDef[] {},
- new ProcessorTemplateElem(),
- ElemApplyImport.class /* class object */ );
-
- XSLTElementDef xslForEach
- = new XSLTElementDef(Constants.S_XSLNAMESPACEURL, "for-each",
- null /*alias */,
- templateElementsAndSort, // (#PCDATA
%instructions; %result-elements; | xsl:sort)*
- new XSLTAttributeDef[] {selectAttrRequired,
spaceAttr},
- new ProcessorTemplateElem(),
- ElemForEach.class /* class object */ );
-
- XSLTElementDef xslIf
- = new XSLTElementDef(Constants.S_XSLNAMESPACEURL, "if",
- null /*alias */,
- templateElements /* elements */, // %template;
- new XSLTAttributeDef[] {testAttrRequired,
spaceAttr},
- new ProcessorTemplateElem(),
- ElemIf.class /* class object */ );
-
- XSLTElementDef xslWhen
- = new XSLTElementDef(Constants.S_XSLNAMESPACEURL, "when",
- null /*alias */,
- templateElements /* elements */, // %template;>
- new XSLTAttributeDef[] {testAttrRequired,
spaceAttr},
- new ProcessorTemplateElem(),
- ElemWhen.class /* class object */ );
-
- XSLTElementDef xslOtherwise
- = new XSLTElementDef(Constants.S_XSLNAMESPACEURL, "otherwise",
- null /*alias */,
- templateElements /* elements */, // %template;>
- new XSLTAttributeDef[] {spaceAttr},
- new ProcessorTemplateElem(),
- ElemOtherwise.class /* class object */ );
-
- XSLTElementDef xslChoose
- = new XSLTElementDef(Constants.S_XSLNAMESPACEURL, "choose",
- null /*alias */,
- new XSLTElementDef[] {xslWhen, xslOtherwise} /*
elements */,
- new XSLTAttributeDef[] {spaceAttr},
- new ProcessorTemplateElem(),
- ElemChoose.class /* class object */ );
-
- XSLTElementDef xslAttribute
- = new XSLTElementDef(Constants.S_XSLNAMESPACEURL, "attribute",
- null /*alias */,
- charTemplateElements /* elements */, //
%char-template;>
- new XSLTAttributeDef[] {nameAVTRequired,
namespaceAVTOpt, spaceAttr},
- new ProcessorTemplateElem(),
- ElemAttribute.class /* class object */ );
-
- XSLTElementDef xslCallTemplate
- = new XSLTElementDef(Constants.S_XSLNAMESPACEURL, "call-template",
- null /*alias */,
- new XSLTElementDef[] {xslWithParam} /* elements
*/,
- new XSLTAttributeDef[] {nameAttrRequired},
- new ProcessorTemplateElem(),
- ElemCallTemplate.class /* class object */ );
-
- XSLTElementDef xslVariable
- = new XSLTElementDef(Constants.S_XSLNAMESPACEURL, "variable",
- null /*alias */,
- templateElements /* elements */, // %template;>
- new XSLTAttributeDef[] {nameAttrRequired,
selectAttrOpt},
- new ProcessorTemplateElem(),
- ElemVariable.class /* class object */ );
-
- XSLTElementDef xslParam
- = new XSLTElementDef(Constants.S_XSLNAMESPACEURL, "param",
- null /*alias */,
- templateElements /* elements */, // %template;>
- new XSLTAttributeDef[] {nameAttrRequired,
selectAttrOpt},
- new ProcessorTemplateElem(),
- ElemParam.class /* class object */ );
-
- XSLTElementDef xslText
- = new XSLTElementDef(Constants.S_XSLNAMESPACEURL, "text",
- null /*alias */,
- new XSLTElementDef[] {charData} /* elements */,
- new XSLTAttributeDef[]
{disableOutputEscapingAttr},
- new ProcessorText(),
- ElemText.class /* class object */ );
-
- XSLTElementDef xslProcessingInstruction
- = new XSLTElementDef(Constants.S_XSLNAMESPACEURL,
"processing-instruction",
- null /*alias */,
- charTemplateElements /* elements */, //
%char-template;>
- new XSLTAttributeDef[] {nameAVTRequired,
spaceAttr},
- new ProcessorTemplateElem(),
- ElemPI.class /* class object */ );
-
- XSLTElementDef xslElement
- = new XSLTElementDef(Constants.S_XSLNAMESPACEURL, "element",
- null /*alias */,
- templateElements /* elements */, // %template;
- new XSLTAttributeDef[] {nameAVTRequired,
namespaceAVTOpt,
- useAttributeSetsAttr, spaceAttr},
- new ProcessorTemplateElem(),
- ElemElement.class /* class object */ );
-
- XSLTElementDef xslComment
- = new XSLTElementDef(Constants.S_XSLNAMESPACEURL, "comment",
- null /*alias */,
- charTemplateElements /* elements */, //
%char-template;>
- new XSLTAttributeDef[] {spaceAttr},
- new ProcessorTemplateElem(),
- ElemComment.class /* class object */ );
-
- XSLTElementDef xslCopy
- = new XSLTElementDef(Constants.S_XSLNAMESPACEURL, "copy",
- null /*alias */,
- templateElements /* elements */, // %template;>
- new XSLTAttributeDef[] {spaceAttr,
useAttributeSetsAttr},
- new ProcessorTemplateElem(),
- ElemCopy.class /* class object */ );
-
- XSLTElementDef xslMessage
- = new XSLTElementDef(Constants.S_XSLNAMESPACEURL, "message",
- null /*alias */,
- templateElements /* elements */, // %template;>
- new XSLTAttributeDef[] {},
- new ProcessorTemplateElem(),
- ElemMessage.class /* class object */ );
-
- XSLTElementDef xslFallback
- = new XSLTElementDef(Constants.S_XSLNAMESPACEURL, "fallback",
- null /*alias */,
- templateElements /* elements */, // %template;>
- new XSLTAttributeDef[] {spaceAttr},
- new ProcessorTemplateElem(),
- ElemFallback.class /* class object */ );
-
+ XSLTElementDef xslSort = new XSLTElementDef(Constants.S_XSLNAMESPACEURL,
+ "sort", null /*alias */,
+ null /* elements */,
+ new XSLTAttributeDef[]{
+ selectAttrDefDot,
+ langAttr,
+ dataTypeAttr,
+ orderAttr,
+ caseOrderAttr }, new
ProcessorTemplateElem(),
+
ElemSort.class /* class object */);
+ XSLTElementDef xslWithParam =
+ new XSLTElementDef(Constants.S_XSLNAMESPACEURL, "with-param",
+ null /*alias */, templateElements /* elements */,
// %template;>
+ new XSLTAttributeDef[]{ nameAttrRequired,
+ selectAttrOpt },
new ProcessorTemplateElem(),
+
ElemWithParam.class /* class object */);
+ XSLTElementDef xslApplyTemplates =
+ new XSLTElementDef(Constants.S_XSLNAMESPACEURL, "apply-templates",
+ null /*alias */, new XSLTElementDef[]{ xslSort,
+ xslWithParam
} /* elements */, new XSLTAttributeDef[]{
+
selectAttrDefNode,
+ modeAttr
}, new ProcessorTemplateElem(),
+
ElemApplyTemplates.class /* class object */);
+ XSLTElementDef xslApplyImports =
+ new XSLTElementDef(Constants.S_XSLNAMESPACEURL, "apply-imports",
+ null /*alias */, null /* elements */,
+ new XSLTAttributeDef[]{},
+ new ProcessorTemplateElem(),
+ ElemApplyImport.class /* class object */);
+ XSLTElementDef xslForEach =
+ new XSLTElementDef(Constants.S_XSLNAMESPACEURL, "for-each",
+ null /*alias */, templateElementsAndSort, //
(#PCDATA %instructions; %result-elements; | xsl:sort)*
+ new XSLTAttributeDef[]{ selectAttrRequired,
+ spaceAttr }, new
ProcessorTemplateElem(),
+
ElemForEach.class /* class object */);
+ XSLTElementDef xslIf = new XSLTElementDef(Constants.S_XSLNAMESPACEURL,
+ "if", null /*alias */,
+ templateElements /* elements
*/, // %template;
+ new XSLTAttributeDef[]{
+ testAttrRequired,
+ spaceAttr }, new
ProcessorTemplateElem(),
+ ElemIf.class /*
class object */);
+ XSLTElementDef xslWhen =
+ new XSLTElementDef(Constants.S_XSLNAMESPACEURL, "when",
+ null /*alias */, templateElements /* elements */,
// %template;>
+ new XSLTAttributeDef[]{
+ testAttrRequired,
+ spaceAttr }, new
ProcessorTemplateElem(),
+
ElemWhen.class /* class object */);
+ XSLTElementDef xslOtherwise =
+ new XSLTElementDef(Constants.S_XSLNAMESPACEURL, "otherwise",
+ null /*alias */, templateElements /* elements */,
// %template;>
+ new XSLTAttributeDef[]{ spaceAttr },
+ new ProcessorTemplateElem(),
+ ElemOtherwise.class /* class object */);
+ XSLTElementDef xslChoose = new
XSLTElementDef(Constants.S_XSLNAMESPACEURL,
+ "choose", null /*alias */,
+ new XSLTElementDef[]{ xslWhen,
+ xslOtherwise } /*
elements */, new XSLTAttributeDef[]{ spaceAttr },
+
new ProcessorTemplateElem(),
+
ElemChoose.class /* class object */);
+ XSLTElementDef xslAttribute =
+ new XSLTElementDef(Constants.S_XSLNAMESPACEURL, "attribute",
+ null /*alias */, charTemplateElements /* elements
*/, // %char-template;>
+ new XSLTAttributeDef[]{ nameAVTRequired,
+ namespaceAVTOpt,
+ spaceAttr }, new
ProcessorTemplateElem(),
+
ElemAttribute.class /* class object */);
+ XSLTElementDef xslCallTemplate =
+ new XSLTElementDef(Constants.S_XSLNAMESPACEURL, "call-template",
+ null /*alias */,
+ new XSLTElementDef[]{ xslWithParam } /* elements */,
+ new XSLTAttributeDef[]{ nameAttrRequired },
+ new ProcessorTemplateElem(),
+ ElemCallTemplate.class /* class object */);
+ XSLTElementDef xslVariable =
+ new XSLTElementDef(Constants.S_XSLNAMESPACEURL, "variable",
+ null /*alias */, templateElements /* elements */,
// %template;>
+ new XSLTAttributeDef[]{ nameAttrRequired,
+ selectAttrOpt },
new ProcessorTemplateElem(),
+
ElemVariable.class /* class object */);
+ XSLTElementDef xslParam = new XSLTElementDef(Constants.S_XSLNAMESPACEURL,
+ "param", null /*alias */,
+ templateElements /* elements */, //
%template;>
+ new XSLTAttributeDef[]{ nameAttrRequired,
+ selectAttrOpt }, new
ProcessorTemplateElem(),
+
ElemParam.class /* class object */);
+ XSLTElementDef xslText =
+ new XSLTElementDef(Constants.S_XSLNAMESPACEURL, "text",
+ null /*alias */,
+ new XSLTElementDef[]{ charData } /* elements */,
+ new XSLTAttributeDef[]{ disableOutputEscapingAttr },
+ new ProcessorText(),
+ ElemText.class /* class object */);
+ XSLTElementDef xslProcessingInstruction =
+ new XSLTElementDef(Constants.S_XSLNAMESPACEURL,
+ "processing-instruction", null /*alias */,
+ charTemplateElements /* elements */, //
%char-template;>
+ new XSLTAttributeDef[]{
+ nameAVTRequired,
+ spaceAttr }, new
ProcessorTemplateElem(),
+ ElemPI.class
/* class object */);
+ XSLTElementDef xslElement =
+ new XSLTElementDef(Constants.S_XSLNAMESPACEURL, "element",
+ null /*alias */, templateElements /* elements */,
// %template;
+ new XSLTAttributeDef[]{ nameAVTRequired,
+ namespaceAVTOpt,
+
useAttributeSetsAttr,
+ spaceAttr }, new
ProcessorTemplateElem(),
+
ElemElement.class /* class object */);
+ XSLTElementDef xslComment =
+ new XSLTElementDef(Constants.S_XSLNAMESPACEURL, "comment",
+ null /*alias */, charTemplateElements /* elements
*/, // %char-template;>
+ new XSLTAttributeDef[]{ spaceAttr },
+ new ProcessorTemplateElem(),
+ ElemComment.class /* class object */);
+ XSLTElementDef xslCopy =
+ new XSLTElementDef(Constants.S_XSLNAMESPACEURL, "copy",
+ null /*alias */, templateElements /* elements */,
// %template;>
+ new XSLTAttributeDef[]{
+ spaceAttr,
+ useAttributeSetsAttr },
new ProcessorTemplateElem(),
+
ElemCopy.class /* class object */);
+ XSLTElementDef xslMessage =
+ new XSLTElementDef(Constants.S_XSLNAMESPACEURL, "message",
+ null /*alias */, templateElements /* elements */,
// %template;>
+ new XSLTAttributeDef[]{},
+ new ProcessorTemplateElem(),
+ ElemMessage.class /* class object */);
+ XSLTElementDef xslFallback =
+ new XSLTElementDef(Constants.S_XSLNAMESPACEURL, "fallback",
+ null /*alias */, templateElements /* elements */,
// %template;>
+ new XSLTAttributeDef[]{ spaceAttr },
+ new ProcessorTemplateElem(),
+ ElemFallback.class /* class object */);
int i = 0;
- templateElements[i++] = charData; // #PCDATA
-
+
+ templateElements[i++] = charData; // #PCDATA
+
// char-instructions
templateElements[i++] = xslApplyTemplates;
templateElements[i++] = xslCallTemplate;
@@ -492,7 +466,7 @@
templateElements[i++] = xslVariable;
templateElements[i++] = xslMessage;
templateElements[i++] = xslFallback;
-
+
// instructions
templateElements[i++] = xslProcessingInstruction;
templateElements[i++] = xslComment;
@@ -500,22 +474,25 @@
templateElements[i++] = xslAttribute;
templateElements[i++] = resultElement;
templateElements[i++] = unknownElement;
-
+
int k;
- for(k = 0; k < i; k++)
+
+ for (k = 0; k < i; k++)
{
templateElementsAndParams[k] = templateElements[k];
}
+
templateElementsAndParams[k] = xslParam;
-
- for(k = 0; k < i; k++)
+
+ for (k = 0; k < i; k++)
{
templateElementsAndSort[k] = templateElements[k];
}
- templateElementsAndSort[k] = xslSort;
+ templateElementsAndSort[k] = xslSort;
i = 0;
- charTemplateElements[i++] = charData; // #PCDATA
+ charTemplateElements[i++] = charData; // #PCDATA
+
// char-instructions
charTemplateElements[i++] = xslApplyTemplates;
charTemplateElements[i++] = xslCallTemplate;
@@ -531,173 +508,182 @@
charTemplateElements[i++] = xslVariable;
charTemplateElements[i++] = xslMessage;
charTemplateElements[i++] = xslFallback;
-
- XSLTElementDef importDef
- = new XSLTElementDef(Constants.S_XSLNAMESPACEURL, "import",
- null /*alias */,
- null /* elements */,
- new XSLTAttributeDef[] {hrefAttr}, // EMPTY
- new ProcessorImport(),
- null /* class object */ );
-
- XSLTElementDef includeDef
- = new XSLTElementDef(Constants.S_XSLNAMESPACEURL, "include",
- null /*alias */,
- null /* elements */, // EMPTY
- new XSLTAttributeDef[] {hrefAttr},
- new ProcessorInclude(),
- null /* class object */ );
-
- XSLTElementDef[] topLevelElements
- = new XSLTElementDef[]
- {includeDef, importDef, resultElement, whiteSpaceOnly,
unknownElement,
-
- new XSLTElementDef(Constants.S_XSLNAMESPACEURL, "strip-space",
- null /*alias */,
- null /* elements */, // EMPTY
- new XSLTAttributeDef[] {elementsAttr},
- new ProcessorStripSpace(),
- null /* class object */ ),
-
- new XSLTElementDef(Constants.S_XSLNAMESPACEURL, "preserve-space",
- null /*alias */,
- null /* elements */, // EMPTY
- new XSLTAttributeDef[] {elementsAttr},
- new ProcessorPreserveSpace(),
- null /* class object */ ),
-
- new XSLTElementDef(Constants.S_XSLNAMESPACEURL, "output",
- null /*alias */,
- null /* elements */, // EMPTY
- new XSLTAttributeDef[] {methodAttr, versionAttr,
- encodingAttr, omitXmlDeclarationAttr,
- standaloneAttr, doctypePublicAttr, doctypeSystemAttr,
cdataSectionElementsAttr,
- indentAttr, mediaTypeAttr},
- new ProcessorOutputElem(),
- null /* class object */ ),
-
- new XSLTElementDef(Constants.S_XSLNAMESPACEURL, "key",
- null /*alias */,
- null /* elements */, // EMPTY
- new XSLTAttributeDef[] {nameAttrRequired, matchAttrRequired,
useAttr},
- new ProcessorKey(),
- null /* class object */ ),
-
- new XSLTElementDef(Constants.S_XSLNAMESPACEURL, "decimal-format",
- null /*alias */,
- null /* elements */, // EMPTY
- new XSLTAttributeDef[] {
- nameAttrOpt, decimalSeparatorAttr, groupingSeparatorAttr,
- infinityAttr, minusSignAttr, NaNAttr,
- percentAttr, perMilleAttr, zeroDigitAttr,
- digitAttr, patternSeparatorAttr},
- new ProcessorDecimalFormat(),
- null /* class object */ ),
-
- new XSLTElementDef(Constants.S_XSLNAMESPACEURL, "attribute-set",
- null /*alias */,
- new XSLTElementDef[] {xslAttribute} /* elements */,
- new XSLTAttributeDef[] {nameAttrRequired, useAttributeSetsAttr},
- new ProcessorAttributeSet(),
- null /* class object */ ),
-
- new XSLTElementDef(Constants.S_XSLNAMESPACEURL, "variable",
- null /*alias */,
- templateElements /* elements */,
- new XSLTAttributeDef[] {nameAttrRequired, selectAttrOpt},
- new ProcessorGlobalVariableDecl(),
- ElemVariable.class /* class object */ ),
-
- new XSLTElementDef(Constants.S_XSLNAMESPACEURL, "param",
- null /*alias */,
- templateElements /* elements */,
- new XSLTAttributeDef[] {nameAttrRequired, selectAttrOpt},
- new ProcessorGlobalParamDecl(),
- ElemParam.class /* class object */ ),
-
- new XSLTElementDef(Constants.S_XSLNAMESPACEURL, "template",
- null /*alias */,
- templateElementsAndParams /* elements */,
- new XSLTAttributeDef[] {matchAttrOpt, nameAttrOpt, priorityAttr,
modeAttr, spaceAttr},
- new ProcessorTemplate(),
- ElemTemplate.class /* class object */ ),
-
- new XSLTElementDef(Constants.S_XSLNAMESPACEURL, "namespace-alias",
- null /*alias */,
- null /* elements */, // EMPTY
- new XSLTAttributeDef[] {stylesheetPrefixAttr, resultPrefixAttr},
- new ProcessorNamespaceAlias(),
- null /* class object */ ),
-
- new XSLTElementDef(Constants.S_BUILTIN_EXTENSIONS_URL,
- "component",
- null /*alias */,
- new XSLTElementDef[]
- {
- new XSLTElementDef(Constants.S_BUILTIN_EXTENSIONS_URL,
- "script",
- null /*alias */,
- new XSLTElementDef[] {charData} /* elements */,
- new XSLTAttributeDef[] {
- new XSLTAttributeDef(null, "lang", XSLTAttributeDef.T_NMTOKEN,
true),
- new XSLTAttributeDef(null, "src", XSLTAttributeDef.T_URL,
false)
- },
- new ProcessorLRE(),
- ElemExtensionScript.class /* class object */ )
- }, // EMPTY
- new XSLTAttributeDef[] {
- new XSLTAttributeDef(null, "prefix", XSLTAttributeDef.T_NMTOKEN,
true),
- new XSLTAttributeDef(null, "elements",
XSLTAttributeDef.T_STRINGLIST, false),
- new XSLTAttributeDef(null, "functions",
XSLTAttributeDef.T_STRINGLIST, false)
- },
- new ProcessorLRE(),
- ElemExtensionDecl.class /* class object */ )
-
- };
-
- XSLTAttributeDef excludeResultPrefixesAttr
- = new XSLTAttributeDef(null, "exclude-result-prefixes",
- XSLTAttributeDef.T_STRINGLIST, false);
-
- XSLTAttributeDef extensionElementPrefixesAttr
- = new XSLTAttributeDef(null, "extension-element-prefixes",
- XSLTAttributeDef.T_PREFIX_URLLIST, false);
-
- XSLTAttributeDef idAttr
- = new XSLTAttributeDef(null, "id",
- XSLTAttributeDef.T_CDATA, false);
-
- XSLTAttributeDef versionAttrRequired
- = new XSLTAttributeDef(null, "version",
- XSLTAttributeDef.T_NMTOKEN, true);
-
- XSLTElementDef stylesheetElemDef
- = new XSLTElementDef(Constants.S_XSLNAMESPACEURL,
- "stylesheet",
- "transform",
- topLevelElements,
- new XSLTAttributeDef[] {
- extensionElementPrefixesAttr,
excludeResultPrefixesAttr,
- idAttr, versionAttrRequired, spaceAttr
- },
- new ProcessorStylesheetElement(), /*
ContentHandler */
- null /* class object */
- );
-
- importDef.setElements(
- new XSLTElementDef[] {stylesheetElemDef, resultElement,
unknownElement});
-
- includeDef.setElements(
- new XSLTElementDef[] {stylesheetElemDef, resultElement,
unknownElement});
-
- build(null,
- null,
- null,
- new XSLTElementDef[] {stylesheetElemDef, whiteSpaceOnly,
resultElement, unknownElement},
- null,
- new ProcessorStylesheetDoc(), /* ContentHandler */
- null /* class object */
- );
+ XSLTElementDef importDef = new
XSLTElementDef(Constants.S_XSLNAMESPACEURL,
+ "import", null /*alias */,
+ null /* elements */,
+ new XSLTAttributeDef[]{ hrefAttr }, //
EMPTY
+ new ProcessorImport(),
+ null /* class object */);
+ XSLTElementDef includeDef =
+ new XSLTElementDef(Constants.S_XSLNAMESPACEURL, "include",
+ null /*alias */, null /* elements */, // EMPTY
+ new XSLTAttributeDef[]{ hrefAttr },
+ new ProcessorInclude(),
+ null /* class object */);
+ XSLTElementDef[] topLevelElements = new XSLTElementDef[]{ includeDef,
+ importDef,
+ resultElement,
+ whiteSpaceOnly,
+ unknownElement,
+ new
XSLTElementDef(
+
Constants.S_XSLNAMESPACEURL,
+
"strip-space",
+ null /*alias
*/,
+ null /*
elements */, // EMPTY
+
new XSLTAttributeDef[]{ elementsAttr },
+
new ProcessorStripSpace(),
+
null /* class object */),
+ new
XSLTElementDef(
+
Constants.S_XSLNAMESPACEURL,
+
"preserve-space",
+ null /*alias
*/,
+ null /*
elements */, // EMPTY
+
new XSLTAttributeDef[]{ elementsAttr },
+
new ProcessorPreserveSpace(),
+
null /* class object */),
+ new
XSLTElementDef(
+
Constants.S_XSLNAMESPACEURL,
+ "output",
+ null /*alias
*/,
+ null /*
elements */, // EMPTY
+
new XSLTAttributeDef[]{
+
methodAttr,
+
versionAttr,
+
encodingAttr,
+
omitXmlDeclarationAttr,
+
standaloneAttr,
+
doctypePublicAttr,
+
doctypeSystemAttr,
+
cdataSectionElementsAttr,
+
indentAttr,
+
mediaTypeAttr }, new ProcessorOutputElem(), null /* class object */), new
XSLTElementDef(
+
Constants.S_XSLNAMESPACEURL,
+
"key",
+
null /*alias */,
+
null /* elements */, // EMPTY
+
new XSLTAttributeDef[]{ nameAttrRequired,
+
matchAttrRequired,
+
useAttr }, new
ProcessorKey(), null /* class object */),
+ new
XSLTElementDef(
+
Constants.S_XSLNAMESPACEURL,
+
"decimal-format",
+ null /*alias
*/,
+ null /*
elements */, // EMPTY
+
new XSLTAttributeDef[]{
+
nameAttrOpt,
+
decimalSeparatorAttr,
+
groupingSeparatorAttr,
+
infinityAttr,
+
minusSignAttr,
+
NaNAttr,
+
percentAttr,
+
perMilleAttr,
+
zeroDigitAttr,
+
digitAttr,
+
patternSeparatorAttr }, new ProcessorDecimalFormat(),
+
null /* class object */),
+ new
XSLTElementDef(
+
Constants.S_XSLNAMESPACEURL,
+
"attribute-set",
+ null /*alias
*/,
+ new
XSLTElementDef[]{
+ xslAttribute
} /* elements */,
+ new
XSLTAttributeDef[]{
+
nameAttrRequired,
+
useAttributeSetsAttr }, new ProcessorAttributeSet(),
+
null /* class object */),
+ new
XSLTElementDef(
+
Constants.S_XSLNAMESPACEURL,
+ "variable",
+ null /*alias
*/,
+
templateElements /* elements */,
+ new
XSLTAttributeDef[]{
+
nameAttrRequired,
+
selectAttrOpt }, new ProcessorGlobalVariableDecl(),
+
ElemVariable.class /* class object */),
+ new
XSLTElementDef(
+
Constants.S_XSLNAMESPACEURL,
+ "param",
+ null /*alias
*/,
+
templateElements /* elements */,
+ new
XSLTAttributeDef[]{
+
nameAttrRequired,
+
selectAttrOpt }, new ProcessorGlobalParamDecl(),
+
ElemParam.class /* class object */),
+ new
XSLTElementDef(
+
Constants.S_XSLNAMESPACEURL,
+ "template",
+ null /*alias
*/,
+
templateElementsAndParams /* elements */,
+ new
XSLTAttributeDef[]{
+
matchAttrOpt,
+
nameAttrOpt,
+
priorityAttr,
+ modeAttr,
+ spaceAttr
}, new ProcessorTemplate(), ElemTemplate.class /* class object */), new
XSLTElementDef(
+
Constants.S_XSLNAMESPACEURL,
+
"namespace-alias",
+ null
/*alias */,
+ null /*
elements */, // EMPTY
+
new
XSLTAttributeDef[]{ stylesheetPrefixAttr,
+
resultPrefixAttr }, new ProcessorNamespaceAlias(), null /* class
object */),
+ new
XSLTElementDef(
+
Constants.S_BUILTIN_EXTENSIONS_URL,
+ "component",
+ null /*alias
*/,
+ new
XSLTElementDef[]{
+ new
XSLTElementDef(
+
Constants.S_BUILTIN_EXTENSIONS_URL,
+ "script",
+ null
/*alias */,
+ new
XSLTElementDef[]{ charData } /* elements */,
+ new
XSLTAttributeDef[]{
+ new
XSLTAttributeDef(
+ null,
+
"lang",
+
XSLTAttributeDef.T_NMTOKEN,
+
true),
+ new
XSLTAttributeDef(null, "src", XSLTAttributeDef.T_URL, false) }, new
ProcessorLRE(),
+
ElemExtensionScript.class /* class object */) }, // EMPTY
+
new XSLTAttributeDef[]{ new XSLTAttributeDef(null, "prefix",
XSLTAttributeDef.T_NMTOKEN, true),
+
new XSLTAttributeDef(null, "elements",
XSLTAttributeDef.T_STRINGLIST, false),
+
new XSLTAttributeDef(null, "functions",
XSLTAttributeDef.T_STRINGLIST, false) }, new ProcessorLRE(),
ElemExtensionDecl.class /* class object */) };
+ XSLTAttributeDef excludeResultPrefixesAttr =
+ new XSLTAttributeDef(null, "exclude-result-prefixes",
+ XSLTAttributeDef.T_STRINGLIST, false);
+ XSLTAttributeDef extensionElementPrefixesAttr =
+ new XSLTAttributeDef(null, "extension-element-prefixes",
+ XSLTAttributeDef.T_PREFIX_URLLIST, false);
+ XSLTAttributeDef idAttr = new XSLTAttributeDef(null, "id",
+ XSLTAttributeDef.T_CDATA, false);
+ XSLTAttributeDef versionAttrRequired = new XSLTAttributeDef(null,
+ "version",
+ XSLTAttributeDef.T_NMTOKEN,
+ true);
+ XSLTElementDef stylesheetElemDef =
+ new XSLTElementDef(Constants.S_XSLNAMESPACEURL, "stylesheet",
+ "transform", topLevelElements,
+ new XSLTAttributeDef[]{
extensionElementPrefixesAttr,
+ excludeResultPrefixesAttr,
+ idAttr,
+ versionAttrRequired,
+ spaceAttr }, new
ProcessorStylesheetElement(), /* ContentHandler */
+
null /* class object */
+
);
+
+ importDef.setElements(new XSLTElementDef[]{ stylesheetElemDef,
+ resultElement,
+ unknownElement });
+ includeDef.setElements(new XSLTElementDef[]{ stylesheetElemDef,
+ resultElement,
+ unknownElement });
+ build(null, null, null, new XSLTElementDef[]{ stylesheetElemDef,
+ whiteSpaceOnly,
+ resultElement,
+ unknownElement }, null,
+ new
ProcessorStylesheetDoc(), /* ContentHandler */
+ null /*
class object */
+ );
}
}