Package net.sf.saxon.expr

Examples of net.sf.saxon.expr.Expression


    * Simplify and validate.
    * This is a pure function so it can be simplified in advance if the arguments are known
    */

     public Expression simplify(StaticContext env) throws XPathException {
        Expression e = simplifyArguments(env);

        // compile the regular expression once if possible
        if (!(e instanceof Value)) {
            regexp = Matches.tryToCompile(argument, 1, 3);

View Full Code Here


    public Expression bind(int nameCode, String uri, String local, Expression[] staticArgs)
            throws XPathException {
        for (Iterator it=libraryList.iterator(); it.hasNext();) {
            FunctionLibrary lib = (FunctionLibrary)it.next();
            Expression func = lib.bind(nameCode, uri, local, staticArgs);
            if (func != null) {
                return func;
            }
        }
        return null;
View Full Code Here

        return stackFrameMap;
    }

    public Expression compile(Executable exec) throws TransformerConfigurationException {
        if (referenceCount > 0 ) {
            Expression body = new Block();
            compileChildren(exec, (Block)body, true);

            if (getConfiguration().getTraceListener() != null) {
                TraceWrapper trace = new TraceInstruction(body, this);
                trace.setLocationId(allocateLocationId(getSystemId(), getLineNumber()));
                trace.setParentExpression(procedure);
                body = trace;
            }

            try {
                procedure.setUseAttributeSets(useAttributeSets);
                procedure.setNameCode(getObjectNameCode());
                procedure.setBody(body.simplify(getStaticContext()));
                procedure.setStackFrameMap(stackFrameMap);
                procedure.setSystemId(getSystemId());
                procedure.setLineNumber(getLineNumber());
                procedure.setExecutable(exec);
            } catch (XPathException e) {
View Full Code Here

            } else if (f==StandardNames.TYPE) {
                typeAtt = atts.getValue(a).trim();
            } else if (fans.contains(f) || !(f.startsWith("{}"))) {
                // this is a serialization attribute
                String val = atts.getValue(a).trim();
                Expression exp = makeAttributeValueTemplate(val);
                serializationAttributes.put(new Integer(nc&0xfffff), exp);
          } else {
            checkUnknownAttribute(nc);
          }
        }
View Full Code Here

        }
        href = typeCheck("href", href);
        Iterator it = serializationAttributes.keySet().iterator();
        while (it.hasNext()) {
            Integer fp = (Integer)it.next();
            final Expression exp1 = (Expression)serializationAttributes.get(fp);
            final Expression exp2 = typeCheck(getNamePool().getDisplayName(fp.intValue()), exp1);
            if (exp1 != exp2) {
                serializationAttributes.put(fp, exp2);
            }
        }
    }
View Full Code Here

        ArrayList fixed = new ArrayList();
        boolean needsNamespaceContext = false;
        for (Iterator it=serializationAttributes.keySet().iterator(); it.hasNext();) {
            Integer fp = (Integer)it.next();
            Expression exp = (Expression)serializationAttributes.get(fp);
            if (exp instanceof StringValue) {
                String s = ((StringValue)exp).getStringValue();
                try {
                    ResultDocument.setSerializationProperty(props, fp.intValue(), s,
                            getNamePool(), getStaticContext().getNamespaceResolver());
View Full Code Here

        if (serializationAttributes.size() > 0) {
            props = new Properties(outputProperties);
            final NamePool namePool = context.getController().getNamePool();
            for (Iterator it = serializationAttributes.keySet().iterator(); it.hasNext();) {
                Integer key = (Integer) it.next();
                Expression exp = (Expression) serializationAttributes.get(key);
                String value = exp.evaluateAsString(context);
                try {
                    setSerializationProperty(props, key.intValue(), value, namePool, nsResolver);
                } catch (DynamicError e) {
                    e.setXPathContext(context);
                    e.setLocator(getSourceLocator());
View Full Code Here

        select = typeCheck("select", select);
    }

    public Expression compile(Executable exec) throws TransformerConfigurationException {
        SortKeyDefinition[] sortKeys = makeSortKeys();
        Expression sortedSequence = select;
        if (sortKeys != null) {
            sortedSequence = new SortExpression(select, sortKeys);
            ExpressionTool.makeParentReferences(sortedSequence);
        }
        Block block = new Block();
View Full Code Here

        // System.err.println("SortKeyDefinition.reduce()"); sortKey.display(10);

        FixedSortKeyDefinition sknew = new FixedSortKeyDefinition();

        Expression sortKey2 = sortKey;

        sknew.setSortKey(sortKey2);
        sknew.setOrder((StringValue)order.evaluateItem(context));
        sknew.setDataTypeExpression((StringValue)dataTypeExpression.evaluateItem(context));
        sknew.setCaseOrder((StringValue)caseOrder.evaluateItem(context));
View Full Code Here

    public Iterator iterateSubExpressions() {
        List list = new ArrayList(8);
        list.add(select);
        for (int i=0; i<sortKeys.length; i++) {
            list.add(sortKeys[i].getSortKey());
            Expression e = sortKeys[i].order;
            if (e != null && !(e instanceof Value)) {
                list.add(e);
            }
            e = sortKeys[i].caseOrder;
            if (e != null && !(e instanceof Value)) {
View Full Code Here

TOP

Related Classes of net.sf.saxon.expr.Expression

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.