Package net.sf.saxon.value

Examples of net.sf.saxon.value.Value


    public int getWeight() {
        return 10000;
    }

    public Value transform(Object source, TransformationContext context) {
       Value result = null;
         if (source instanceof Integer) {
             result = new IntegerValue((Integer)source);
         } else if (source instanceof Long) {
             result = new IntegerValue((Long)source);
         } else if (source instanceof Short) {
View Full Code Here


    public int getWeight() {
        return 10000;
    }

    public Value transform(Object source, TransformationContext context) {
       Value result = null;
         if (source instanceof Integer) {
             result = new IntegerValue((Integer)source);
         } else if (source instanceof Long) {
             result = new IntegerValue((Long)source);
         } else if (source instanceof Short) {
View Full Code Here

    public int getWeight() {
        return 10000;
    }

    public Value transform(Object source, TransformationContext context) {
        Value result = null;
        if (source instanceof Integer) {
            result = new IntegerValue((Integer)source);
        } else if (source instanceof Long) {
            result = new IntegerValue((Long)source);
        } else if (source instanceof Short) {
View Full Code Here

                return null;
            }
            if (o instanceof Item) {
                return SingletonIterator.makeIterator((Item)o);
            }
            Value value = (Value)o;
            return value.iterate();
        }
View Full Code Here

        operand0 = visitor.typeCheck(operand0, contextItemType);
        operand1 = visitor.typeCheck(operand1, contextItemType);
        // if both operands are known, pre-evaluate the expression
        try {
            if ((operand0 instanceof Literal) && (operand1 instanceof Literal)) {
                Value v = Value.asValue(evaluateItem(visitor.getStaticContext().makeEarlyEvaluationContext()));
                return Literal.makeLiteral(v);
            }
        } catch (XPathException err) {
            // if early evaluation fails, suppress the error: the value might
            // not be needed at run-time
View Full Code Here

        operand0 = visitor.optimize(operand0, contextItemType);
        operand1 = visitor.optimize(operand1, contextItemType);
        // if both operands are known, pre-evaluate the expression
        try {
            if ((operand0 instanceof Literal) && (operand1 instanceof Literal)) {
                Value v = Value.asValue(evaluateItem(visitor.getStaticContext().makeEarlyEvaluationContext()));
                return Literal.makeLiteral(v);
            }
        } catch (XPathException err) {
            // if early evaluation fails, suppress the error: the value might
            // not be needed at run-time
View Full Code Here

    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
View Full Code Here

            StructuredQName qName, SequenceType type, ValueRepresentation value, boolean external)
            throws XPathException {
        if (value == null && !external) {
            throw new NullPointerException("No initial value for declared variable");
        }
        Value val = Value.asValue(value);
        if (!type.matches(val, getConfiguration())) {
            throw new XPathException("Value of declared variable does not match its type");
        }
        GlobalVariableDefinition var = new GlobalVariableDefinition();
        var.setVariableQName(qName);
View Full Code Here

        final SequenceType type = getRequiredType();
        Iterator iter = references.iterator();
        while (iter.hasNext()) {
            BindingReference ref = (BindingReference)iter.next();
            ref.fixup(var);
            Value constantValue = null;
            int properties = 0;
            Expression select = value;
            if (select instanceof Literal && !isParameter) {
                // 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
View Full Code Here

                try {
                    final TypeHierarchy th = visitor.getConfiguration().getTypeHierarchy();
                    final ItemType itemType = value.getItemType(th);
                    final int cardinality = value.getCardinality();
                    var.setRequiredType(SequenceType.makeSequenceType(itemType, cardinality));
                    Value constantValue = null;
                    if (value2 instanceof Literal) {
                        constantValue = ((Literal)value2).getValue();
                    }
                    for (Iterator iter = references.iterator(); iter.hasNext(); ) {
                        BindingReference ref = ((BindingReference)iter.next());
View Full Code Here

TOP

Related Classes of net.sf.saxon.value.Value

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.