/*
* reserved comment block
* DO NOT REMOVE OR ALTER!
*/
/*
* Copyright 2001-2006 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: KeyCall.java,v 1.7 2006/06/19 19:49:04 spericas Exp $
*/
/**
* @author Morten Jorgensen
* @author Santiago Pericas-Geertsen
*/
/**
* The name of the key.
*/
/**
*/
/**
* The value's data type.
*/
/**
* Expanded qname when name is literal.
*/
/**
* Get the parameters passed to function:
* key(String name, String value)
* key(String name, NodeSet value)
* The 'arguments' vector should contain two parameters for key() calls,
* one holding the key name and one holding the value(s) to look up. The
* vector has only one parameter for id() calls (the key name is always
* "##id" for id() calls).
*
* @param fname The function name (should be 'key' or 'id')
* @param arguments A vector containing the arguments the the function
*/
switch(argumentCount()) {
case 1:
break;
case 2:
break;
default:
break;
}
}
/**
* If this call to key() is in a top-level element like another variable
* or param, add a dependency between that top-level element and the
* referenced key. For example,
*
* <xsl:key name="x" .../>
* <xsl:variable name="y" select="key('x', 1)"/>
*
* and assuming this class represents "key('x', 1)", add a reference
* between variable y and key x. Note that if 'x' is unknown statically
* in key('x', 1), there's nothing we can do at this point.
*/
public void addParentDependency() {
// If name unknown statically, there's nothing we can do
if (_resolvedQName == null) return;
SyntaxTreeNode node = this;
}
}
}
/**
* Type check the parameters for the id() or key() function.
* The index name (for key() call only) must be a string or convertable
* to a string, and the lookup-value must be a string or a node-set.
* @param stable The parser's symbol table
* @throws TypeCheckError When the parameters have illegal type
*/
// Run type check on the key name (first argument) - must be a string,
// and if it is not it must be converted to one using string() rules.
if (_name instanceof LiteralExpr) {
}
else if (nameType instanceof StringType == false) {
}
}
// Run type check on the value for this key. This value can be of
// any data type, so this should never cause any type-check errors.
// If the value is a reference, then we have to defer the decision
// of how to process it until run-time.
// If the value is known not to be a node-set, then it should be
// converted to a string before the lookup is done. If the value is
// known to be a node-set then this process (convert to string, then
// do lookup) should be applied to every node in the set, and the
// result from all lookups should be added to the resulting node-set.
}
// If in a top-level element, create dependency to the referenced key
return returnType;
}
/**
* This method is called when the constructor is compiled in
* Stylesheet.compileConstructor() and not as the syntax tree is traversed.
* <p>This method will generate byte code that produces an iterator
* for the nodes in the node set for the key or id function call.
* @param classGen The Java class generator
* @param methodGen The method generator
*/
// Returns the KeyIndex object of a given name
"getKeyIndex",
// KeyIndex.setDom(Dom, node) => void
"setDom",
// Initialises a KeyIndex to return nodes with specific values
final int getKeyIterator =
"getKeyIndexIterator",
// Initialise the index specified in the first parameter of key()
} else if (_resolvedQName != null) {
} else {
}
// Generate following byte code:
//
// KeyIndex ki = translet.getKeyIndex(_name)
// ki.setDom(translet.dom);
// ki.getKeyIndexIterator(_value, true) - for key()
// OR
// ki.getKeyIndexIterator(_value, false) - for id()
}
}