/*
* reserved comment block
* DO NOT REMOVE OR ALTER!
*/
/*
* Copyright 2001-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
*
*
* 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: AbstractTranslet.java,v 1.6 2006/06/19 19:49:03 spericas Exp $
*/
/**
* @author Jacek Ambroziak
* @author Santiago Pericas-Geertsen
* @author Morten Jorgensen
* @author G. Todd Miller
* @author John Howard, JohnH@schemasoft.com
*/
// These attributes are extracted from the xsl:output element. They also
// appear as fields (with the same type, only public) in Output.java
public boolean _omitHeader = false;
//see OutputPropertiesFactory.ORACLE_IS_STANDALONE
public boolean _isStandalone = false;
public boolean _indent = false;
// Initialize Translet version field to base value. A class that extends
// AbstractTranslet may override this value to a more recent translet
// version; if it doesn't override the value (because it was compiled
// before the notion of a translet version was introduced, it will get
// this default value).
protected int[] typesArray;
// The Templates object that is used to create this Translet instance
// Boolean flag to indicate whether this translet has id functions.
protected boolean _hasIdCall = false;
// TODO - these should only be instanciated when needed
// Use one empty string instead of constantly instanciating String("");
// This is the name of the index used for ID attributes
private boolean _useServicesMechanism;
/**
* protocols allowed for external references set by the stylesheet processing instruction, Document() function, Import and Include element.
*/
/************************************************************************
* Debugging
************************************************************************/
public void printInternalState() {
}
/**
* Wrap the initial input DOM in a dom adapter. This adapter is wrapped in
* a DOM multiplexer if the document() function is used (handled by compiled
* code in the translet - see compiler/Stylesheet.compileTransform()).
*/
throws TransletException {
}
/************************************************************************
* Parameter handling
************************************************************************/
// Parameter's stack: <tt>pbase</tt> and <tt>pframe</tt> are used
// to denote the current parameter frame.
/**
* Push a new parameter frame.
*/
public final void pushParamFrame() {
}
/**
* Pop the topmost parameter frame.
*/
public final void popParamFrame() {
if (pbase > 0) {
paramsStack.remove(i);
}
}
}
/**
* Add a new global parameter if not already in the current frame.
* To setParameters of the form {http://foo.bar}xyz
* This needs to get mapped to an instance variable in the class
* The mapping created so that
* the global variables in the generated class become
* http$colon$$flash$$flash$foo$dot$bar$colon$xyz
*/
}
/**
* Add a new global or local parameter if not already in the current frame.
* The 'isDefault' parameter is set to true if the value passed is the
* default value from the <xsl:parameter> element's select attribute or
* element body.
*/
boolean isDefault)
{
// Local parameters need to be re-evaluated for each iteration
// Only overwrite if current value is the default value and
// the new value is _NOT_ the default value.
return value;
}
}
}
// Add new parameter to parameter stack
return value;
}
/**
* Clears the parameter stack.
*/
public void clearParameters() {
paramsStack.clear();
}
/**
* Get the value of a parameter from the current frame or
* <tt>null</tt> if undefined.
*/
}
return null;
}
/************************************************************************
* Message handling - implementation of <xsl:message>
************************************************************************/
// Holds the translet's message handler - used for <xsl:message>.
// The deault message handler dumps a string stdout, but anything can be
// used, such as a dialog box for applets, etc.
/**
* Set the translet's message handler - must implement MessageHandler
*/
}
/**
* Pass a message to the message handler - used by Message class.
*/
if (_msgHandler == null) {
}
else {
}
}
/************************************************************************
* Decimal number format symbol handling
************************************************************************/
// Contains decimal number formatting symbols used by FormatNumberCall
/**
* Adds a DecimalFormat object to the _formatSymbols hashtable.
* The entry is created with the input DecimalFormatSymbols.
*/
// Instanciate hashtable for formatting symbols if needed
// The name cannot be null - use empty string instead
// Construct a DecimalFormat object containing the symbols we got
}
}
/**
* Retrieves a named DecimalFormat object from _formatSymbols hashtable.
*/
if (_formatSymbols != null) {
// The name cannot be null - use empty string instead
return df;
}
return(null);
}
/**
* Give the translet an opportunity to perform a prepass on the document
* to extract any information that it can store in an optimized form.
*
* Currently, it only extracts information about attributes of type ID.
*/
}
/**
* Leverages the Key Class to implement the XSLT id() function.
* buildIdIndex creates the index (##id) that Key Class uses.
* The index contains the element node index (int) and Id value (String).
*/
if (document instanceof DOMEnhancedForDTM) {
// If the input source is DOMSource, the KeyIndex table is not
// built at this time. It will be built later by the lookupId()
// and containsId() methods of the KeyIndex class.
if (enhancedDOM.hasDOMSource()) {
return;
}
else {
if (elementsByID == null) {
return;
}
// Given a Hashtable of DTM nodes indexed by ID attribute values,
// loop through the table copying information to a KeyIndex
// for the mapping from ID attribute value to DTM node
boolean hasIDValues = false;
while (idValues.hasMoreElements()) {
final int element =
.intValue());
hasIDValues = true;
}
if (hasIDValues) {
}
}
}
}
/**
* After constructing the translet object, this method must be called to
* perform any version-specific post-initialization that's required.
*/
public final void postInitialization() {
// If the version of the translet had just one namesArray, split
// it into multiple fields.
if (transletVersion < VER_SPLIT_NAMES_ARRAY) {
int[] newTypesArray = new int[arraySize];
for (int i = 0; i < arraySize; i++) {
if (colonIndex > -1) {
}
// Distinguish attribute and element names. Attribute has
// @ before local part of name.
} else {
}
newNamesArray[i] =
}
}
// Was translet compiled using a more recent version of the XSLTC
// compiler than is known by the AbstractTranslet class? If, so
// and we've made it this far (which is doubtful), we should give up.
if (transletVersion > CURRENT_TRANSLET_VERSION) {
}
}
/************************************************************************
* Index(es) for <xsl:key> / key() / id()
************************************************************************/
// Container for all indexes for xsl:key elements
/**
* This method is used to pass the largest DOM size to the translet.
* Needed to make sure that the translet can index the whole DOM.
*/
}
/**
* Creates a KeyIndex object of the desired size - don't want to resize!!!
*/
return(new KeyIndex(_indexSize));
}
/**
* @param name is the name of the index (the key or ##id)
* @param node is the node handle of the node to insert
* @param value is the value that will look up the node in the given index
*/
}
}
/**
* Create an empty KeyIndex in the DOM case
* @param name is the name of the index (the key or ##id)
* @param dom is the DOM
*/
}
}
/**
* Returns the index for a given key (or id).
* The index implements our internal iterator interface
*/
// Return an empty key index iterator if none are defined
if (_keyIndexes == null) {
return (_emptyKeyIndex != null)
}
// Look up the requested key index
// Return an empty key index iterator if the requested index not found
return (_emptyKeyIndex != null)
}
return(index);
}
}
/**
* This method builds key indexes - it is overridden in the compiled
* translet in cases where the <xsl:key> element is used
*/
int root) throws TransletException {
}
/**
* This method builds key indexes - it is overridden in the compiled
* translet in cases where the <xsl:key> element is used
*/
}
/************************************************************************
* DOM cache handling
************************************************************************/
// Hold the DOM cache (if any) used with this translet
/**
* Sets the DOM cache used for additional documents loaded using the
* document() function.
*/
}
/**
* Returns the DOM cache used for this translet. Used by the LoadDocument
* class (if present) when the document() function is used.
*/
return(_domCache);
}
/************************************************************************
* Multiple output document extension.
* See compiler/TransletOutput for actual implementation.
************************************************************************/
throws TransletException
{
try {
}
final SerializationHandler handler
return handler;
}
catch (Exception e) {
throw new TransletException(e);
}
}
throws TransletException
{
return openOutputHandler(filename, false);
}
try {
}
catch (Exception e) {
// what can you do?
}
}
/************************************************************************
************************************************************************/
/**
* Main transform() method - this is overridden by the compiled translet
*/
throws TransletException;
/**
* Calls transform() with a given output handler
*/
throws TransletException {
try {
} finally {
_keyIndexes = null;
}
}
/**
* Used by some compiled code as a shortcut for passing strings to the
* output handler
*/
throws TransletException {
//final int length = string.length();
try {
} catch (Exception e) {
throw new TransletException(e);
}
}
}
/**
* Add's a name of an element whose text contents should be output as CDATA
*/
}
if (lastColon > 0) {
} else {
}
}
/**
* Transfer the output settings to the output post-processor
*/
if (_standalone != null) {
}
if (_omitHeader) {
handler.setOmitXMLDeclaration(true);
}
}
if (_doctypeSystem != null) {
}
}
if (_mediaType != null) {
}
}
}
else {
}
if (_standalone != null) {
}
if (_omitHeader) {
handler.setOmitXMLDeclaration(true);
}
}
}
}
}
}
// GTM added (see pg 110)
return namesArray;
}
return urisArray;
}
public int[] getTypesArray() {
return typesArray;
}
return namespaceArray;
}
public boolean hasIdCall() {
return _hasIdCall;
}
return _templates;
}
}
/**
* Return the state of the services mechanism feature.
*/
public boolean useServicesMechnism() {
return _useServicesMechanism;
}
/**
* Set the state of the services mechanism feature.
*/
}
/**
* Return allowed protocols for accessing external stylesheet.
*/
return _accessExternalStylesheet;
}
/**
* Set allowed protocols for accessing external stylesheet.
*/
}
/************************************************************************
* DOMImplementation caching for basis library
************************************************************************/
throws ParserConfigurationException
{
if (_domImplementation == null) {
}
}
}