/** * Notify all references to this variable of the data type */ public void fixupReferences() throws XPathException { final SequenceType type = getRequiredType(); final TypeHierarchy th = getConfiguration().getTypeHierarchy(); final Iterator iter = references.iterator(); while (iter.hasNext()) { Value constantValue = null; int properties = 0; if (this instanceof XSLVariable && !isAssignable()) { if (select instanceof Literal) { // we can't rely on the constant value because it hasn't yet been type-checked, // which could change it (eg by numeric promotion). Rather than attempt all the type-checking // now, we do a quick check. See test bug64 int relation = th.relationship(select.getItemType(th), type.getPrimaryType()); if (relation == TypeHierarchy.SAME_TYPE || relation == TypeHierarchy.SUBSUMED_BY) { constantValue = ((Literal)select).getValue(); } } if (select != null) { properties = select.getSpecialProperties(); } } ((BindingReference)iter.next()).setStaticType(type, constantValue, properties); } super.fixupReferences(); }
/** * Notify all references to this variable of the data type */ public void fixupReferences() throws XPathException { final SequenceType type = getRequiredType(); final TypeHierarchy th = getConfiguration().getTypeHierarchy(); final Iterator iter = references.iterator(); while (iter.hasNext()) { Value constantValue = null; int properties = 0; if (this instanceof XSLVariable && !isAssignable()) { if (select instanceof Literal) { // we can't rely on the constant value because it hasn't yet been type-checked, // which could change it (eg by numeric promotion). Rather than attempt all the type-checking // now, we do a quick check. See test bug64 int relation = th.relationship(select.getItemType(th), type.getPrimaryType()); if (relation == TypeHierarchy.SAME_TYPE || relation == TypeHierarchy.SUBSUMED_BY) { constantValue = ((Literal)select).getValue(); } } if (select != null) { properties = select.getSpecialProperties(); } } ((BindingReference)iter.next()).setStaticType(type, constantValue, properties); } super.fixupReferences(); }
public void validate() throws XPathException { super.validate(); XSLVariableDeclaration declaration; try { declaration = bindVariable(getVariableQName()); declaration.registerReference(instruction); requiredType = declaration.getRequiredType(); } catch (XPathException err) { // variable not declared compileError(err.getMessage()); return; } if (!declaration.isAssignable()) { compileError("Variable " + getVariableDisplayName() + " is not marked as assignable"); } if (!declaration.isGlobal()) { compileError("saxon:assign now works only with global variables"); } }
public void validate() throws XPathException { super.validate(); XSLVariableDeclaration declaration; try { declaration = bindVariable(getVariableQName()); declaration.registerReference(instruction); requiredType = declaration.getRequiredType(); } catch (XPathException err) { // variable not declared compileError(err.getMessage()); return; } if (!declaration.isAssignable()) { compileError("Variable " + getVariableDisplayName() + " is not marked as assignable"); } if (!declaration.isGlobal()) { compileError("saxon:assign now works only with global variables"); } }