/** * Check that the variable is not already declared, and allocate a slot number */ public void validate() throws XPathException { super.validate(); if (global) { if (!redundant) { slotNumber = getPrincipalStylesheet().allocateGlobalSlot(getVariableQName()); } } }
/** * Check that the variable is not already declared, and allocate a slot number */ public void validate() throws XPathException { super.validate(); if (global) { if (!redundant) { slotNumber = getPrincipalStylesheet().allocateGlobalSlot(getVariableQName()); } } }
/** * Index a global xsl:variable or xsl:param element * @param var The XSLVariable or XSLParam element * @throws XPathException */ private void indexVariableDeclaration(XSLVariableDeclaration var) throws XPathException { StructuredQName qName = var.getVariableQName(); if (qName != null) { // see if there is already a global variable with this precedence XSLVariableDeclaration other = (XSLVariableDeclaration) globalVariableIndex.get(qName); if (other == null) { // this is the first globalVariableIndex.put(qName, var); } else { // check the precedences int thisPrecedence = var.getPrecedence(); int otherPrecedence = other.getPrecedence(); if (thisPrecedence == otherPrecedence) { var.compileError("Duplicate global variable declaration (see line " + other.getLineNumber() + " of " + other.getSystemId() + ')', "XTSE0630"); } else if (thisPrecedence < otherPrecedence) { var.setRedundant(); } else { // can't happen, but we'll play safe other.setRedundant(); globalVariableIndex.put(qName, var); } } } }
/** * Index a global xsl:variable or xsl:param element * @param var The XSLVariable or XSLParam element * @throws XPathException */ private void indexVariableDeclaration(XSLVariableDeclaration var) throws XPathException { StructuredQName qName = var.getVariableQName(); if (qName != null) { // see if there is already a global variable with this precedence XSLVariableDeclaration other = (XSLVariableDeclaration) globalVariableIndex.get(qName); if (other == null) { // this is the first globalVariableIndex.put(qName, var); } else { // check the precedences int thisPrecedence = var.getPrecedence(); int otherPrecedence = other.getPrecedence(); if (thisPrecedence == otherPrecedence) { var.compileError("Duplicate global variable declaration (see line " + other.getLineNumber() + " of " + other.getSystemId() + ')', "XTSE0630"); } else if (thisPrecedence < otherPrecedence) { var.setRedundant(); } else { // can't happen, but we'll play safe other.setRedundant(); globalVariableIndex.put(qName, var); } } } }
/** * Index a global xsl:variable or xsl:param element * @param var The XSLVariable or XSLParam element * @throws XPathException */ private void indexVariableDeclaration(XSLVariableDeclaration var) throws XPathException { StructuredQName qName = var.getVariableQName(); if (qName != null) { // see if there is already a global variable with this precedence XSLVariableDeclaration other = (XSLVariableDeclaration) globalVariableIndex.get(qName); if (other == null) { // this is the first globalVariableIndex.put(qName, var); } else { // check the precedences int thisPrecedence = var.getPrecedence(); int otherPrecedence = other.getPrecedence(); if (thisPrecedence == otherPrecedence) { var.compileError("Duplicate global variable declaration (see line " + other.getLineNumber() + " of " + other.getSystemId() + ')', "XTSE0630"); } else if (thisPrecedence < otherPrecedence) { var.setRedundant(); } else { // can't happen, but we'll play safe other.setRedundant(); globalVariableIndex.put(qName, var); } } } }
if (var.getVariableQName().equals(qName)) { return var;
if (var.getVariableQName().equals(qName)) { return var;