bug244197 - Code that has xalan report more than one error when checking variables in XPath statements. This code is not yet actively hooked up. Need unit tests for these.
diff --git a/bundles/org.eclipse.wst.xsl.core/src/org/eclipse/wst/xsl/core/internal/validation/xalan/XSLValidator.java b/bundles/org.eclipse.wst.xsl.core/src/org/eclipse/wst/xsl/core/internal/validation/xalan/XSLValidator.java
index 709c164..b2e43c4 100644
--- a/bundles/org.eclipse.wst.xsl.core/src/org/eclipse/wst/xsl/core/internal/validation/xalan/XSLValidator.java
+++ b/bundles/org.eclipse.wst.xsl.core/src/org/eclipse/wst/xsl/core/internal/validation/xalan/XSLValidator.java
@@ -11,29 +11,19 @@
package org.eclipse.wst.xsl.core.internal.validation.xalan;
-import java.io.File;
-import java.util.Properties;
-
-import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParserFactory;
import javax.xml.transform.ErrorListener;
-import javax.xml.transform.Source;
import javax.xml.transform.Templates;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerFactory;
import javax.xml.transform.sax.SAXSource;
import javax.xml.transform.sax.SAXTransformerFactory;
-import javax.xml.transform.sax.TransformerHandler;
-import javax.xml.transform.stream.StreamSource;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.wst.xml.core.internal.validation.core.ValidationReport;
import org.eclipse.wst.xsl.core.internal.XSLCorePlugin;
import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
-import org.apache.xalan.processor.TransformerFactoryImpl;
+import org.eclipse.wst.xsl.core.internal.compiler.xslt10.processor.TransformerFactoryImpl;
import org.apache.xml.utils.DefaultErrorHandler;
/**
@@ -62,7 +52,7 @@
ErrorListener errorListener = new XSLValidationReport();
synchronized (XPATH_LOCK) {
- XalanTransformerFactoryImpl transformer = new XalanTransformerFactoryImpl();
+ TransformerFactoryImpl transformer = new TransformerFactoryImpl();
transformer.setErrorListener(errorListener);
try {
diff --git a/bundles/org.eclipse.wst.xsl.core/src/org/eclipse/wst/xsl/core/internal/validation/xalan/XalanTransformerFactoryImpl.java b/bundles/org.eclipse.wst.xsl.core/src/org/eclipse/wst/xsl/core/internal/validation/xalan/XalanTransformerFactoryImpl.java
deleted file mode 100644
index 134520a..0000000
--- a/bundles/org.eclipse.wst.xsl.core/src/org/eclipse/wst/xsl/core/internal/validation/xalan/XalanTransformerFactoryImpl.java
+++ /dev/null
@@ -1,209 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Standards for Technology in Automotive Retail
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * David Carver - STAR - bug 224197 - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.wst.xsl.core.internal.validation.xalan;
-
-import javax.xml.XMLConstants;
-import javax.xml.transform.Source;
-import javax.xml.transform.Templates;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.sax.SAXSource;
-import javax.xml.transform.sax.TemplatesHandler;
-import javax.xml.transform.sax.TransformerHandler;
-
-import org.eclipse.wst.xsl.core.internal.compiler.xslt10.processor.TransformerFactoryImpl;
-import org.apache.xml.utils.SystemIDResolver;
-import org.eclipse.wst.xsl.core.internal.compiler.xslt10.processor.CustomStylesheetHandler;
-import org.xml.sax.InputSource;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.XMLReaderFactory;
-
-/**
- * @author dcarver
- *
- */
-public class XalanTransformerFactoryImpl extends TransformerFactoryImpl {
-
- /**
- * <p>
- * State of secure processing feature.
- * </p>
- */
- private boolean m_isSecureProcessing = false;
-
- /**
- *
- */
- public XalanTransformerFactoryImpl() {
- // TODO Auto-generated constructor stub
- }
-
- /**
- * Process the source into a Templates object, which is likely a compiled
- * representation of the source. This Templates object may then be used
- * concurrently across multiple threads. Creating a Templates object allows
- * the TransformerFactory to do detailed performance optimization of
- * transformation instructions, without penalizing runtime transformation.
- *
- * @param source
- * An object that holds a URL, input stream, etc.
- * @return A Templates object capable of being used for transformation
- * purposes.
- *
- * @throws TransformerConfigurationException
- * May throw this during the parse when it is constructing the
- * Templates object and fails.
- */
- @Override
- public Templates newTemplates(Source source)
- throws TransformerConfigurationException {
-
- String baseID = source.getSystemId();
-
- if (null != baseID) {
- baseID = SystemIDResolver.getAbsoluteURI(baseID);
- }
-
- // if (source instanceof DOMSource) {
- // DOMSource dsource = (DOMSource) source;
- // Node node = dsource.getNode();
- //
- // if (null != node)
- // return processFromNode(node, baseID);
- // else {
- // String messageStr = XSLMessages.createMessage(
- // XSLTErrorResources.ER_ILLEGAL_DOMSOURCE_INPUT, null);
- //
- // throw new IllegalArgumentException(messageStr);
- // }
- // }
-
- TemplatesHandler builder = newTemplatesHandler();
- builder.setSystemId(baseID);
-
- try {
- InputSource isource = SAXSource.sourceToInputSource(source);
- isource.setSystemId(baseID);
- XMLReader reader = null;
-
- if (source instanceof SAXSource)
- reader = ((SAXSource) source).getXMLReader();
-
- if (null == reader) {
-
- // Use JAXP1.1 ( if possible )
- try {
- javax.xml.parsers.SAXParserFactory factory = javax.xml.parsers.SAXParserFactory
- .newInstance();
-
- factory.setNamespaceAware(true);
-
- if (m_isSecureProcessing) {
- try {
- factory.setFeature(
- XMLConstants.FEATURE_SECURE_PROCESSING,
- true);
- } catch (org.xml.sax.SAXException se) {
- }
- }
-
- javax.xml.parsers.SAXParser jaxpParser = factory
- .newSAXParser();
-
- reader = jaxpParser.getXMLReader();
- } catch (javax.xml.parsers.ParserConfigurationException ex) {
- throw new org.xml.sax.SAXException(ex);
- } catch (javax.xml.parsers.FactoryConfigurationError ex1) {
- throw new org.xml.sax.SAXException(ex1.toString());
- } catch (NoSuchMethodError ex2) {
- } catch (AbstractMethodError ame) {
- }
- }
-
- 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);
- reader.setContentHandler(builder);
- reader.parse(isource);
- } catch (org.xml.sax.SAXException se) {
- if (super.getErrorListener() != null) {
- try {
- super.getErrorListener().fatalError(
- new TransformerException(se));
- } catch (TransformerConfigurationException ex1) {
- throw ex1;
- } catch (TransformerException ex1) {
- throw new TransformerConfigurationException(ex1);
- }
- } else {
- throw new TransformerConfigurationException(se.getMessage(), se);
- }
- } catch (Exception e) {
- if (super.getErrorListener() != null) {
- try {
- super.getErrorListener().fatalError(
- new TransformerException(e));
- return null;
- } catch (TransformerConfigurationException ex1) {
- throw ex1;
- } catch (TransformerException ex1) {
- throw new TransformerConfigurationException(ex1);
- }
- } else {
- throw new TransformerConfigurationException(e.getMessage(), e);
- }
- }
-
- return builder.getTemplates();
- }
-
- /**
- * This class overrides the TransformerFactoryImpl implementation so that a
- * custom Stylesheet handler that doesn't stop processing at the first error
- * can be used to get all of the errors in a stylesheet not just the first
- * one.
- */
- @Override
- public TemplatesHandler newTemplatesHandler()
- throws TransformerConfigurationException {
- // TODO Auto-generated method stub
- return new CustomStylesheetHandler(this);
- }
-
- /**
- * Get a TransformerHandler object that can process SAX ContentHandler
- * events into a Result, based on the transformation instructions specified
- * by the argument.
- *
- * @param src
- * The source of the transformation instructions.
- *
- * @return TransformerHandler ready to transform SAX events.
- *
- * @throws TransformerConfigurationException
- */
- @Override
- public TransformerHandler newTransformerHandler(Source src)
- throws TransformerConfigurationException {
-
- Templates templates = newTemplates(src);
- if (templates == null)
- return null;
-
- return newTransformerHandler(templates);
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/CustomStylesheetHandler.java b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/CustomStylesheetHandler.java
deleted file mode 100644
index 1d3ea7d..0000000
--- a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/CustomStylesheetHandler.java
+++ /dev/null
@@ -1,1629 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Standards for Technology in Automotive Retail
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * David Carver - STAR - initial API and implementation, based on work from
- * the Xalan-J project from Apache.
- *******************************************************************************/
-/*
- * Copyright 1999-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.eclipse.wst.xsl.core.internal.compiler.xslt10.processor;
-
-import java.util.Stack;
-
-import javax.xml.transform.ErrorListener;
-import javax.xml.transform.SourceLocator;
-import javax.xml.transform.Templates;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerException;
-
-import org.eclipse.wst.xsl.core.internal.compiler.xslt10.extensions.ExpressionVisitor;
-import org.apache.xalan.res.XSLMessages;
-import org.apache.xalan.res.XSLTErrorResources;
-import org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates.Constants;
-import org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates.ElemForEach;
-import org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates.ElemTemplateElement;
-import org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates.Stylesheet;
-import org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates.StylesheetRoot;
-import org.apache.xml.utils.BoolStack;
-import org.apache.xml.utils.NamespaceSupport2;
-import org.apache.xml.utils.PrefixResolver;
-import org.apache.xml.utils.SAXSourceLocator;
-import org.apache.xml.utils.XMLCharacterRecognizer;
-import org.apache.xpath.XPath;
-import org.apache.xpath.compiler.FunctionTable;
-import org.w3c.dom.Node;
-import org.xml.sax.Attributes;
-import org.xml.sax.InputSource;
-import org.xml.sax.Locator;
-import org.xml.sax.helpers.NamespaceSupport;
-
-public class CustomStylesheetHandler extends StylesheetHandler {
-
- /**
- * The function table of XPath and XSLT;
- */
- private FunctionTable m_funcTable = new FunctionTable();
-
- /**
- * The flag for the setting of the optimize feature;
- *
- */
- private boolean m_optimize = true;
-
- /**
- * The flag for the setting of the incremental feature;
- */
- private boolean m_incremental = false;
-
- /**
- * The flag for the setting of the source_location feature;
- */
- private boolean m_source_location = false;
-
- /**
- * The XSLT TransformerFactory for needed services.
- */
- private TransformerFactoryImpl m_stylesheetProcessor;
-
- /**
- * The stack of current processors.
- */
- private Stack m_processors = new Stack();
-
- /**
- * 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 the processors store state.
- */
- private XSLTSchema m_schema = super.getSchema();
-
- /**
- * @param processor
- * @throws TransformerConfigurationException
- */
- public CustomStylesheetHandler(TransformerFactoryImpl processor)
- throws TransformerConfigurationException {
- super(processor);
- Class func = org.apache.xalan.templates.FuncDocument.class;
- m_funcTable.installFunction("document", func);
-
- // func = new org.apache.xalan.templates.FuncKey();
- // FunctionTable.installFunction("key", func);
- func = org.apache.xalan.templates.FuncFormatNumb.class;
-
- m_funcTable.installFunction("format-number", func);
-
- // m_schema = new XSLTSchema();
- init_custom(processor);
-
- // TODO Auto-generated constructor stub
- }
-
- /**
- * Do common initialization.
- *
- * @param processor
- * non-null reference to the transformer factory that owns this
- * handler.
- */
- private void init_custom(TransformerFactoryImpl processor) {
- 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);
- }
-
- /**
- * Get the XSLT TransformerFactoryImpl for needed services.
- *
- * @return The TransformerFactoryImpl that owns this handler.
- * @see org.apache.
- */
- @Override
- public TransformerFactoryImpl getStylesheetProcessor() {
- return m_stylesheetProcessor;
- }
-
- /**
- * Process an expression string into an XPath. Must be public for access by
- * the AVT class.
- *
- * @param str
- * A non-null reference to a valid or invalid XPath expression
- * string.
- *
- * @return A non-null reference to an XPath object that represents the
- * string argument.
- *
- * @throws javax.xml.transform.TransformerException
- * if the expression can not be processed.
- * @see <a href="http://www.w3.org/TR/xslt#section-Expressions">Section 4
- * Expressions in XSLT Specification</a>
- *
- * TODO: Remove Me
- */
- public XPath createXPath(String str, ElemTemplateElement owningTemplate)
- throws javax.xml.transform.TransformerException {
- ErrorListener handler = super.getStylesheetProcessor()
- .getErrorListener();
- XPath xpath = new XPath(str, owningTemplate, this, XPath.SELECT,
- handler, m_funcTable);
- // Visit the expression, registering namespaces for any extension
- // functions it includes.
- xpath.callVisitors(xpath, new ExpressionVisitor(getStylesheetRoot()));
- return xpath;
- }
-
- /**
- * Process an expression string into an XPath.
- *
- * @param str
- * A non-null reference to a valid or invalid match pattern
- * string.
- *
- * @return A non-null reference to an XPath object that represents the
- * string argument.
- *
- * @throws javax.xml.transform.TransformerException
- * if the pattern can not be processed.
- * @see <a href="http://www.w3.org/TR/xslt#patterns">Section 5.2 Patterns in
- * XSLT Specification</a>
- */
- protected XPath createMatchPatternXPath(String str,
- ElemTemplateElement owningTemplate)
- throws javax.xml.transform.TransformerException {
- ErrorListener handler = m_stylesheetProcessor.getErrorListener();
- XPath xpath = new XPath(str, owningTemplate, this, XPath.MATCH,
- handler, m_funcTable);
- // Visit the expression, registering namespaces for any extension
- // functions it includes.
- xpath.callVisitors(xpath, new ExpressionVisitor(getStylesheetRoot()));
- return xpath;
- }
-
- /**
- * Given a namespace, get the corrisponding prefix from the current
- * namespace support context.
- *
- * @param prefix
- * The prefix to look up, which may be an empty string ("") for
- * the default Namespace.
- *
- * @return The associated Namespace URI, or null if the prefix is undeclared
- * in this context.
- */
- public String getNamespaceForPrefix(String prefix) {
- return this.getNamespaceSupport().getURI(prefix);
- }
-
- // //////////////////////////////////////////////////////////////////
- // 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 the SAX events
- * have been completed.
- *
- * @return The stylesheet object that was created during the SAX event
- * process, or null if no stylesheet has been created.
- *
- * Author <a href="mailto:scott_boag@lotus.com">Scott Boag</a>
- *
- *
- */
- public Templates getTemplates() {
- return getStylesheetRoot();
- }
-
- /**
- * 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 setSystemId(String baseID) {
- pushBaseIndentifier(baseID);
- }
-
- /**
- * Get the base ID (URI or system ID) from where relative URLs will be
- * resolved.
- *
- * @return The systemID that was set with {@link #setSystemId}.
- */
- public String getSystemId() {
- return this.getBaseIdentifier();
- }
-
- // //////////////////////////////////////////////////////////////////
- // Implementation of the EntityResolver interface.
- // //////////////////////////////////////////////////////////////////
-
- /**
- * Resolve an external entity.
- *
- * @param publicId
- * The public identifer, or null if none is available.
- * @param systemId
- * The system identifier provided in the XML document.
- * @return The new input source, or null to require the default behaviour.
- *
- * @throws org.xml.sax.SAXException
- * if the entity can not be resolved.
- */
- public InputSource resolveEntity(String publicId, String systemId)
- throws org.xml.sax.SAXException {
- return getCurrentProcessor().resolveEntity(this, publicId, systemId);
- }
-
- @Override
- public void notationDecl(String name, String publicId, String systemId) {
- // TODO Auto-generated method stub
- super.notationDecl(name, publicId, systemId);
- }
-
- /**
- * Receive notification of an unparsed entity declaration.
- *
- * @param name
- * The entity name.
- * @param publicId
- * The entity public identifier, or null if not available.
- * @param systemId
- * The entity system identifier.
- * @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) {
- getCurrentProcessor().unparsedEntityDecl(this, name, publicId,
- systemId, notationName);
- }
-
- /**
- * Given a namespace URI, and a local name or a node type, get the processor
- * for the element, or return null if not allowed.
- *
- * @param uri
- * The Namespace URI, or an empty string.
- * @param localName
- * The local name (without prefix), or empty string if not
- * namespace processing.
- * @param rawName
- * The qualified name (with prefix).
- *
- * @return A non-null reference to a element processor.
- *
- * @throws org.xml.sax.SAXException
- * if the element is not allowed in the found position in the
- * stylesheet.
- */
- protected XSLTElementProcessor getProcessorFor(String uri,
- String localName, String rawName) throws org.xml.sax.SAXException {
-
- XSLTElementProcessor currentProcessor = getCurrentProcessor();
- XSLTElementDef def = currentProcessor.getElemDef();
- XSLTElementProcessor elemProcessor = def
- .getProcessorFor(uri, localName);
-
- if (null == elemProcessor
- && !(currentProcessor instanceof ProcessorStylesheetDoc)
- && ((null == getStylesheet() || Double.valueOf(
- getStylesheet().getVersion()).doubleValue() > Constants.XSLTVERSUPPORTED)
- || (!uri.equals(Constants.S_XSLNAMESPACEURL) && currentProcessor instanceof ProcessorStylesheetElement) || getElemVersion() > Constants.XSLTVERSUPPORTED)) {
- elemProcessor = def.getProcessorForUnknown(uri, localName);
- }
-
- if (null == elemProcessor)
- error(XSLMessages.createMessage(
- XSLTErrorResources.ER_NOT_ALLOWED_IN_POSITION,
- new Object[] { rawName }), null);// rawName + " is not
- // allowed in this
- // position in the
- // stylesheet!",
-
- 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 stylesheet being parsed. The stack needs
- * to be popped after the stylesheet has been parsed. We pop 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) {
-
- // System.out.println("pushing locator for: "+locator.getSystemId());
-
- m_stylesheetLocatorStack.push(new SAXSourceLocator(locator));
- }
-
- /**
- * The level of the stylesheet we are at.
- */
- private int m_stylesheetLevel = -1;
-
- /**
- * Receive notification of the beginning of the document.
- *
- * @see org.xml.sax.ContentHandler#startDocument
- *
- * @throws org.xml.sax.SAXException
- * Any SAX exception, possibly wrapping another exception.
- */
- public void startDocument() throws org.xml.sax.SAXException {
- m_stylesheetLevel++;
- pushSpaceHandling(false);
- }
-
- /**
- * m_parsingComplete becomes true when the top-level stylesheet and all its
- * included/imported stylesheets have been been fully parsed, as an
- * indication that composition/optimization/compilation can begin.
- *
- * @see isStylesheetParsingComplete
- */
- private boolean m_parsingComplete = false;
-
- /**
- * Test whether the _last_ endDocument() has been processed. This is needed
- * as guidance for stylesheet optimization and compilation engines, which
- * generally don't want to start until all included and imported stylesheets
- * have been fully parsed.
- *
- * @return true iff the complete stylesheet tree has been built.
- */
- public boolean isStylesheetParsingComplete() {
- return m_parsingComplete;
- }
-
- /**
- * Receive notification of the end of the document.
- *
- * @see org.xml.sax.ContentHandler#endDocument
- *
- * @throws org.xml.sax.SAXException
- * Any SAX exception, possibly wrapping another exception.
- */
- public void endDocument() throws org.xml.sax.SAXException {
-
- try {
- if (null != getStylesheetRoot()) {
- if (0 == m_stylesheetLevel)
- getStylesheetRoot().recompose();
- } else
- throw new TransformerException(XSLMessages.createMessage(
- XSLTErrorResources.ER_NO_STYLESHEETROOT, null)); // "Did
- // not
- // find
- // the
- // stylesheet
- // root!");
-
- XSLTElementProcessor elemProcessor = getCurrentProcessor();
-
- if (null != elemProcessor)
- elemProcessor.startNonText(this);
-
- m_stylesheetLevel--;
-
- popSpaceHandling();
-
- // WARNING: This test works only as long as stylesheets are parsed
- // more or less recursively. If we switch to an iterative
- // "work-list"
- // model, this will become true prematurely. In that case,
- // isStylesheetParsingComplete() will have to be adjusted to be
- // aware
- // of the worklist.
- m_parsingComplete = (m_stylesheetLevel < 0);
- } catch (TransformerException te) {
- throw new org.xml.sax.SAXException(te);
- }
- }
-
- private java.util.Vector m_prefixMappings = new java.util.Vector();
-
- /**
- * Receive notification of the start of a Namespace mapping.
- *
- * <p>
- * By default, do nothing. Application writers may override this method in a
- * subclass to take specific actions at the start of each element (such as
- * allocating a new tree node or writing output to a file).
- * </p>
- *
- * @param prefix
- * The Namespace prefix being declared.
- * @param uri
- * The Namespace URI mapped to the prefix.
- * @see org.xml.sax.ContentHandler#startPrefixMapping
- *
- * @throws org.xml.sax.SAXException
- * Any SAX exception, possibly wrapping another exception.
- */
- public void startPrefixMapping(String prefix, String uri)
- throws org.xml.sax.SAXException {
-
- // m_nsSupport.pushContext();
- // this.getNamespaceSupport().declarePrefix(prefix, uri);
- // m_prefixMappings.add(prefix); // JDK 1.2+ only -sc
- // m_prefixMappings.add(uri); // JDK 1.2+ only -sc
- m_prefixMappings.addElement(prefix); // JDK 1.1.x compat -sc
- m_prefixMappings.addElement(uri); // JDK 1.1.x compat -sc
- }
-
- /**
- * Receive notification of the end of a Namespace mapping.
- *
- * <p>
- * By default, do nothing. Application writers may override this method in a
- * subclass to take specific actions at the start of each element (such as
- * allocating a new tree node or writing output to a file).
- * </p>
- *
- * @param prefix
- * The Namespace prefix being declared.
- * @see org.xml.sax.ContentHandler#endPrefixMapping
- *
- * @throws org.xml.sax.SAXException
- * Any SAX exception, possibly wrapping another exception.
- */
- public void endPrefixMapping(String prefix) throws org.xml.sax.SAXException {
-
- // m_nsSupport.popContext();
- }
-
- /**
- * Flush the characters buffer.
- *
- * @throws org.xml.sax.SAXException
- */
- private void flushCharacters() throws org.xml.sax.SAXException {
-
- XSLTElementProcessor elemProcessor = getCurrentProcessor();
-
- if (null != elemProcessor)
- elemProcessor.startNonText(this);
- }
-
- /**
- * Receive notification of the start of an element.
- *
- * @param uri
- * The Namespace URI, or an empty string.
- * @param localName
- * The local name (without prefix), or empty string if not
- * namespace processing.
- * @param rawName
- * The qualified name (with prefix).
- * @param attributes
- * The specified or defaulted attributes.
- *
- * @throws org.xml.sax.SAXException
- */
- public void startElement(String uri, String localName, String rawName,
- Attributes attributes) throws org.xml.sax.SAXException {
- NamespaceSupport nssupport = this.getNamespaceSupport();
- nssupport.pushContext();
-
- int n = m_prefixMappings.size();
-
- for (int i = 0; i < n; i++) {
- String prefix = (String) m_prefixMappings.elementAt(i++);
- String nsURI = (String) m_prefixMappings.elementAt(i);
- nssupport.declarePrefix(prefix, nsURI);
- }
- // m_prefixMappings.clear(); // JDK 1.2+ only -sc
- m_prefixMappings.removeAllElements(); // JDK 1.1.x compat -sc
-
- m_elementID++;
-
- // This check is currently done for all elements. We should possibly
- // consider
- // limiting this check to xsl:stylesheet elements only since that is all
- // it really
- // applies to. Also, it could be bypassed if m_shouldProcess is already
- // true.
- // In other words, the next two statements could instead look something
- // like this:
- // if (!m_shouldProcess)
- // {
- // if (localName.equals(Constants.ELEMNAME_STYLESHEET_STRING) &&
- // url.equals(Constants.S_XSLNAMESPACEURL))
- // {
- // checkForFragmentID(attributes);
- // if (!m_shouldProcess)
- // return;
- // }
- // else
- // return;
- // }
- // I didn't include this code statement at this time because in practice
- // it is a small performance hit and I was waiting to see if its absence
- // caused a problem. - GLP
-
- checkForFragmentID(attributes);
-
- if (!m_shouldProcess)
- return;
-
- flushCharacters();
-
- pushSpaceHandling(attributes);
-
- XSLTElementProcessor elemProcessor = getProcessorFor(uri, localName,
- rawName);
-
- if (null != elemProcessor) // defensive, for better multiple error
- // reporting. -sb
- {
- this.pushProcessor(elemProcessor);
- elemProcessor.startElement(this, uri, localName, rawName,
- attributes);
- } else {
- m_shouldProcess = false;
- popSpaceHandling();
- }
-
- }
-
- /**
- * Receive notification of the end of an element.
- *
- * @param uri
- * The Namespace URI, or an empty string.
- * @param localName
- * The local name (without prefix), or empty string if not
- * namespace processing.
- * @param rawName
- * The qualified name (with prefix).
- * @see org.xml.sax.ContentHandler#endElement
- *
- * @throws org.xml.sax.SAXException
- * Any SAX exception, possibly wrapping another exception.
- */
- public void endElement(String uri, String localName, String rawName)
- throws org.xml.sax.SAXException {
-
- m_elementID--;
-
- if (!m_shouldProcess)
- return;
-
- if ((m_elementID + 1) == m_fragmentID)
- m_shouldProcess = false;
-
- flushCharacters();
-
- popSpaceHandling();
-
- XSLTElementProcessor p = getCurrentProcessor();
-
- p.endElement(this, uri, localName, rawName);
- this.popProcessor();
- this.getNamespaceSupport().popContext();
- }
-
- /**
- * Receive notification of character data inside an element.
- *
- * @param ch
- * The characters.
- * @param start
- * The start position in the character array.
- * @param length
- * The number of characters to use from the character array.
- * @see org.xml.sax.ContentHandler#characters
- *
- * @throws org.xml.sax.SAXException
- * Any SAX exception, possibly wrapping another exception.
- */
- public void characters(char ch[], int start, int length)
- throws org.xml.sax.SAXException {
-
- if (!m_shouldProcess)
- return;
-
- XSLTElementProcessor elemProcessor = getCurrentProcessor();
- XSLTElementDef def = elemProcessor.getElemDef();
-
- if (def.getType() != XSLTElementDef.T_PCDATA)
- elemProcessor = def.getProcessorFor(null, "text()");
-
- if (null == elemProcessor) {
-
- // If it's whitespace, just ignore it, otherwise flag an error.
- if (!XMLCharacterRecognizer.isWhiteSpace(ch, start, length))
- error(
- XSLMessages
- .createMessage(
- XSLTErrorResources.ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION,
- null), null);// "Non-whitespace text
- // is not allowed in
- // this position in the
- // stylesheet!",
-
- } else
- elemProcessor.characters(this, ch, start, length);
- }
-
- /**
- * Receive notification of ignorable whitespace in element content.
- *
- * @param ch
- * The whitespace characters.
- * @param start
- * The start position in the character array.
- * @param length
- * The number of characters to use from the character array.
- * @see org.xml.sax.ContentHandler#ignorableWhitespace
- *
- * @throws org.xml.sax.SAXException
- * Any SAX exception, possibly wrapping another exception.
- */
- public void ignorableWhitespace(char ch[], int start, int length)
- throws org.xml.sax.SAXException {
-
- if (!m_shouldProcess)
- return;
-
- getCurrentProcessor().ignorableWhitespace(this, ch, start, length);
- }
-
- /**
- * Receive notification of a processing instruction.
- *
- * <p>
- * The Parser will invoke this method once for each processing instruction
- * found: note that processing instructions may occur before or after the
- * main document element.
- * </p>
- *
- * <p>
- * A SAX parser should never report an XML declaration (XML 1.0, section
- * 2.8) or a text declaration (XML 1.0, section 4.3.1) using this method.
- * </p>
- *
- * <p>
- * By default, do nothing. Application writers may override this method in a
- * subclass to take specific actions for each processing instruction, such
- * as setting status variables or invoking other methods.
- * </p>
- *
- * @param target
- * The processing instruction target.
- * @param data
- * The processing instruction data, or null if none is supplied.
- * @see org.xml.sax.ContentHandler#processingInstruction
- *
- * @throws org.xml.sax.SAXException
- * Any SAX exception, possibly wrapping another exception.
- */
- public void processingInstruction(String target, String data)
- throws org.xml.sax.SAXException {
- if (!m_shouldProcess)
- return;
-
- // Recreating Scott's kluge:
- // A xsl:for-each or xsl:apply-templates may have a special
- // PI that tells us not to cache the document. This PI
- // should really be namespaced.
- // String localName = getLocalName(target);
- // String ns = m_stylesheet.getNamespaceFromStack(target);
- //
- // %REVIEW%: We need a better PI architecture
-
- String prefix = "", ns = "", localName = target;
- int colon = target.indexOf(':');
- if (colon >= 0) {
- ns = getNamespaceForPrefix(prefix = target.substring(0, colon));
- localName = target.substring(colon + 1);
- }
-
- try {
- // A xsl:for-each or xsl:apply-templates may have a special
- // PI that tells us not to cache the document. This PI
- // should really be namespaced... but since the XML Namespaces
- // spec never defined namespaces as applying to PI's, and since
- // the testcase we're trying to support is inconsistant in whether
- // it binds the prefix, I'm going to make this sloppy for
- // testing purposes.
- if ("xalan-doc-cache-off".equals(target)
- || "xalan:doc-cache-off".equals(target)
- || ("doc-cache-off".equals(localName) && ns
- .equals("org.apache.xalan.xslt.extensions.Redirect"))) {
- if (!(m_elems.peek() instanceof ElemForEach))
- throw new TransformerException(
- "xalan:doc-cache-off not allowed here!",
- getLocator());
- ElemForEach elem = (ElemForEach) m_elems.peek();
-
- elem.m_doc_cache_off = true;
-
- // System.out.println("JJK***** Recognized <?
- // {"+ns+"}"+prefix+":"+localName+" "+data+"?>");
- }
- } catch (Exception e) {
- // JJK: Officially, unknown PIs can just be ignored.
- // Do we want to issue a warning?
- }
-
- flushCharacters();
- getCurrentProcessor().processingInstruction(this, target, data);
- }
-
- /**
- * Receive notification of a skipped entity.
- *
- * <p>
- * By default, do nothing. Application writers may override this method in a
- * subclass to take specific actions for each processing instruction, such
- * as setting status variables or invoking other methods.
- * </p>
- *
- * @param name
- * The name of the skipped entity.
- * @see org.xml.sax.ContentHandler#processingInstruction
- *
- * @throws org.xml.sax.SAXException
- * Any SAX exception, possibly wrapping another exception.
- */
- public void skippedEntity(String name) throws org.xml.sax.SAXException {
-
- if (!m_shouldProcess)
- return;
-
- getCurrentProcessor().skippedEntity(this, name);
- }
-
- /**
- * Tell the user of an error, and probably throw an exception. This is
- * modified from the super class so that it continues processing and doesn't
- * stop compilation until it reaches the end of the xslt. This could
- * potentially cause lots of errors to be displayed.
- *
- * @param msg
- * An error message.
- * @param e
- * An error which the SAXException should wrap.
- *
- * @throws org.xml.sax.SAXException
- * that wraps a {@link javax.xml.transform.TransformerException}
- * if the current
- * {@link javax.xml.transform.ErrorListener#error} method
- * chooses to flag this condition as an error.
- * @xsl.usage internal
- */
- @Override
- protected void error(String msg, Exception e)
- throws org.xml.sax.SAXException {
-
- SAXSourceLocator locator = getLocator();
- ErrorListener handler = super.getStylesheetProcessor()
- .getErrorListener();
-
- TransformerException pe;
-
- if (!(e instanceof TransformerException)) {
- pe = (null == e) ? new TransformerException(msg, locator)
- : new TransformerException(msg, locator, e);
- } else
- pe = (TransformerException) e;
-
- if (null != handler) {
- try {
- handler.error(pe);
- } catch (TransformerException te) {
- // We want to continue processing so we don't necessarily want
- // to throw the exception
- // but we do want to inform the error listener
- // throw new org.xml.sax.SAXException(te);
- }
- } else
- // Here we want to throw the exception since we don't have an error
- // listener so it needs to be handle through regular exception
- // handling.
- throw new org.xml.sax.SAXException(pe);
- }
-
- /**
- * Tell the user of an error, and probably throw an exception.
- *
- * @param msg
- * A key into the {@link org.apache.xalan.res.XSLTErrorResources}
- * table, that is one of the WG_ prefixed definitions.
- * @param args
- * An array of arguments for the given warning.
- * @param e
- * An error which the SAXException should wrap.
- *
- * @throws org.xml.sax.SAXException
- * that wraps a {@link javax.xml.transform.TransformerException}
- * if the current
- * {@link javax.xml.transform.ErrorListener#error} method
- * chooses to flag this condition as an error.
- * @xsl.usage internal
- */
- protected void error(String msg, Object args[], Exception e)
- throws org.xml.sax.SAXException {
-
- String formattedMsg = XSLMessages.createMessage(msg, args);
-
- error(formattedMsg, e);
- }
-
- /**
- * Receive notification of a XSLT processing warning.
- *
- * @param e
- * The warning information encoded as an exception.
- *
- * @throws org.xml.sax.SAXException
- * that wraps a {@link javax.xml.transform.TransformerException}
- * if the current
- * {@link javax.xml.transform.ErrorListener#warning} method
- * chooses to flag this condition as an error.
- */
- public void warning(org.xml.sax.SAXParseException e)
- throws org.xml.sax.SAXException {
-
- String formattedMsg = e.getMessage();
- SAXSourceLocator locator = getLocator();
- ErrorListener handler = super.getStylesheetProcessor()
- .getErrorListener();
-
- try {
- handler.warning(new TransformerException(formattedMsg, locator));
- } catch (TransformerException te) {
- // throw new org.xml.sax.SAXException(te);
- }
- }
-
- /**
- * Warn the user of an problem.
- *
- * @param msg
- * An key into the
- * {@link org.apache.xalan.res.XSLTErrorResources} table, that is
- * one of the WG_ prefixed definitions.
- * @param args
- * An array of arguments for the given warning.
- *
- * @throws org.xml.sax.SAXException
- * that wraps a {@link javax.xml.transform.TransformerException}
- * if the current
- * {@link javax.xml.transform.ErrorListener#warning} method
- * chooses to flag this condition as an error.
- * @xsl.usage internal
- */
- public void warn(String msg, Object args[]) throws org.xml.sax.SAXException {
-
- String formattedMsg = XSLMessages.createWarning(msg, args);
- SAXSourceLocator locator = getLocator();
- ErrorListener handler = m_stylesheetProcessor.getErrorListener();
-
- try {
- if (null != handler)
- handler
- .warning(new TransformerException(formattedMsg, locator));
- } catch (TransformerException te) {
- throw new org.xml.sax.SAXException(te);
- }
- }
-
- /**
- * Assert that a condition is true. If it is not true, throw an error.
- *
- * @param condition
- * false if an error should not be thrown, otherwise true.
- * @param msg
- * Error message to be passed to the RuntimeException as an
- * argument.
- * @throws RuntimeException
- * if the condition is not true.
- * @xsl.usage internal
- */
- private void assertion(boolean condition, String msg)
- throws RuntimeException {
- if (!condition)
- throw new RuntimeException(msg);
- }
-
- /**
- * Receive notification of a recoverable XSLT processing error.
- *
- * @param e
- * The error information encoded as an exception.
- *
- * @throws org.xml.sax.SAXException
- * that wraps a {@link javax.xml.transform.TransformerException}
- * if the current
- * {@link javax.xml.transform.ErrorListener#error} method
- * chooses to flag this condition as an error.
- */
- public void error(org.xml.sax.SAXParseException e)
- throws org.xml.sax.SAXException {
-
- String formattedMsg = e.getMessage();
- SAXSourceLocator locator = getLocator();
- ErrorListener handler = super.getStylesheetProcessor()
- .getErrorListener();
-
- try {
- handler.error(new TransformerException(formattedMsg, locator));
- } catch (TransformerException te) {
- // throw new org.xml.sax.SAXException(te);
- }
- }
-
- /**
- * Report a fatal XSLT processing error.
- *
- * @param e
- * The error information encoded as an exception.
- *
- * @throws org.xml.sax.SAXException
- * that wraps a {@link javax.xml.transform.TransformerException}
- * if the current
- * {@link javax.xml.transform.ErrorListener#fatalError} method
- * chooses to flag this condition as an error.
- */
- public void fatalError(org.xml.sax.SAXParseException e)
- throws org.xml.sax.SAXException {
-
- String formattedMsg = e.getMessage();
- SAXSourceLocator locator = getLocator();
- ErrorListener handler = super.getStylesheetProcessor()
- .getErrorListener();
-
- try {
- handler.fatalError(new TransformerException(formattedMsg, locator));
- } catch (TransformerException te) {
- // throw new org.xml.sax.SAXException(te);
- }
- }
-
- /**
- * 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 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 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 from
- * startElement.
- *
- * @param attributes
- * The specified or defaulted attributes.
- */
- private void checkForFragmentID(Attributes attributes) {
-
- if (!m_shouldProcess) {
- if ((null != attributes) && (null != m_fragmentIDString)) {
- int n = attributes.getLength();
-
- for (int i = 0; i < n; i++) {
- String name = attributes.getQName(i);
-
- if (name.equals(Constants.ATTRNAME_ID)) {
- String val = attributes.getValue(i);
-
- if (val.equalsIgnoreCase(m_fragmentIDString)) {
- m_shouldProcess = true;
- m_fragmentID = m_elementID;
- }
- }
- }
- }
- }
- }
-
- /**
- * If getStylesheetType returns this value, the current stylesheet is a root
- * stylesheet.
- *
- * @xsl.usage internal
- */
- public static final int STYPE_ROOT = 1;
-
- /**
- * If getStylesheetType returns this value, the current stylesheet is an
- * included stylesheet.
- *
- * @xsl.usage internal
- */
- public static final int STYPE_INCLUDE = 2;
-
- /**
- * If getStylesheetType returns this value, the current stylesheet is an
- * imported stylesheet.
- *
- * @xsl.usage internal
- */
- public static final int STYPE_IMPORT = 3;
-
- /** The current stylesheet type. */
- private int m_stylesheetType = STYPE_ROOT;
-
- /**
- * Get the type of stylesheet that should be built or is being processed.
- *
- * @return one of STYPE_ROOT, STYPE_INCLUDE, or STYPE_IMPORT.
- */
- protected int getStylesheetType() {
- return m_stylesheetType;
- }
-
- /**
- * Set the type of stylesheet that should be built or is being processed.
- *
- * @param type
- * Must be one of STYPE_ROOT, STYPE_INCLUDE, or STYPE_IMPORT.
- */
- protected void setStylesheetType(int type) {
- m_stylesheetType = type;
- }
-
- /**
- * The stack of stylesheets being processed.
- */
- private Stack m_stylesheets = new Stack();
-
- /**
- * Return the stylesheet that this handler is constructing.
- *
- * @return The current stylesheet that is on top of the stylesheets stack,
- * or null if no stylesheet is on the stylesheets stack.
- */
- protected Stylesheet getStylesheet() {
- return (m_stylesheets.size() == 0) ? null : (Stylesheet) m_stylesheets
- .peek();
- }
-
- /**
- * Return the last stylesheet that was popped off the stylesheets stack.
- *
- * @return The last popped stylesheet, or null.
- */
- protected Stylesheet getLastPoppedStylesheet() {
- return m_lastPoppedStylesheet;
- }
-
- /**
- * Return the stylesheet root that this handler is constructing.
- *
- * @return The root stylesheet of the stylesheets tree.
- */
- public StylesheetRoot getStylesheetRoot() {
- if (m_stylesheetRoot != null) {
- m_stylesheetRoot.setOptimizer(m_optimize);
- m_stylesheetRoot.setIncremental(m_incremental);
- m_stylesheetRoot.setSource_location(m_source_location);
- }
- return m_stylesheetRoot;
- }
-
- /** The root stylesheet of the stylesheets tree. */
- protected StylesheetRoot m_stylesheetRoot;
-
- /** The last stylesheet that was popped off the stylesheets stack. */
- protected Stylesheet m_lastPoppedStylesheet;
-
- /**
- * Push the current stylesheet being constructed. If no other stylesheets
- * have been pushed onto the stack, assume the argument is a stylesheet
- * root, and also set the stylesheet root member.
- *
- * @param s
- * non-null reference to a stylesheet.
- */
- public void pushStylesheet(Stylesheet s) {
-
- if (m_stylesheets.size() == 0)
- m_stylesheetRoot = (StylesheetRoot) s;
-
- m_stylesheets.push(s);
- }
-
- /**
- * Pop the last stylesheet pushed, and return the stylesheet that this
- * handler is constructing, and set the last popped stylesheet member. Also
- * pop the stylesheet locator stack.
- *
- * @return The stylesheet popped off the stack, or the last popped
- * stylesheet.
- */
- protected Stylesheet popStylesheet() {
-
- // The stylesheetLocatorStack needs to be popped because
- // a locator was pushed in for this stylesheet by the SAXparser by
- // calling
- // setDocumentLocator().
- if (!m_stylesheetLocatorStack.isEmpty())
- m_stylesheetLocatorStack.pop();
-
- if (!m_stylesheets.isEmpty())
- m_lastPoppedStylesheet = (Stylesheet) m_stylesheets.pop();
-
- // Shouldn't this be null if stylesheets is empty? -sb
- return m_lastPoppedStylesheet;
- }
-
- /**
- * Get the current XSLTElementProcessor at the top of the stack.
- *
- * @return Valid XSLTElementProcessor, which should never be null.
- */
- protected XSLTElementProcessor getCurrentProcessor() {
- return (XSLTElementProcessor) m_processors.peek();
- }
-
- /**
- * Push the current XSLTElementProcessor onto the top of the stack.
- *
- * @param processor
- * non-null reference to the current element processor.
- */
- protected void pushProcessor(XSLTElementProcessor processor) {
- m_processors.push(processor);
- }
-
- /**
- * Pop the current XSLTElementProcessor from the top of the stack.
- *
- * @return the XSLTElementProcessor which was popped.
- */
- protected XSLTElementProcessor popProcessor() {
- return (XSLTElementProcessor) m_processors.pop();
- }
-
- /**
- * 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.
- *
- * @param hrefUrl
- * non-null reference to the URL for the current imported
- * stylesheet.
- */
- protected void pushImportURL(String hrefUrl) {
- m_importStack.push(hrefUrl);
- }
-
- /**
- * See if the imported stylesheet stack already contains the given URL. Used
- * to test for recursive imports.
- *
- * @param hrefUrl
- * non-null reference to a URL string.
- *
- * @return true if the URL is on the import stack.
- */
- protected boolean importStackContains(String hrefUrl) {
- return stackContains(m_importStack, hrefUrl);
- }
-
- /**
- * Pop an import href from the stylesheet stack.
- *
- * @return non-null reference to the import URL that was popped.
- */
- protected String popImportURL() {
- 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;
-
- /** Stack of NamespaceSupport objects. */
- protected Stack m_nsSupportStack = new Stack();
-
- /**
- * Push a new NamespaceSupport instance.
- */
- protected void pushNewNamespaceSupport() {
- m_nsSupportStack.push(new NamespaceSupport2());
- }
-
- /**
- * Pop the current NamespaceSupport object.
- *
- */
- protected void popNamespaceSupport() {
- m_nsSupportStack.pop();
- }
-
- /**
- * Get the current NamespaceSupport object.
- *
- * @return a non-null reference to the current NamespaceSupport object,
- * which is the top of the namespace support stack.
- */
- protected NamespaceSupport getNamespaceSupport() {
- return (NamespaceSupport) m_nsSupportStack.peek();
- }
-
- /**
- * The originating node if the current stylesheet is being created from a
- * DOM.
- *
- * @see org.apache.xml.utils.NodeConsumer
- */
- private Node m_originatingNode;
-
- /**
- * Set the node that is originating the SAX event.
- *
- * @param n
- * Reference to node that originated the current event.
- * @see org.apache.xml.utils.NodeConsumer
- */
- public void setOriginatingNode(Node n) {
- m_originatingNode = n;
- }
-
- /**
- * Set the node that is originating the SAX event.
- *
- * @return Reference to node that originated the current event.
- * @see org.apache.xml.utils.NodeConsumer
- */
- public Node getOriginatingNode() {
- return m_originatingNode;
- }
-
- /**
- * Stack of booleans that are pushed and popped in start/endElement
- * depending on the value of xml:space=default/preserve.
- */
- private BoolStack m_spacePreserveStack = new BoolStack();
-
- /**
- * Return boolean value from the spacePreserve stack depending on the value
- * of xml:space=default/preserve.
- *
- * @return true if space should be preserved, false otherwise.
- */
- public boolean isSpacePreserve() {
- return m_spacePreserveStack.peek();
- }
-
-
- /**
- * Pop boolean value from the spacePreserve stack.
- */
- protected void popSpaceHandling() {
- m_spacePreserveStack.pop();
- }
-
- /**
- * Push boolean value on to the spacePreserve stack.
- *
- * @param b
- * true if space should be preserved, false otherwise.
- */
- protected void pushSpaceHandling(boolean b) throws org.xml.sax.SAXParseException {
- m_spacePreserveStack.push(b);
- }
-
- /**
- * Push boolean value on to the spacePreserve stack depending on the value
- * of xml:space=default/preserve.
- *
- * @param attrs
- * list of attributes that were passed to startElement.
- */
- protected void pushSpaceHandling(Attributes attrs)
- throws org.xml.sax.SAXParseException {
- String value = attrs.getValue("xml:space");
- if (null == value) {
- m_spacePreserveStack.push(m_spacePreserveStack.peekOrFalse());
- } else if (value.equals("preserve")) {
- m_spacePreserveStack.push(true);
- } else if (value.equals("default")) {
- m_spacePreserveStack.push(false);
- } else {
- SAXSourceLocator locator = getLocator();
- ErrorListener handler = m_stylesheetProcessor.getErrorListener();
-
- try {
- handler.error(new TransformerException(XSLMessages
- .createMessage(
- XSLTErrorResources.ER_ILLEGAL_XMLSPACE_VALUE,
- null), locator)); // "Illegal
- // value
- // for
- // xml:space",
- // locator));
- } catch (TransformerException te) {
- // throw new org.xml.sax.SAXParseException(te.getMessage(),
- // locator, te);
- }
- m_spacePreserveStack.push(m_spacePreserveStack.peek());
- }
- }
-
- private double getElemVersion() {
- ElemTemplateElement elem = getElemTemplateElement();
- double version = -1;
- while ((version == -1 || version == Constants.XSLTVERSUPPORTED)
- && elem != null) {
- try {
- version = Double.valueOf(elem.getXmlVersion()).doubleValue();
- } catch (Exception ex) {
- version = -1;
- }
- elem = elem.getParentElem();
- }
- return (version == -1) ? Constants.XSLTVERSUPPORTED : version;
- }
-
- /**
- * @see PrefixResolver#handlesNullPrefixes()
- */
- public boolean handlesNullPrefixes() {
- return false;
- }
-
- /**
- * @return Optimization flag
- */
- public boolean getOptimize() {
- return m_optimize;
- }
-
- /**
- * @return Incremental flag
- */
- public boolean getIncremental() {
- return m_incremental;
- }
-
- /**
- * @return Source Location flag
- */
- public boolean getSource_location() {
- return m_source_location;
- }
-
- /**
- * Utility function to see if the stack contains the given URL.
- *
- * @param stack
- * non-null reference to a Stack.
- * @param url
- * URL string on which an equality test will be performed.
- *
- * @return true if the stack contains the url argument.
- */
- private boolean stackContains(Stack stack, String url) {
-
- int n = stack.size();
- boolean contains = false;
-
- for (int i = 0; i < n; i++) {
- String url2 = (String) stack.elementAt(i);
-
- if (url2.equals(url)) {
- contains = true;
-
- break;
- }
- }
-
- return contains;
- }
-
- /**
- * 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.
- */
- protected ElemTemplateElement getElemTemplateElement() {
-
- try {
- return (ElemTemplateElement) m_elems.peek();
- } catch (java.util.EmptyStackException ese) {
- return null;
- }
- }
-
- /**
- * An increasing number that is used to indicate the order in which this
- * element was encountered during the parse of the XSLT tree.
- */
- private int m_docOrderCount = 0;
-
- /**
- * Returns the next m_docOrderCount number and increments the number for
- * future use.
- */
- protected int nextUid() {
- return m_docOrderCount++;
- }
-
- /**
- * Push the current XSLTElementProcessor to the top of the stack. As a
- * side-effect, set the document order index (simply because this is a
- * convenient place to set it).
- *
- * @param elem
- * Should be a non-null reference to the intended current
- * template element.
- */
- protected void pushElemTemplateElement(ElemTemplateElement elem) {
-
- if (elem.getUid() == -1)
- elem.setUid(nextUid());
-
- m_elems.push(elem);
- }
-
- /**
- * Get the current XSLTElementProcessor from the top of the stack.
- *
- * @return the ElemTemplateElement which was popped.
- */
- protected ElemTemplateElement popElemTemplateElement() {
- return (ElemTemplateElement) m_elems.pop();
- }
-
- /**
- * This will act as a stack to keep track of the current include base.
- */
- protected Stack m_baseIdentifiers = new Stack();
-
- /**
- * Push a base identifier onto the base URI stack.
- *
- * @param baseID
- * The current base identifier for this position in the
- * stylesheet, which may be a fragment identifier, or which may
- * be null.
- * @see <a href="http://www.w3.org/TR/xslt#base-uri"> Section 3.2 Base URI
- * of XSLT specification.</a>
- */
- protected void pushBaseIndentifier(String baseID) {
-
- if (null != baseID) {
- int posOfHash = baseID.indexOf('#');
-
- if (posOfHash > -1) {
- m_fragmentIDString = baseID.substring(posOfHash + 1);
- m_shouldProcess = false;
- } else
- m_shouldProcess = true;
- } else
- m_shouldProcess = true;
-
- m_baseIdentifiers.push(baseID);
- }
-
- /**
- * Pop a base URI from the stack.
- *
- * @return baseIdentifier.
- */
- protected String popBaseIndentifier() {
- return (String) m_baseIdentifiers.pop();
- }
-
- /**
- * Return the base identifier.
- *
- * @return The base identifier of the current stylesheet.
- */
- public String getBaseIdentifier() {
-
- // Try to get the baseIdentifier from the baseIdentifier's stack,
- // which may not be the same thing as the value found in the
- // SourceLocators stack.
- String base = (String) (m_baseIdentifiers.isEmpty() ? null
- : m_baseIdentifiers.peek());
-
- // Otherwise try the stylesheet.
- if (null == base) {
- SourceLocator locator = getLocator();
-
- base = (null == locator) ? "" : locator.getSystemId();
- }
-
- return base;
- }
-
- /**
- * 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.
- *
- * @return non-null reference to the current locator object.
- */
- public SAXSourceLocator getLocator() {
-
- if (m_stylesheetLocatorStack.isEmpty()) {
- SAXSourceLocator locator = new SAXSourceLocator();
-
- locator.setSystemId(this.getStylesheetProcessor().getDOMsystemID());
-
- return locator;
-
- // m_stylesheetLocatorStack.push(locator);
- }
-
- return ((SAXSourceLocator) m_stylesheetLocatorStack.peek());
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/ProcessorLRE.java b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/ProcessorLRE.java
index 48ce6b9..021f7ee 100644
--- a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/ProcessorLRE.java
+++ b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/ProcessorLRE.java
@@ -26,7 +26,7 @@
* limitations under the License.
*/
/*
- * $Id: ProcessorLRE.java,v 1.1 2008/03/27 01:08:55 dacarver Exp $
+ * $Id: ProcessorLRE.java,v 1.2 2008/03/27 05:14:51 dacarver Exp $
*/
package org.eclipse.wst.xsl.core.internal.compiler.xslt10.processor;
@@ -46,7 +46,7 @@
import org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates.StylesheetRoot;
import org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates.XMLNSDecl;
import org.apache.xml.utils.SAXSourceLocator;
-import org.apache.xpath.XPath;
+import org.eclipse.wst.xsl.core.internal.compiler.xslt10.xpath.XPath;
import org.xml.sax.Attributes;
import org.xml.sax.Locator;
diff --git a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/ProcessorPreserveSpace.java b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/ProcessorPreserveSpace.java
index 702bf8f..706f69e 100644
--- a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/ProcessorPreserveSpace.java
+++ b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/ProcessorPreserveSpace.java
@@ -26,7 +26,7 @@
* limitations under the License.
*/
/*
- * $Id: ProcessorPreserveSpace.java,v 1.1 2008/03/27 01:08:55 dacarver Exp $
+ * $Id: ProcessorPreserveSpace.java,v 1.2 2008/03/27 05:14:52 dacarver Exp $
*/
package org.eclipse.wst.xsl.core.internal.compiler.xslt10.processor;
@@ -34,7 +34,7 @@
import org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates.Stylesheet;
import org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates.WhiteSpaceInfo;
-import org.apache.xpath.XPath;
+import org.eclipse.wst.xsl.core.internal.compiler.xslt10.xpath.XPath;
import org.xml.sax.Attributes;
diff --git a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/ProcessorStripSpace.java b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/ProcessorStripSpace.java
index b4a5171..95fb6af 100644
--- a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/ProcessorStripSpace.java
+++ b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/ProcessorStripSpace.java
@@ -26,7 +26,7 @@
* limitations under the License.
*/
/*
- * $Id: ProcessorStripSpace.java,v 1.1 2008/03/27 01:08:55 dacarver Exp $
+ * $Id: ProcessorStripSpace.java,v 1.2 2008/03/27 05:14:52 dacarver Exp $
*/
package org.eclipse.wst.xsl.core.internal.compiler.xslt10.processor;
@@ -34,7 +34,7 @@
import org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates.Stylesheet;
import org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates.WhiteSpaceInfo;
-import org.apache.xpath.XPath;
+import org.eclipse.wst.xsl.core.internal.compiler.xslt10.xpath.XPath;
import org.xml.sax.Attributes;
diff --git a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/StylesheetHandler.java b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/StylesheetHandler.java
index 1f133c7..358ba0d 100644
--- a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/StylesheetHandler.java
+++ b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/StylesheetHandler.java
@@ -26,7 +26,7 @@
* limitations under the License.
*/
/*
- * $Id: StylesheetHandler.java,v 1.1 2008/03/27 01:08:55 dacarver Exp $
+ * $Id: StylesheetHandler.java,v 1.2 2008/03/27 05:14:52 dacarver Exp $
*/
package org.eclipse.wst.xsl.core.internal.compiler.xslt10.processor;
@@ -53,7 +53,7 @@
import org.apache.xml.utils.PrefixResolver;
import org.apache.xml.utils.SAXSourceLocator;
import org.apache.xml.utils.XMLCharacterRecognizer;
-import org.apache.xpath.XPath;
+import org.eclipse.wst.xsl.core.internal.compiler.xslt10.xpath.XPath;
import org.apache.xpath.compiler.FunctionTable;
import org.apache.xpath.functions.Function;
@@ -371,7 +371,7 @@
* @throws org.xml.sax.SAXException if the element is not allowed in the
* found position in the stylesheet.
*/
- protected XSLTElementProcessor getProcessorFor(
+ public XSLTElementProcessor getProcessorFor(
String uri, String localName, String rawName)
throws org.xml.sax.SAXException
{
@@ -558,7 +558,7 @@
*
* @throws org.xml.sax.SAXException
*/
- private void flushCharacters() throws org.xml.sax.SAXException
+ public void flushCharacters() throws org.xml.sax.SAXException
{
XSLTElementProcessor elemProcessor = getCurrentProcessor();
@@ -775,7 +775,7 @@
//
// %REVIEW%: We need a better PI architecture
- String prefix="",ns="", localName=target;
+ String prefix="",ns="", localName=target; //$NON-NLS-1$//$NON-NLS-2$
int colon=target.indexOf(':');
if(colon>=0)
{
@@ -793,15 +793,15 @@
// it binds the prefix, I'm going to make this sloppy for
// testing purposes.
if(
- "xalan-doc-cache-off".equals(target) ||
- "xalan:doc-cache-off".equals(target) ||
- ("doc-cache-off".equals(localName) &&
- ns.equals("org.apache.xalan.xslt.extensions.Redirect") )
+ "xalan-doc-cache-off".equals(target) || //$NON-NLS-1$
+ "xalan:doc-cache-off".equals(target) || //$NON-NLS-1$
+ ("doc-cache-off".equals(localName) && //$NON-NLS-1$
+ ns.equals("org.apache.xalan.xslt.extensions.Redirect") ) //$NON-NLS-1$
)
{
if(!(m_elems.peek() instanceof ElemForEach))
throw new TransformerException
- ("xalan:doc-cache-off not allowed here!",
+ ("xalan:doc-cache-off not allowed here!", //$NON-NLS-1$
getLocator());
ElemForEach elem = (ElemForEach)m_elems.peek();
@@ -884,7 +884,7 @@
* @throws RuntimeException if the condition is not true.
* @xsl.usage internal
*/
- private void assertion(boolean condition, String msg) throws RuntimeException
+ public void assertion(boolean condition, String msg) throws RuntimeException
{
if (!condition)
throw new RuntimeException(msg);
@@ -903,7 +903,7 @@
* method chooses to flag this condition as an error.
* @xsl.usage internal
*/
- protected void error(String msg, Exception e)
+ public void error(String msg, Exception e)
throws org.xml.sax.SAXException
{
@@ -1319,7 +1319,7 @@
* Get the current ElemTemplateElement at the top of the stack.
* @return Valid ElemTemplateElement, which may be null.
*/
- protected ElemTemplateElement getElemTemplateElement()
+ public ElemTemplateElement getElemTemplateElement()
{
try
@@ -1340,7 +1340,7 @@
/**
* Returns the next m_docOrderCount number and increments the number for future use.
*/
- protected int nextUid()
+ public int nextUid()
{
return m_docOrderCount++;
}
@@ -1353,7 +1353,7 @@
* @param elem Should be a non-null reference to the intended current
* template element.
*/
- protected void pushElemTemplateElement(ElemTemplateElement elem)
+ public void pushElemTemplateElement(ElemTemplateElement elem)
{
if (elem.getUid() == -1)
@@ -1366,7 +1366,7 @@
* Get the current XSLTElementProcessor from the top of the stack.
* @return the ElemTemplateElement which was popped.
*/
- protected ElemTemplateElement popElemTemplateElement()
+ public ElemTemplateElement popElemTemplateElement()
{
return (ElemTemplateElement) m_elems.pop();
}
@@ -1385,7 +1385,7 @@
* @see <a href="http://www.w3.org/TR/xslt#base-uri">
* Section 3.2 Base URI of XSLT specification.</a>
*/
- protected void pushBaseIndentifier(String baseID)
+ public void pushBaseIndentifier(String baseID)
{
if (null != baseID)
@@ -1410,7 +1410,7 @@
* Pop a base URI from the stack.
* @return baseIdentifier.
*/
- protected String popBaseIndentifier()
+ public String popBaseIndentifier()
{
return (String) m_baseIdentifiers.pop();
}
@@ -1480,7 +1480,7 @@
* @param hrefUrl non-null reference to the URL for the current imported
* stylesheet.
*/
- protected void pushImportURL(String hrefUrl)
+ public void pushImportURL(String hrefUrl)
{
m_importStack.push(hrefUrl);
}
@@ -1493,7 +1493,7 @@
*
* @return true if the URL is on the import stack.
*/
- protected boolean importStackContains(String hrefUrl)
+ public boolean importStackContains(String hrefUrl)
{
return stackContains(m_importStack, hrefUrl);
}
@@ -1503,7 +1503,7 @@
*
* @return non-null reference to the import URL that was popped.
*/
- protected String popImportURL()
+ public String popImportURL()
{
return (String) m_importStack.pop();
}
@@ -1515,12 +1515,12 @@
private boolean warnedAboutOldXSLTNamespace = false;
/** Stack of NamespaceSupport objects. */
- Stack m_nsSupportStack = new Stack();
+ private Stack m_nsSupportStack = new Stack();
/**
* Push a new NamespaceSupport instance.
*/
- protected void pushNewNamespaceSupport()
+ public void pushNewNamespaceSupport()
{
m_nsSupportStack.push(new NamespaceSupport2());
}
@@ -1529,7 +1529,7 @@
* Pop the current NamespaceSupport object.
*
*/
- protected void popNamespaceSupport()
+ public void popNamespaceSupport()
{
m_nsSupportStack.pop();
}
@@ -1540,7 +1540,7 @@
* @return a non-null reference to the current NamespaceSupport object,
* which is the top of the namespace support stack.
*/
- protected NamespaceSupport getNamespaceSupport()
+ public NamespaceSupport getNamespaceSupport()
{
return (NamespaceSupport) m_nsSupportStack.peek();
}
@@ -1594,7 +1594,7 @@
/**
* Pop boolean value from the spacePreserve stack.
*/
- protected void popSpaceHandling()
+ public void popSpaceHandling()
{
m_spacePreserveStack.pop();
}
@@ -1604,7 +1604,7 @@
*
* @param b true if space should be preserved, false otherwise.
*/
- protected void pushSpaceHandling(boolean b)
+ public void pushSpaceHandling(boolean b)
throws org.xml.sax.SAXParseException
{
m_spacePreserveStack.push(b);
@@ -1616,7 +1616,7 @@
*
* @param attrs list of attributes that were passed to startElement.
*/
- protected void pushSpaceHandling(Attributes attrs)
+ public void pushSpaceHandling(Attributes attrs)
throws org.xml.sax.SAXParseException
{
String value = attrs.getValue("xml:space");
@@ -1649,7 +1649,7 @@
}
}
- private double getElemVersion()
+ public double getElemVersion()
{
ElemTemplateElement elem = getElemTemplateElement();
double version = -1;
diff --git a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/TransformerFactoryImpl.java b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/TransformerFactoryImpl.java
index e07973f..7990afb 100644
--- a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/TransformerFactoryImpl.java
+++ b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/TransformerFactoryImpl.java
@@ -26,7 +26,7 @@
* limitations under the License.
*/
/*
- * $Id: TransformerFactoryImpl.java,v 1.1 2008/03/27 01:08:55 dacarver Exp $
+ * $Id: TransformerFactoryImpl.java,v 1.2 2008/03/27 05:14:52 dacarver Exp $
*/
package org.eclipse.wst.xsl.core.internal.compiler.xslt10.processor;
@@ -88,7 +88,7 @@
* <code>org.apache.xpath.functions.FuncSystemProperty.XSLT_PROPERTIES</code>
*/
public static final String XSLT_PROPERTIES =
- "org/apache/xalan/res/XSLTInfo.properties";
+ "org/apache/xalan/res/XSLTInfo.properties"; //$NON-NLS-1$
/**
* <p>State of secure processing feature.</p>
@@ -105,17 +105,22 @@
/** Static string to be used for incremental feature */
public static final String FEATURE_INCREMENTAL =
- "http://xml.apache.org/xalan/features/incremental";
+ "http://xml.apache.org/xalan/features/incremental"; //$NON-NLS-1$
/** Static string to be used for optimize feature */
public static final String FEATURE_OPTIMIZE =
- "http://xml.apache.org/xalan/features/optimize";
+ "http://xml.apache.org/xalan/features/optimize"; //$NON-NLS-1$
/** Static string to be used for source_location feature */
public static final String FEATURE_SOURCE_LOCATION =
XalanProperties.SOURCE_LOCATION;
- public javax.xml.transform.Templates processFromNode(Node node)
+ /**
+ * @param node
+ * @return
+ * @throws TransformerConfigurationException
+ */
+public javax.xml.transform.Templates processFromNode(Node node)
throws TransformerConfigurationException
{
@@ -960,6 +965,7 @@
try
{
m_errorListener.fatalError(new TransformerException(e));
+ e.printStackTrace();
return null;
}
catch (TransformerConfigurationException ex1)
diff --git a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/XSLTAttributeDef.java b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/XSLTAttributeDef.java
index 0755599..8307c78 100644
--- a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/XSLTAttributeDef.java
+++ b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/XSLTAttributeDef.java
@@ -26,7 +26,7 @@
* limitations under the License.
*/
/*
- * $Id: XSLTAttributeDef.java,v 1.1 2008/03/27 01:08:55 dacarver Exp $
+ * $Id: XSLTAttributeDef.java,v 1.2 2008/03/27 05:14:52 dacarver Exp $
*/
package org.eclipse.wst.xsl.core.internal.compiler.xslt10.processor;
@@ -46,7 +46,7 @@
import org.apache.xml.utils.StringToIntTable;
import org.apache.xml.utils.StringVector;
import org.apache.xml.utils.XML11Char;
-import org.apache.xpath.XPath;
+import org.eclipse.wst.xsl.core.internal.compiler.xslt10.xpath.XPath;
/**
diff --git a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/XSLTSchema.java b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/XSLTSchema.java
index 60877ad..5748a5c 100644
--- a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/XSLTSchema.java
+++ b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/XSLTSchema.java
@@ -26,44 +26,44 @@
* limitations under the License.
*/
/*
- * $Id: XSLTSchema.java,v 1.1 2008/03/27 01:08:55 dacarver Exp $
+ * $Id: XSLTSchema.java,v 1.2 2008/03/27 05:14:52 dacarver Exp $
*/
package org.eclipse.wst.xsl.core.internal.compiler.xslt10.processor;
import java.util.Hashtable;
-import org.apache.xalan.templates.Constants;
-import org.apache.xalan.templates.ElemApplyImport;
-import org.apache.xalan.templates.ElemApplyTemplates;
-import org.apache.xalan.templates.ElemAttribute;
-import org.apache.xalan.templates.ElemCallTemplate;
-import org.apache.xalan.templates.ElemChoose;
-import org.apache.xalan.templates.ElemComment;
-import org.apache.xalan.templates.ElemCopy;
-import org.apache.xalan.templates.ElemCopyOf;
-import org.apache.xalan.templates.ElemElement;
-import org.apache.xalan.templates.ElemExsltFuncResult;
-import org.apache.xalan.templates.ElemExsltFunction;
-import org.apache.xalan.templates.ElemExtensionDecl;
-import org.apache.xalan.templates.ElemExtensionScript;
-import org.apache.xalan.templates.ElemFallback;
-import org.apache.xalan.templates.ElemForEach;
-import org.apache.xalan.templates.ElemIf;
-import org.apache.xalan.templates.ElemLiteralResult;
-import org.apache.xalan.templates.ElemMessage;
-import org.apache.xalan.templates.ElemNumber;
-import org.apache.xalan.templates.ElemOtherwise;
-import org.apache.xalan.templates.ElemPI;
-import org.apache.xalan.templates.ElemParam;
-import org.apache.xalan.templates.ElemSort;
-import org.apache.xalan.templates.ElemTemplate;
-import org.apache.xalan.templates.ElemText;
-import org.apache.xalan.templates.ElemTextLiteral;
-import org.apache.xalan.templates.ElemUnknown;
-import org.apache.xalan.templates.ElemValueOf;
-import org.apache.xalan.templates.ElemVariable;
-import org.apache.xalan.templates.ElemWhen;
-import org.apache.xalan.templates.ElemWithParam;
+import org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates.Constants;
+import org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates.ElemApplyImport;
+import org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates.ElemApplyTemplates;
+import org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates.ElemAttribute;
+import org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates.ElemCallTemplate;
+import org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates.ElemChoose;
+import org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates.ElemComment;
+import org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates.ElemCopy;
+import org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates.ElemCopyOf;
+import org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates.ElemElement;
+import org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates.ElemExsltFuncResult;
+import org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates.ElemExsltFunction;
+import org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates.ElemExtensionDecl;
+import org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates.ElemExtensionScript;
+import org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates.ElemFallback;
+import org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates.ElemForEach;
+import org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates.ElemIf;
+import org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates.ElemLiteralResult;
+import org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates.ElemMessage;
+import org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates.ElemNumber;
+import org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates.ElemOtherwise;
+import org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates.ElemPI;
+import org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates.ElemParam;
+import org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates.ElemSort;
+import org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates.ElemTemplate;
+import org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates.ElemText;
+import org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates.ElemTextLiteral;
+import org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates.ElemUnknown;
+import org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates.ElemValueOf;
+import org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates.ElemVariable;
+import org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates.ElemWhen;
+import org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates.ElemWithParam;
import org.apache.xml.utils.QName;
/**
diff --git a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/AVT.java b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/AVT.java
index 2275cbf..798b451 100644
--- a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/AVT.java
+++ b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/AVT.java
@@ -26,7 +26,7 @@
* limitations under the License.
*/
/*
- * $Id: AVT.java,v 1.1 2008/03/27 01:08:54 dacarver Exp $
+ * $Id: AVT.java,v 1.2 2008/03/27 05:14:53 dacarver Exp $
*/
package org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates;
@@ -40,7 +40,7 @@
import org.apache.xalan.res.XSLTErrorResources;
import org.apache.xml.utils.FastStringBuffer;
import org.apache.xml.utils.StringBufferPool;
-import org.apache.xpath.XPath;
+import org.eclipse.wst.xsl.core.internal.compiler.xslt10.xpath.XPath;
import org.apache.xpath.XPathContext;
/**
diff --git a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/AVTPartXPath.java b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/AVTPartXPath.java
index 694849f..bc0740c 100644
--- a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/AVTPartXPath.java
+++ b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/AVTPartXPath.java
@@ -26,12 +26,12 @@
* limitations under the License.
*/
/*
- * $Id: AVTPartXPath.java,v 1.1 2008/03/27 01:08:54 dacarver Exp $
+ * $Id: AVTPartXPath.java,v 1.2 2008/03/27 05:14:53 dacarver Exp $
*/
package org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates;
import org.apache.xml.utils.FastStringBuffer;
-import org.apache.xpath.XPath;
+import org.eclipse.wst.xsl.core.internal.compiler.xslt10.xpath.XPath;
import org.apache.xpath.XPathContext;
import org.apache.xpath.XPathFactory;
import org.apache.xpath.compiler.XPathParser;
diff --git a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/ElemApplyTemplates.java b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/ElemApplyTemplates.java
index 74d3c9d..97b9f07 100644
--- a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/ElemApplyTemplates.java
+++ b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/ElemApplyTemplates.java
@@ -26,7 +26,7 @@
* limitations under the License.
*/
/*
- * $Id: ElemApplyTemplates.java,v 1.1 2008/03/27 01:08:54 dacarver Exp $
+ * $Id: ElemApplyTemplates.java,v 1.2 2008/03/27 05:14:53 dacarver Exp $
*/
package org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates;
@@ -42,7 +42,7 @@
import org.apache.xml.utils.IntStack;
import org.apache.xml.utils.QName;
import org.apache.xpath.VariableStack;
-import org.apache.xpath.XPath;
+import org.eclipse.wst.xsl.core.internal.compiler.xslt10.xpath.XPath;
import org.apache.xpath.XPathContext;
import org.apache.xpath.objects.XObject;
import org.xml.sax.SAXException;
diff --git a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/ElemCopyOf.java b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/ElemCopyOf.java
index 3c31cc7..59fe621 100644
--- a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/ElemCopyOf.java
+++ b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/ElemCopyOf.java
@@ -25,7 +25,7 @@
* limitations under the License.
*/
/*
- * $Id: ElemCopyOf.java,v 1.1 2008/03/27 01:08:53 dacarver Exp $
+ * $Id: ElemCopyOf.java,v 1.2 2008/03/27 05:14:53 dacarver Exp $
*/
package org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates;
@@ -39,7 +39,7 @@
import org.apache.xml.dtm.ref.DTMTreeWalker;
import org.apache.xalan.serialize.SerializerUtils;
import org.apache.xml.serializer.SerializationHandler;
-import org.apache.xpath.XPath;
+import org.eclipse.wst.xsl.core.internal.compiler.xslt10.xpath.XPath;
import org.apache.xpath.XPathContext;
import org.apache.xpath.objects.XObject;
diff --git a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/ElemForEach.java b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/ElemForEach.java
index 61dd4ba..a97889b 100644
--- a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/ElemForEach.java
+++ b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/ElemForEach.java
@@ -25,7 +25,7 @@
* limitations under the License.
*/
/*
- * $Id: ElemForEach.java,v 1.1 2008/03/27 01:08:53 dacarver Exp $
+ * $Id: ElemForEach.java,v 1.2 2008/03/27 05:14:53 dacarver Exp $
*/
package org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates;
@@ -41,7 +41,7 @@
import org.apache.xml.utils.IntStack;
import org.apache.xpath.Expression;
import org.apache.xpath.ExpressionOwner;
-import org.apache.xpath.XPath;
+import org.eclipse.wst.xsl.core.internal.compiler.xslt10.xpath.XPath;
import org.apache.xpath.XPathContext;
import java.io.ObjectInputStream;
diff --git a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/ElemIf.java b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/ElemIf.java
index 56cb206..c22cae0 100644
--- a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/ElemIf.java
+++ b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/ElemIf.java
@@ -25,14 +25,14 @@
* limitations under the License.
*/
/*
- * $Id: ElemIf.java,v 1.1 2008/03/27 01:08:54 dacarver Exp $
+ * $Id: ElemIf.java,v 1.2 2008/03/27 05:14:53 dacarver Exp $
*/
package org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates;
import javax.xml.transform.TransformerException;
import org.eclipse.wst.xsl.core.internal.compiler.xslt10.transformer.TransformerImpl;
-import org.apache.xpath.XPath;
+import org.eclipse.wst.xsl.core.internal.compiler.xslt10.xpath.XPath;
import org.apache.xpath.XPathContext;
import org.apache.xpath.objects.XObject;
diff --git a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/ElemLiteralResult.java b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/ElemLiteralResult.java
index 6468119..4f401ce 100644
--- a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/ElemLiteralResult.java
+++ b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/ElemLiteralResult.java
@@ -25,7 +25,7 @@
* limitations under the License.
*/
/*
- * $Id: ElemLiteralResult.java,v 1.1 2008/03/27 01:08:54 dacarver Exp $
+ * $Id: ElemLiteralResult.java,v 1.2 2008/03/27 05:14:53 dacarver Exp $
*/
package org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates;
@@ -116,7 +116,7 @@
for (int i = (nAttrs - 1); i >= 0; i--)
{
AVT avt = (AVT) m_avts.elementAt(i);
- avt.fixupVariables(vnames, cstate.getGlobalsSize());
+ avt.fixupVariables(vnames, cstate.getGlobalsSize());
}
}
}
diff --git a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/ElemNumber.java b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/ElemNumber.java
index 8e0fd61..a614606 100644
--- a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/ElemNumber.java
+++ b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/ElemNumber.java
@@ -25,7 +25,7 @@
* limitations under the License.
*/
/*
- * $Id: ElemNumber.java,v 1.1 2008/03/27 01:08:54 dacarver Exp $
+ * $Id: ElemNumber.java,v 1.2 2008/03/27 05:14:53 dacarver Exp $
*/
package org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates;
@@ -52,7 +52,7 @@
import org.apache.xml.utils.res.LongArrayWrapper;
import org.apache.xml.utils.res.StringArrayWrapper;
import org.apache.xpath.NodeSetDTM;
-import org.apache.xpath.XPath;
+import org.eclipse.wst.xsl.core.internal.compiler.xslt10.xpath.XPath;
import org.apache.xpath.XPathContext;
import org.apache.xpath.objects.XObject;
diff --git a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/ElemTemplate.java b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/ElemTemplate.java
index 2023880..a27ebd9 100644
--- a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/ElemTemplate.java
+++ b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/ElemTemplate.java
@@ -25,7 +25,7 @@
* limitations under the License.
*/
/*
- * $Id: ElemTemplate.java,v 1.1 2008/03/27 01:08:54 dacarver Exp $
+ * $Id: ElemTemplate.java,v 1.2 2008/03/27 05:14:53 dacarver Exp $
*/
package org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates;
@@ -34,7 +34,7 @@
import org.eclipse.wst.xsl.core.internal.compiler.xslt10.transformer.TransformerImpl;
import org.apache.xml.utils.QName;
-import org.apache.xpath.XPath;
+import org.eclipse.wst.xsl.core.internal.compiler.xslt10.xpath.XPath;
import org.apache.xpath.XPathContext;
/**
diff --git a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/ElemValueOf.java b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/ElemValueOf.java
index 4ec06f9..94db658 100644
--- a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/ElemValueOf.java
+++ b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/ElemValueOf.java
@@ -25,7 +25,7 @@
* limitations under the License.
*/
/*
- * $Id: ElemValueOf.java,v 1.1 2008/03/27 01:08:54 dacarver Exp $
+ * $Id: ElemValueOf.java,v 1.2 2008/03/27 05:14:53 dacarver Exp $
*/
package org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates;
@@ -36,7 +36,7 @@
import org.apache.xml.dtm.DTM;
import org.apache.xml.serializer.SerializationHandler;
import org.apache.xpath.Expression;
-import org.apache.xpath.XPath;
+import org.eclipse.wst.xsl.core.internal.compiler.xslt10.xpath.XPath;
import org.apache.xpath.XPathContext;
import org.apache.xpath.objects.XObject;
import org.xml.sax.SAXException;
diff --git a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/ElemVariable.java b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/ElemVariable.java
index 41ff269..cb090f9 100644
--- a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/ElemVariable.java
+++ b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/ElemVariable.java
@@ -25,7 +25,7 @@
* limitations under the License.
*/
/*
- * $Id: ElemVariable.java,v 1.1 2008/03/27 01:08:54 dacarver Exp $
+ * $Id: ElemVariable.java,v 1.2 2008/03/27 05:14:53 dacarver Exp $
*/
package org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates;
@@ -33,7 +33,7 @@
import org.eclipse.wst.xsl.core.internal.compiler.xslt10.transformer.TransformerImpl;
import org.apache.xml.utils.QName;
-import org.apache.xpath.XPath;
+import org.eclipse.wst.xsl.core.internal.compiler.xslt10.xpath.XPath;
import org.apache.xpath.XPathContext;
import org.apache.xpath.objects.XObject;
import org.apache.xpath.objects.XRTreeFrag;
diff --git a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/ElemVariablePsuedo.java b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/ElemVariablePsuedo.java
index fe69df6..af45cc0 100644
--- a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/ElemVariablePsuedo.java
+++ b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/ElemVariablePsuedo.java
@@ -25,14 +25,14 @@
* limitations under the License.
*/
/*
- * $Id: ElemVariablePsuedo.java,v 1.1 2008/03/27 01:08:54 dacarver Exp $
+ * $Id: ElemVariablePsuedo.java,v 1.2 2008/03/27 05:14:53 dacarver Exp $
*/
package org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates;
import javax.xml.transform.TransformerException;
import org.apache.xalan.transformer.TransformerImpl;
-import org.apache.xpath.XPath;
+import org.eclipse.wst.xsl.core.internal.compiler.xslt10.xpath.XPath;
public class ElemVariablePsuedo extends ElemVariable
{
diff --git a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/ElemWhen.java b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/ElemWhen.java
index d7f53b4..0f6a330 100644
--- a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/ElemWhen.java
+++ b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/ElemWhen.java
@@ -25,11 +25,11 @@
* limitations under the License.
*/
/*
- * $Id: ElemWhen.java,v 1.1 2008/03/27 01:08:54 dacarver Exp $
+ * $Id: ElemWhen.java,v 1.2 2008/03/27 05:14:53 dacarver Exp $
*/
package org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates;
-import org.apache.xpath.XPath;
+import org.eclipse.wst.xsl.core.internal.compiler.xslt10.xpath.XPath;
/**
* Implement xsl:when.
diff --git a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/ElemWithParam.java b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/ElemWithParam.java
index dbd6c30..f0595c9 100644
--- a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/ElemWithParam.java
+++ b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/ElemWithParam.java
@@ -25,7 +25,7 @@
* limitations under the License.
*/
/*
- * $Id: ElemWithParam.java,v 1.1 2008/03/27 01:08:54 dacarver Exp $
+ * $Id: ElemWithParam.java,v 1.2 2008/03/27 05:14:53 dacarver Exp $
*/
package org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates;
@@ -34,7 +34,7 @@
import org.apache.xalan.res.XSLTErrorResources;
import org.eclipse.wst.xsl.core.internal.compiler.xslt10.transformer.TransformerImpl;
import org.apache.xml.utils.QName;
-import org.apache.xpath.XPath;
+import org.eclipse.wst.xsl.core.internal.compiler.xslt10.xpath.XPath;
import org.apache.xpath.XPathContext;
import org.apache.xpath.objects.XObject;
import org.apache.xpath.objects.XRTreeFrag;
diff --git a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/FuncDocument.java b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/FuncDocument.java
index f5dff17..07e8bd6 100644
--- a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/FuncDocument.java
+++ b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/FuncDocument.java
@@ -25,7 +25,7 @@
* limitations under the License.
*/
/*
- * $Id: FuncDocument.java,v 1.1 2008/03/27 01:08:54 dacarver Exp $
+ * $Id: FuncDocument.java,v 1.2 2008/03/27 05:14:53 dacarver Exp $
*/
package org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates;
@@ -301,6 +301,7 @@
{
throwable =
((org.apache.xml.utils.WrappedRuntimeException) throwable).getException();
+ error(xctxt, throwable.getMessage(), null);
}
if ((throwable instanceof NullPointerException)
diff --git a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/RedundentExprEliminator.java b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/RedundentExprEliminator.java
index 751a878..edbc1ac 100644
--- a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/RedundentExprEliminator.java
+++ b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/RedundentExprEliminator.java
@@ -25,7 +25,7 @@
* limitations under the License.
*/
/*
- * $Id: RedundentExprEliminator.java,v 1.1 2008/03/27 01:08:54 dacarver Exp $
+ * $Id: RedundentExprEliminator.java,v 1.2 2008/03/27 05:14:53 dacarver Exp $
*/
package org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates;
@@ -38,7 +38,7 @@
import org.apache.xpath.Expression;
import org.apache.xpath.ExpressionNode;
import org.apache.xpath.ExpressionOwner;
-import org.apache.xpath.XPath;
+import org.eclipse.wst.xsl.core.internal.compiler.xslt10.xpath.XPath;
import org.apache.xpath.axes.AxesWalker;
import org.apache.xpath.axes.FilterExprIteratorSimple;
import org.apache.xpath.axes.FilterExprWalker;
diff --git a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/StylesheetRoot.java b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/StylesheetRoot.java
index 1042d40..fde4880 100644
--- a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/StylesheetRoot.java
+++ b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/StylesheetRoot.java
@@ -25,7 +25,7 @@
* limitations under the License.
*/
/*
- * $Id: StylesheetRoot.java,v 1.1 2008/03/27 01:08:54 dacarver Exp $
+ * $Id: StylesheetRoot.java,v 1.2 2008/03/27 05:14:53 dacarver Exp $
*/
package org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates;
@@ -50,7 +50,7 @@
import org.apache.xml.dtm.ref.ExpandedNameTable;
import org.apache.xml.utils.IntStack;
import org.apache.xml.utils.QName;
-import org.apache.xpath.XPath;
+import org.eclipse.wst.xsl.core.internal.compiler.xslt10.xpath.XPath;
import org.apache.xpath.XPathContext;
/**
diff --git a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/TemplateList.java b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/TemplateList.java
index e60f9a3..f0fec4c 100644
--- a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/TemplateList.java
+++ b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/TemplateList.java
@@ -25,7 +25,7 @@
* limitations under the License.
*/
/*
- * $Id: TemplateList.java,v 1.1 2008/03/27 01:08:53 dacarver Exp $
+ * $Id: TemplateList.java,v 1.2 2008/03/27 05:14:53 dacarver Exp $
*/
package org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates;
@@ -39,7 +39,7 @@
import org.apache.xml.dtm.DTM;
import org.apache.xml.utils.QName;
import org.apache.xpath.Expression;
-import org.apache.xpath.XPath;
+import org.eclipse.wst.xsl.core.internal.compiler.xslt10.xpath.XPath;
import org.apache.xpath.XPathContext;
import org.apache.xpath.compiler.PsuedoNames;
import org.apache.xpath.patterns.NodeTest;
diff --git a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/WhiteSpaceInfo.java b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/WhiteSpaceInfo.java
index 82fc8db..d4ad91f 100644
--- a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/WhiteSpaceInfo.java
+++ b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/templates/WhiteSpaceInfo.java
@@ -25,11 +25,11 @@
* limitations under the License.
*/
/*
- * $Id: WhiteSpaceInfo.java,v 1.1 2008/03/27 01:08:53 dacarver Exp $
+ * $Id: WhiteSpaceInfo.java,v 1.2 2008/03/27 05:14:53 dacarver Exp $
*/
package org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates;
-import org.apache.xpath.XPath;
+import org.eclipse.wst.xsl.core.internal.compiler.xslt10.xpath.XPath;
/**
* This is used as a special "fake" template that can be
diff --git a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/trace/EndSelectionEvent.java b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/trace/EndSelectionEvent.java
index bd63a9c..d78d862 100644
--- a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/trace/EndSelectionEvent.java
+++ b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/trace/EndSelectionEvent.java
@@ -25,13 +25,13 @@
* limitations under the License.
*/
/*
- * $Id: EndSelectionEvent.java,v 1.1 2008/03/27 01:08:57 dacarver Exp $
+ * $Id: EndSelectionEvent.java,v 1.2 2008/03/27 05:14:53 dacarver Exp $
*/
package org.eclipse.wst.xsl.core.internal.compiler.xslt10.trace;
import org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates.ElemTemplateElement;
import org.eclipse.wst.xsl.core.internal.compiler.xslt10.transformer.TransformerImpl;
-import org.apache.xpath.XPath;
+import org.eclipse.wst.xsl.core.internal.compiler.xslt10.xpath.XPath;
import org.apache.xpath.objects.XObject;
import org.w3c.dom.Node;
diff --git a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/trace/SelectionEvent.java b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/trace/SelectionEvent.java
index d035eac..b3e90f7 100644
--- a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/trace/SelectionEvent.java
+++ b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/trace/SelectionEvent.java
@@ -25,13 +25,13 @@
* limitations under the License.
*/
/*
- * $Id: SelectionEvent.java,v 1.1 2008/03/27 01:08:57 dacarver Exp $
+ * $Id: SelectionEvent.java,v 1.2 2008/03/27 05:14:53 dacarver Exp $
*/
package org.eclipse.wst.xsl.core.internal.compiler.xslt10.trace;
import org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates.ElemTemplateElement;
import org.eclipse.wst.xsl.core.internal.compiler.xslt10.transformer.TransformerImpl;
-import org.apache.xpath.XPath;
+import org.eclipse.wst.xsl.core.internal.compiler.xslt10.xpath.XPath;
import org.apache.xpath.objects.XObject;
import org.w3c.dom.Node;
diff --git a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/trace/TraceManager.java b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/trace/TraceManager.java
index bcb4c66..e762ff1 100644
--- a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/trace/TraceManager.java
+++ b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/trace/TraceManager.java
@@ -25,7 +25,7 @@
* limitations under the License.
*/
/*
- * $Id: TraceManager.java,v 1.1 2008/03/27 01:08:57 dacarver Exp $
+ * $Id: TraceManager.java,v 1.2 2008/03/27 05:14:53 dacarver Exp $
*/
package org.eclipse.wst.xsl.core.internal.compiler.xslt10.trace;
@@ -35,7 +35,7 @@
import org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates.ElemTemplateElement;
import org.eclipse.wst.xsl.core.internal.compiler.xslt10.transformer.TransformerImpl;
-import org.apache.xpath.XPath;
+import org.eclipse.wst.xsl.core.internal.compiler.xslt10.xpath.XPath;
import org.apache.xpath.objects.XObject;
import org.w3c.dom.Node;
diff --git a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/xpath/XPath.java b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/xpath/XPath.java
new file mode 100644
index 0000000..041a141
--- /dev/null
+++ b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/xpath/XPath.java
@@ -0,0 +1,660 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/*
+ * $Id: XPath.java,v 1.1 2008/03/27 05:14:54 dacarver Exp $
+ */
+package org.eclipse.wst.xsl.core.internal.compiler.xslt10.xpath;
+
+import java.io.Serializable;
+
+import javax.xml.transform.ErrorListener;
+import javax.xml.transform.SourceLocator;
+import javax.xml.transform.TransformerException;
+
+import org.apache.xalan.res.XSLMessages;
+import org.apache.xml.dtm.DTM;
+import org.apache.xml.utils.PrefixResolver;
+import org.apache.xml.utils.SAXSourceLocator;
+import org.apache.xml.utils.WrappedRuntimeException;
+import org.apache.xpath.Expression;
+import org.apache.xpath.ExpressionOwner;
+import org.apache.xpath.ExpressionNode;
+import org.apache.xpath.XPathContext;
+import org.apache.xpath.XPathVisitor;
+import org.apache.xpath.compiler.Compiler;
+import org.apache.xpath.compiler.FunctionTable;
+import org.apache.xpath.compiler.XPathParser;
+import org.apache.xpath.functions.Function;
+import org.apache.xpath.objects.XObject;
+import org.apache.xpath.res.XPATHErrorResources;
+
+/**
+ * The XPath class wraps an expression object and provides general services
+ * for execution of that expression.
+ * @xsl.usage advanced
+ */
+public class XPath implements Serializable, ExpressionOwner
+{
+ static final long serialVersionUID = 3976493477939110553L;
+
+ /** The top of the expression tree.
+ * @serial */
+ private Expression m_mainExp;
+
+ /**
+ * The function table for xpath build-in functions
+ */
+ private transient FunctionTable m_funcTable = null;
+
+ /**
+ * initial the function table
+ */
+ private void initFunctionTable(){
+ m_funcTable = new FunctionTable();
+ }
+
+ private ErrorListener userErrorListener = null;
+
+ /**
+ * Get the raw Expression object that this class wraps.
+ *
+ *
+ * @return the raw Expression object, which should not normally be null.
+ */
+ public Expression getExpression()
+ {
+ return m_mainExp;
+ }
+
+ /**
+ * This function is used to fixup variables from QNames to stack frame
+ * indexes at stylesheet build time.
+ * @param vars List of QNames that correspond to variables. This list
+ * should be searched backwards for the first qualified name that
+ * corresponds to the variable reference qname. The position of the
+ * QName in the vector from the start of the vector will be its position
+ * in the stack frame (but variables above the globalsTop value will need
+ * to be offset to the current stack frame).
+ */
+ public synchronized void fixupVariables(java.util.Vector vars, int globalsSize)
+ {
+ // Add Catch statment here
+ try {
+ m_mainExp.fixupVariables(vars, globalsSize);
+ } catch (Exception ex) {
+ try {
+ userErrorListener.error(new TransformerException(ex.getMessage(), ex));
+ } catch (Exception x) {
+ x.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ * Set the raw expression object for this object.
+ *
+ *
+ * @param exp the raw Expression object, which should not normally be null.
+ */
+ public void setExpression(Expression exp)
+ {
+ if(null != m_mainExp)
+ exp.exprSetParent(m_mainExp.exprGetParent()); // a bit bogus
+ m_mainExp = exp;
+ }
+
+ /**
+ * Get the SourceLocator on the expression object.
+ *
+ *
+ * @return the SourceLocator on the expression object, which may be null.
+ */
+ public SourceLocator getLocator()
+ {
+ return m_mainExp;
+ }
+
+// /**
+// * Set the SourceLocator on the expression object.
+// *
+// *
+// * @param l the SourceLocator on the expression object, which may be null.
+// */
+// public void setLocator(SourceLocator l)
+// {
+// // Note potential hazards -- l may not be serializable, or may be changed
+// // after being assigned here.
+// m_mainExp.setSourceLocator(l);
+// }
+
+ /** The pattern string, mainly kept around for diagnostic purposes.
+ * @serial */
+ String m_patternString;
+
+ /**
+ * Return the XPath string associated with this object.
+ *
+ *
+ * @return the XPath string associated with this object.
+ */
+ public String getPatternString()
+ {
+ return m_patternString;
+ }
+
+ /** Represents a select type expression. */
+ public static final int SELECT = 0;
+
+ /** Represents a match type expression. */
+ public static final int MATCH = 1;
+
+ /**
+ * Construct an XPath object.
+ *
+ * (Needs review -sc) This method initializes an XPathParser/
+ * Compiler and compiles the expression.
+ * @param exprString The XPath expression.
+ * @param locator The location of the expression, may be null.
+ * @param prefixResolver A prefix resolver to use to resolve prefixes to
+ * namespace URIs.
+ * @param type one of {@link #SELECT} or {@link #MATCH}.
+ * @param errorListener The error listener, or null if default should be used.
+ *
+ * @throws javax.xml.transform.TransformerException if syntax or other error.
+ */
+ public XPath(
+ String exprString, SourceLocator locator, PrefixResolver prefixResolver, int type,
+ ErrorListener errorListener)
+ throws javax.xml.transform.TransformerException
+ {
+ initFunctionTable();
+ if(null == errorListener)
+ errorListener = new org.apache.xml.utils.DefaultErrorHandler();
+
+ m_patternString = exprString;
+
+ XPathParser parser = new XPathParser(errorListener, locator);
+ Compiler compiler = new Compiler(errorListener, locator, m_funcTable);
+
+ if (SELECT == type)
+ parser.initXPath(compiler, exprString, prefixResolver);
+ else if (MATCH == type)
+ parser.initMatchPattern(compiler, exprString, prefixResolver);
+ else
+ throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_CANNOT_DEAL_XPATH_TYPE, new Object[]{Integer.toString(type)})); //"Can not deal with XPath type: " + type);
+
+ // System.out.println("----------------");
+ Expression expr = compiler.compile(0);
+
+ // System.out.println("expr: "+expr);
+ this.setExpression(expr);
+
+ if((null != locator) && locator instanceof ExpressionNode)
+ {
+ expr.exprSetParent((ExpressionNode)locator);
+ }
+
+ }
+
+ /**
+ * Construct an XPath object.
+ *
+ * (Needs review -sc) This method initializes an XPathParser/
+ * Compiler and compiles the expression.
+ * @param exprString The XPath expression.
+ * @param locator The location of the expression, may be null.
+ * @param prefixResolver A prefix resolver to use to resolve prefixes to
+ * namespace URIs.
+ * @param type one of {@link #SELECT} or {@link #MATCH}.
+ * @param errorListener The error listener, or null if default should be used.
+ *
+ * @throws javax.xml.transform.TransformerException if syntax or other error.
+ */
+ public XPath(
+ String exprString, SourceLocator locator,
+ PrefixResolver prefixResolver, int type,
+ ErrorListener errorListener, FunctionTable aTable)
+ throws javax.xml.transform.TransformerException
+ {
+ m_funcTable = aTable;
+ if(null == errorListener)
+ errorListener = new org.apache.xml.utils.DefaultErrorHandler();
+
+ userErrorListener = errorListener;
+
+ m_patternString = exprString;
+
+ XPathParser parser = new XPathParser(errorListener, locator);
+ Compiler compiler = new Compiler(errorListener, locator, m_funcTable);
+
+ if (SELECT == type)
+ parser.initXPath(compiler, exprString, prefixResolver);
+ else if (MATCH == type)
+ parser.initMatchPattern(compiler, exprString, prefixResolver);
+ else
+ throw new RuntimeException(XSLMessages.createXPATHMessage(
+ XPATHErrorResources.ER_CANNOT_DEAL_XPATH_TYPE,
+ new Object[]{Integer.toString(type)}));
+ //"Can not deal with XPath type: " + type);
+
+ // System.out.println("----------------");
+ Expression expr = compiler.compile(0);
+
+ // System.out.println("expr: "+expr);
+ this.setExpression(expr);
+
+ if((null != locator) && locator instanceof ExpressionNode)
+ {
+ expr.exprSetParent((ExpressionNode)locator);
+ }
+
+ }
+
+ /**
+ * Construct an XPath object.
+ *
+ * (Needs review -sc) This method initializes an XPathParser/
+ * Compiler and compiles the expression.
+ * @param exprString The XPath expression.
+ * @param locator The location of the expression, may be null.
+ * @param prefixResolver A prefix resolver to use to resolve prefixes to
+ * namespace URIs.
+ * @param type one of {@link #SELECT} or {@link #MATCH}.
+ *
+ * @throws javax.xml.transform.TransformerException if syntax or other error.
+ */
+ public XPath(
+ String exprString, SourceLocator locator, PrefixResolver prefixResolver, int type)
+ throws javax.xml.transform.TransformerException
+ {
+ this(exprString, locator, prefixResolver, type, null);
+ }
+
+ /**
+ * Construct an XPath object.
+ *
+ * @param expr The Expression object.
+ *
+ * @throws javax.xml.transform.TransformerException if syntax or other error.
+ */
+ public XPath(Expression expr)
+ {
+ this.setExpression(expr);
+ initFunctionTable();
+ }
+
+ /**
+ * Given an expression and a context, evaluate the XPath
+ * and return the result.
+ *
+ * @param xctxt The execution context.
+ * @param contextNode The node that "." expresses.
+ * @param namespaceContext The context in which namespaces in the
+ * XPath are supposed to be expanded.
+ *
+ * @return The result of the XPath or null if callbacks are used.
+ * @throws TransformerException thrown if
+ * the error condition is severe enough to halt processing.
+ *
+ * @throws javax.xml.transform.TransformerException
+ * @xsl.usage experimental
+ */
+ public XObject execute(
+ XPathContext xctxt, org.w3c.dom.Node contextNode,
+ PrefixResolver namespaceContext)
+ throws javax.xml.transform.TransformerException
+ {
+ return execute(
+ xctxt, xctxt.getDTMHandleFromNode(contextNode),
+ namespaceContext);
+ }
+
+
+ /**
+ * Given an expression and a context, evaluate the XPath
+ * and return the result.
+ *
+ * @param xctxt The execution context.
+ * @param contextNode The node that "." expresses.
+ * @param namespaceContext The context in which namespaces in the
+ * XPath are supposed to be expanded.
+ *
+ * @throws TransformerException thrown if the active ProblemListener decides
+ * the error condition is severe enough to halt processing.
+ *
+ * @throws javax.xml.transform.TransformerException
+ * @xsl.usage experimental
+ */
+ public XObject execute(
+ XPathContext xctxt, int contextNode, PrefixResolver namespaceContext)
+ throws javax.xml.transform.TransformerException
+ {
+
+ xctxt.pushNamespaceContext(namespaceContext);
+
+ xctxt.pushCurrentNodeAndExpression(contextNode, contextNode);
+
+ XObject xobj = null;
+
+ try
+ {
+ xobj = m_mainExp.execute(xctxt);
+ }
+ catch (TransformerException te)
+ {
+ te.setLocator(this.getLocator());
+ ErrorListener el = xctxt.getErrorListener();
+ if(null != el) // defensive, should never happen.
+ {
+ el.error(te);
+ }
+ else
+ throw te;
+ }
+ catch (Exception e)
+ {
+ while (e instanceof org.apache.xml.utils.WrappedRuntimeException)
+ {
+ e = ((org.apache.xml.utils.WrappedRuntimeException) e).getException();
+ }
+ // e.printStackTrace();
+
+ String msg = e.getMessage();
+
+ if (msg == null || msg.length() == 0) {
+ msg = XSLMessages.createXPATHMessage(
+ XPATHErrorResources.ER_XPATH_ERROR, null);
+
+ }
+ TransformerException te = new TransformerException(msg,
+ getLocator(), e);
+ ErrorListener el = xctxt.getErrorListener();
+ // te.printStackTrace();
+ if(null != el) // defensive, should never happen.
+ {
+ el.fatalError(te);
+ }
+ else
+ throw te;
+ }
+ finally
+ {
+ xctxt.popNamespaceContext();
+
+ xctxt.popCurrentNodeAndExpression();
+ }
+
+ return xobj;
+ }
+
+ /**
+ * Given an expression and a context, evaluate the XPath
+ * and return the result.
+ *
+ * @param xctxt The execution context.
+ * @param contextNode The node that "." expresses.
+ * @param namespaceContext The context in which namespaces in the
+ * XPath are supposed to be expanded.
+ *
+ * @throws TransformerException thrown if the active ProblemListener decides
+ * the error condition is severe enough to halt processing.
+ *
+ * @throws javax.xml.transform.TransformerException
+ * @xsl.usage experimental
+ */
+ public boolean bool(
+ XPathContext xctxt, int contextNode, PrefixResolver namespaceContext)
+ throws javax.xml.transform.TransformerException
+ {
+
+ xctxt.pushNamespaceContext(namespaceContext);
+
+ xctxt.pushCurrentNodeAndExpression(contextNode, contextNode);
+
+ try
+ {
+ return m_mainExp.bool(xctxt);
+ }
+ catch (TransformerException te)
+ {
+ te.setLocator(this.getLocator());
+ ErrorListener el = xctxt.getErrorListener();
+ if(null != el) // defensive, should never happen.
+ {
+ el.error(te);
+ }
+ else
+ throw te;
+ }
+ catch (Exception e)
+ {
+ while (e instanceof org.apache.xml.utils.WrappedRuntimeException)
+ {
+ e = ((org.apache.xml.utils.WrappedRuntimeException) e).getException();
+ }
+ // e.printStackTrace();
+
+ String msg = e.getMessage();
+
+ if (msg == null || msg.length() == 0) {
+ msg = XSLMessages.createXPATHMessage(
+ XPATHErrorResources.ER_XPATH_ERROR, null);
+
+ }
+
+ TransformerException te = new TransformerException(msg,
+ getLocator(), e);
+ ErrorListener el = xctxt.getErrorListener();
+ // te.printStackTrace();
+ if(null != el) // defensive, should never happen.
+ {
+ el.fatalError(te);
+ }
+ else
+ throw te;
+ }
+ finally
+ {
+ xctxt.popNamespaceContext();
+
+ xctxt.popCurrentNodeAndExpression();
+ }
+
+ return false;
+ }
+
+ /** Set to true to get diagnostic messages about the result of
+ * match pattern testing. */
+ private static final boolean DEBUG_MATCHES = false;
+
+ /**
+ * Get the match score of the given node.
+ *
+ * @param xctxt XPath runtime context.
+ * @param context The current source tree context node.
+ *
+ * @return score, one of {@link #MATCH_SCORE_NODETEST},
+ * {@link #MATCH_SCORE_NONE}, {@link #MATCH_SCORE_OTHER},
+ * or {@link #MATCH_SCORE_QNAME}.
+ *
+ * @throws javax.xml.transform.TransformerException
+ */
+ public double getMatchScore(XPathContext xctxt, int context)
+ throws javax.xml.transform.TransformerException
+ {
+
+ xctxt.pushCurrentNode(context);
+ xctxt.pushCurrentExpressionNode(context);
+
+ try
+ {
+ XObject score = m_mainExp.execute(xctxt);
+
+ if (DEBUG_MATCHES)
+ {
+ DTM dtm = xctxt.getDTM(context);
+ System.out.println("score: " + score.num() + " for "
+ + dtm.getNodeName(context) + " for xpath "
+ + this.getPatternString());
+ }
+
+ return score.num();
+ }
+ finally
+ {
+ xctxt.popCurrentNode();
+ xctxt.popCurrentExpressionNode();
+ }
+
+ // return XPath.MATCH_SCORE_NONE;
+ }
+
+
+ /**
+ * Warn the user of an problem.
+ *
+ * @param xctxt The XPath runtime context.
+ * @param sourceNode Not used.
+ * @param msg An error msgkey that corresponds to one of the constants found
+ * in {@link org.apache.xpath.res.XPATHErrorResources}, which is
+ * a key for a format string.
+ * @param args An array of arguments represented in the format string, which
+ * may be null.
+ *
+ * @throws TransformerException if the current ErrorListoner determines to
+ * throw an exception.
+ */
+ public void warn(
+ XPathContext xctxt, int sourceNode, String msg, Object[] args)
+ throws javax.xml.transform.TransformerException
+ {
+
+ String fmsg = XSLMessages.createXPATHWarning(msg, args);
+ ErrorListener ehandler = xctxt.getErrorListener();
+
+ if (null != ehandler)
+ {
+
+ // TO DO: Need to get stylesheet Locator from here.
+ ehandler.warning(new TransformerException(fmsg, (SAXSourceLocator)xctxt.getSAXLocator()));
+ }
+ }
+
+ /**
+ * Tell the user of an assertion error, and probably throw an
+ * exception.
+ *
+ * @param b If false, a runtime exception will be thrown.
+ * @param msg The assertion message, which should be informative.
+ *
+ * @throws RuntimeException if the b argument is false.
+ */
+ public void assertion(boolean b, String msg)
+ {
+
+ if (!b)
+ {
+ String fMsg = XSLMessages.createXPATHMessage(
+ XPATHErrorResources.ER_INCORRECT_PROGRAMMER_ASSERTION,
+ new Object[]{ msg });
+
+ throw new RuntimeException(fMsg);
+ }
+ }
+
+ /**
+ * Tell the user of an error, and probably throw an
+ * exception.
+ *
+ * @param xctxt The XPath runtime context.
+ * @param sourceNode Not used.
+ * @param msg An error msgkey that corresponds to one of the constants found
+ * in {@link org.apache.xpath.res.XPATHErrorResources}, which is
+ * a key for a format string.
+ * @param args An array of arguments represented in the format string, which
+ * may be null.
+ *
+ * @throws TransformerException if the current ErrorListoner determines to
+ * throw an exception.
+ */
+ public void error(
+ XPathContext xctxt, int sourceNode, String msg, Object[] args)
+ throws javax.xml.transform.TransformerException
+ {
+
+ String fmsg = XSLMessages.createXPATHMessage(msg, args);
+ ErrorListener ehandler = xctxt.getErrorListener();
+
+ if (null != ehandler)
+ {
+ ehandler.fatalError(new TransformerException(fmsg,
+ (SAXSourceLocator)xctxt.getSAXLocator()));
+ }
+ else
+ {
+ SourceLocator slocator = xctxt.getSAXLocator();
+ System.out.println(fmsg + "; file " + slocator.getSystemId()
+ + "; line " + slocator.getLineNumber() + "; column "
+ + slocator.getColumnNumber());
+ }
+ }
+
+ /**
+ * This will traverse the heararchy, calling the visitor for
+ * each member. If the called visitor method returns
+ * false, the subtree should not be called.
+ *
+ * @param owner The owner of the visitor, where that path may be
+ * rewritten if needed.
+ * @param visitor The visitor whose appropriate method will be called.
+ */
+ public void callVisitors(ExpressionOwner owner, XPathVisitor visitor)
+ {
+ m_mainExp.callVisitors(this, visitor);
+ }
+
+ /**
+ * The match score if no match is made.
+ * @xsl.usage advanced
+ */
+ public static final double MATCH_SCORE_NONE = Double.NEGATIVE_INFINITY;
+
+ /**
+ * The match score if the pattern has the form
+ * of a QName optionally preceded by an @ character.
+ * @xsl.usage advanced
+ */
+ public static final double MATCH_SCORE_QNAME = 0.0;
+
+ /**
+ * The match score if the pattern pattern has the form NCName:*.
+ * @xsl.usage advanced
+ */
+ public static final double MATCH_SCORE_NSWILD = -0.25;
+
+ /**
+ * The match score if the pattern consists of just a NodeTest.
+ * @xsl.usage advanced
+ */
+ public static final double MATCH_SCORE_NODETEST = -0.5;
+
+ /**
+ * The match score if the pattern consists of something
+ * other than just a NodeTest or just a qname.
+ * @xsl.usage advanced
+ */
+ public static final double MATCH_SCORE_OTHER = 0.5;
+}