/** * Get the display name of the variable. This is taken from the variable binding if possible * @return the display name (a lexical QName */ public String getDisplayName() { if (binding != null) { return binding.getVariableQName().getDisplayName(); } else { return displayName; } }
/** * Create a Variable Reference * * @param binding the variable binding to which this variable refers */ public VariableReference(Binding binding) { //System.err.println("Creating varRef1"); variableName = binding.getVariableQName(); fixup(binding); }
/** * Create a Variable Reference * * @param binding the variable binding to which this variable refers */ public VariableReference(Binding binding) { //System.err.println("Creating varRef1"); variableName = binding.getVariableQName(); fixup(binding); }
/** * Get the display name of the variable. This is taken from the variable binding if possible * @return the display name (a lexical QName */ public String getDisplayName() { if (binding != null) { return binding.getVariableQName().getDisplayName(); } else { return displayName; } }
/** * Get the display name of the variable. This is taken from the variable binding if possible * @return the display name (a lexical QName */ public String getDisplayName() { if (binding != null) { return binding.getVariableQName().getDisplayName(); } else { return displayName; } }
/** * Locate a range variable with a given name. (By "range variable", we mean a * variable declared within the expression where it is used.) * * @param qName identifies the name of the range variable * @return null if not found (this means the variable is probably a * context variable); otherwise the relevant RangeVariable */ private Binding findRangeVariable(StructuredQName qName) { if (rangeVariables==null) { return null; } for (int v=rangeVariables.size()-1; v>=0; v--) { Binding b = (Binding)rangeVariables.elementAt(v); if (b.getVariableQName().equals(qName)) { return b; } } return null; // not an in-scope range variable }
/** * Locate a range variable with a given name. (By "range variable", we mean a * variable declared within the expression where it is used.) * * @param qName identifies the name of the range variable * @return null if not found (this means the variable is probably a * context variable); otherwise the relevant RangeVariable */ private Binding findRangeVariable(StructuredQName qName) { if (rangeVariables==null) { return null; } for (int v=rangeVariables.size()-1; v>=0; v--) { Binding b = (Binding)rangeVariables.elementAt(v); if (b.getVariableQName().equals(qName)) { return b; } } return null; // not an in-scope range variable }
/** * Create a Variable Reference * @param binding the variable binding to which this variable refers */ public VariableReference(Binding binding) { //System.err.println("Creating varRef1"); displayName = binding.getVariableQName().getDisplayName(); fixup(binding); }
/** * Get the display name of the variable. This is taken from the variable binding if possible * * @return the display name (a lexical QName */ public String getDisplayName() { if (binding != null) { return binding.getVariableQName().getDisplayName(); } else { return variableName.getDisplayName(); } }
/** * Get the display name of the variable. This is taken from the variable binding if possible * * @return the display name (a lexical QName */ public String getDisplayName() { if (binding != null) { return binding.getVariableQName().getDisplayName(); } else { return variableName.getDisplayName(); } }
/** * Create a Variable Reference * @param binding the variable binding to which this variable refers */ public VariableReference(Binding binding) { displayName = binding.getVariableQName().getDisplayName(); fixup(binding); }
/** * Create a Variable Reference * @param binding the variable binding to which this variable refers */ public VariableReference(Binding binding) { displayName = binding.getVariableQName().getDisplayName(); fixup(binding); }
/** * Get the EQName of the variable. This is taken from the variable binding if possible. * The returned name is in the format Q{uri}local if in a namespace, or the local name * alone if not. * * @return the EQName, or the local name if not in a namespace */ public String getEQName() { if (binding != null) { StructuredQName q = binding.getVariableQName(); if (q.hasURI("")) { return q.getLocalPart(); } else { return q.getEQName(); } } else { return variableName.getEQName(); } }
/** * Get the EQName of the variable. This is taken from the variable binding if possible. * The returned name is in the format Q{uri}local if in a namespace, or the local name * alone if not. * * @return the EQName, or the local name if not in a namespace */ public String getEQName() { if (binding != null) { StructuredQName q = binding.getVariableQName(); if (q.hasURI("")) { return q.getLocalPart(); } else { return q.getEQName(); } } else { return variableName.getEQName(); } }
if (b instanceof GlobalVariable) { String uri = ((GlobalVariable) b).getSystemId(); StructuredQName qName = b.getVariableQName(); boolean synthetic = qName.hasURI(NamespaceConstant.SAXON_GENERATED_VARIABLE); if (!synthetic && uri != null && !uri.equals(getSystemId())) { if (b instanceof GlobalVariable) { String uri = ((GlobalVariable) b).getSystemId(); StructuredQName qName = b.getVariableQName(); boolean synthetic = qName.hasURI(NamespaceConstant.SAXON) && "gg".equals(qName.getPrefix()); if (!synthetic && uri != null && !uri.equals(getSystemId())) {
if (b instanceof GlobalVariable) { String uri = ((GlobalVariable) b).getSystemId(); StructuredQName qName = b.getVariableQName(); boolean synthetic = qName.hasURI(NamespaceConstant.SAXON_GENERATED_VARIABLE); if (!synthetic && uri != null && !uri.equals(getSystemId())) { if (b instanceof GlobalVariable) { String uri = ((GlobalVariable) b).getSystemId(); StructuredQName qName = b.getVariableQName(); boolean synthetic = qName.hasURI(NamespaceConstant.SAXON) && "gg".equals(qName.getPrefix()); if (!synthetic && uri != null && !uri.equals(getSystemId())) {
if (b instanceof GlobalVariable) { String uri = ((GlobalVariable)b).getSystemId(); StructuredQName qName = b.getVariableQName(); boolean synthetic = NamespaceConstant.SAXON.equals(qName.getNamespaceURI()) && "gg".equals(qName.getPrefix()); if (!synthetic && !uri.equals(getSystemId())) { if (b instanceof GlobalVariable) { String uri = ((GlobalVariable)b).getSystemId(); StructuredQName qName = b.getVariableQName(); boolean synthetic = NamespaceConstant.SAXON.equals(qName.getNamespaceURI()) && "gg".equals(qName.getPrefix()); if (!synthetic && !uri.equals(getSystemId())) {
if (e2 instanceof VariableReference) { result[0] = ((VariableReference) e2).getBinding().getVariableQName().getLocalPart(); result[0] = bind.getVariableQName().getClarkName();
public AbstractExpression exprFor (VariableReference var) { if (var.getBinding() != null) { StructuredQName varName= var.getBinding().getVariableQName(); return new Variable (qnameFor (varName)); } else { // total HACK, but Saxon provides no other public method to retrieve the constant value try { Object o = var.optimize(null, null); if (o instanceof Literal) { return exprFor ((Literal) o); } } catch (XPathException e) { throw new LuxException ("Unsupported variable reference: " + var); } throw new LuxException ("Unsupported variable reference: " + var); } }
StructuredQName var = bind.getVariableQName(); for (Clause cls: flwor.clauses) { LocalVariableBinding[] lvbs = cls.getRangeVariables();