Package net.sf.saxon.value

Examples of net.sf.saxon.value.StringValue


            attributeName = makeAttributeValueTemplate(nameAtt);
            if (attributeName instanceof StringValue) {
                if (!Name.isQName(nameAtt)) {
                    compileError("Attribute name is not a valid QName");
                    // prevent a duplicate error message...
                    attributeName = new StringValue("saxon-error-attribute");
                }
            }
        }

        if (namespaceAtt!=null) {
            namespace = makeAttributeValueTemplate(namespaceAtt);
        }

        if (selectAtt!=null) {
            select = makeExpression(selectAtt);
        }

        if (separatorAtt == null) {
            if (selectAtt == null) {
                separator = StringValue.EMPTY_STRING;
            } else {
                separator = new StringValue(" ");
            }
        } else {
            separator = makeAttributeValueTemplate(separatorAtt);
        }
View Full Code Here


    /**
    * Evaluate in a general context
    */

    public Item evaluateItem(XPathContext c) throws XPathException {
        return new StringValue(evaluateAsString(c));
    }
View Full Code Here

                }
                return new QNameValue(node.getNamePool(), nc);
            default:
                throw new UnsupportedOperationException("Unknown name operation");
        }
        return new StringValue(s);
    }
View Full Code Here

        }

        // fast path for the simple case

        if (vec == null && format == null && gpsize == 0 && lang == null) {
            return new StringValue("" + value);
        }

        // Use the numberer decided at compile time if possible; otherwise try to get it from
        // a table of numberers indexed by language; if not there, load the relevant class and
        // add it to the table.
        Numberer numb = numberer;
        if (numb == null) {
            String language = lang.evaluateAsString(context);
            if (nationalNumberers == null) {
                nationalNumberers = new HashMap(4);
            }
            numb = (Numberer)nationalNumberers.get(language);
            if (numb == null) {
                numb = makeNumberer(language);
                nationalNumberers.put(language, numb);
            }
        }

        if (letterValue == null) {
            letterVal = "";
        } else {
            letterVal = letterValue.evaluateAsString(context);
            if (!("alphabetic".equals(letterVal) || "traditional".equals(letterVal))) {
                DynamicError e = new DynamicError("letter-value must be \"traditional\" or \"alphabetic\"");
                e.setXPathContext(context);
                e.setErrorCode("XT0030");
                throw e;
            }
        }

        if (vec == null) {
            vec = new ArrayList(1);
            vec.add(new Long(value));
        }

        NumberFormatter nf;
        if (formatter == null) {              // format not known until run-time
            nf = new NumberFormatter();
            nf.prepare(format.evaluateAsString(context));
        } else {
            nf = formatter;
        }

        String s = nf.format(vec, gpsize, gpseparator, letterVal, ordinalVal, numb);
        return new StringValue(s);
    }
View Full Code Here

    /**
    * Evaluate in a general context
    */

    public Item evaluateItem(XPathContext c) throws XPathException {
        return new StringValue(asString(c));
    }
View Full Code Here

            return collation;
        } else {
            int numargs = argument.length;
            if (numargs > arg) {
                AtomicValue av = (AtomicValue)argument[arg].evaluateItem(context);
                StringValue collationValue = (StringValue)av.getPrimitiveValue();
                String collationName = collationValue.getStringValue();
                return context.getCollation(collationName);
            } else if (useDefault) {
                Comparator collator = context.getDefaultCollation();
                return (collator==null ? CodepointCollator.getInstance() : collator);
            } else {
View Full Code Here

            NodeInfo ns = (NodeInfo)nsNodes.next();
            if (ns == null) {
                break;
            }
            if (ns.getLocalPart().equals(prefix)) {
                return new StringValue(ns.getStringValue());
            }
        }
        return null;
    }
View Full Code Here

    public Item evaluateItem(XPathContext c) throws XPathException {
        NodeInfo node = (NodeInfo)argument[0].evaluateItem(c);
        if (node==null) {
            return null;
        }
        return new StringValue(node.getBaseURI());
    }
View Full Code Here

    * evaluateItem() handles evaluation of the function:
    * it returns a String
    */

    public Item evaluateItem(XPathContext context) throws XPathException {
        StringValue hrefVal = (StringValue)argument[0].evaluateItem(context);
        if (hrefVal == null) {
            return null;
        }
        String href = hrefVal.getStringValue();

        String encoding = argument[1].evaluateItem(context).getStringValue();

        return new StringValue(
                    readFile(href, expressionBaseURI, encoding)
                   );
    }
View Full Code Here

            result = Value.convertJavaObjectToXPath(value, this);
            if (result==null) {
                result = EmptySequence.getInstance();
            }
        } catch (XPathException err) {
            result = new StringValue(value.toString());
        }
        int fingerprint = namePool.allocateClarkName(expandedName);
        parameters.put(fingerprint, result);

    }
View Full Code Here

TOP

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

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.