Examples of DecimalFormatManager


Examples of client.net.sf.saxon.ce.trans.DecimalFormatManager

        checked = true;
        super.checkArguments(visitor);
        decimalFormatManager = env.getDecimalFormatManager();
        if (decimalFormatManager == null) {
            // create a decimal format manager which will allow a "default default" format only
            decimalFormatManager = new DecimalFormatManager();
        }
        if (argument[1] instanceof StringLiteral) {
            // picture is known statically - optimize for this common case
            picture = ((StringLiteral)argument[1]).getStringValue();
        }
View Full Code Here

Examples of client.net.sf.saxon.ce.trans.DecimalFormatManager

            av0 = DoubleValue.NaN;
        }
        NumericValue number = (NumericValue)av0;

        if (dfs == null) {
            DecimalFormatManager dfm = decimalFormatManager;
            if (numArgs==2) {
                dfs = dfm.getDefaultDecimalFormat();
            } else {
                // the decimal-format name was given as a run-time expression
                String lexicalName = argument[2].evaluateItem(context).getStringValue();
                StructuredQName qName = null;
                try {
                    qName = StructuredQName.fromLexicalQName(lexicalName, false, nsContext);
                } catch (XPathException e) {
                    dynamicError("Invalid decimal format name. " + e.getMessage(), "XTDE1280", context);
                }

                dfs = dfm.getNamedDecimalFormat(qName);
                if (dfs==null) {
                    dynamicError("format-number function: decimal-format '" + lexicalName + "' is not defined", "XTDE1280", context);
                }
            }
        }
View Full Code Here

Examples of client.net.sf.saxon.ce.trans.DecimalFormatManager

    public void index(Declaration decl, PrincipalStylesheetModule top) throws XPathException
    {
        prepareAttributes();
        DecimalSymbols d = makeDecimalFormatSymbols();
        DecimalFormatManager dfm = getPreparedStylesheet().getDecimalFormatManager();
        if (name==null) {
            try {
                dfm.setDefaultDecimalFormat(d, decl.getPrecedence());
            } catch (XPathException err) {
                compileError(err.getMessage(), err.getErrorCodeQName());
            }
        } else {
            try {
                StructuredQName formatName = makeQName(name);
                try {
                    dfm.setNamedDecimalFormat(formatName, d, decl.getPrecedence());
                } catch (XPathException err) {
                    compileError(err.getMessage(), err.getErrorCodeQName());
                }
            } catch (XPathException err) {
                compileError("Invalid decimal format name. " + err.getMessage(), "XTSE0020");
View Full Code Here

Examples of client.net.sf.saxon.ce.trans.DecimalFormatManager

     * @return the DecimalFormatManager containing the named xsl:decimal-format definitions
     */

    public DecimalFormatManager getDecimalFormatManager() {
        if (decimalFormatManager == null) {
            decimalFormatManager = new DecimalFormatManager();
        }
        return decimalFormatManager;
    }
View Full Code Here

Examples of net.sf.saxon.trans.DecimalFormatManager

        checked = true;
        super.checkArguments(visitor);
        decimalFormatManager = env.getDecimalFormatManager();
        if (decimalFormatManager == null) {
            // create a decimal format manager which will allow a "default default" format only
            decimalFormatManager = new DecimalFormatManager();
        }
        if (argument[1] instanceof StringLiteral) {
            // picture is known statically - optimize for this common case
            picture = ((StringLiteral)argument[1]).getStringValue();
        }
View Full Code Here

Examples of net.sf.saxon.trans.DecimalFormatManager

            av0 = DoubleValue.NaN;
        }
        NumericValue number = (NumericValue)av0;

        if (dfs == null) {
            DecimalFormatManager dfm = decimalFormatManager;
            if (numArgs==2) {
                dfs = dfm.getDefaultDecimalFormat();
            } else {
                // the decimal-format name was given as a run-time expression
                String lexicalName = argument[2].evaluateItem(context).getStringValue();
                StructuredQName qName = null;
                try {
                    qName = StructuredQName.fromLexicalQName(lexicalName, false,
                        context.getConfiguration().getNameChecker(), nsContext);
                } catch (XPathException e) {
                    XPathException err = new XPathException("Invalid decimal format name. " + e.getMessage());
                    err.setErrorCode("XTDE1280");
                    err.setLocator(this);
                    err.setXPathContext(context);
                    throw err;
                }

                dfs = dfm.getNamedDecimalFormat(qName);
                if (dfs==null) {
                    XPathException err = new XPathException("format-number function: decimal-format '" + lexicalName + "' is not defined");
                    err.setErrorCode("XTDE1280");
                    err.setLocator(this);
                    err.setXPathContext(context);
View Full Code Here

Examples of net.sf.saxon.trans.DecimalFormatManager

     *         formats are not supported in this environment.
     */

    public DecimalFormatManager getDecimalFormatManager() {
        if (decimalFormatManager == null) {
            decimalFormatManager = new DecimalFormatManager();
        }
        return decimalFormatManager;
    }
View Full Code Here

Examples of net.sf.saxon.trans.DecimalFormatManager

    public void index(XSLStylesheet top) throws XPathException
    {
        prepareAttributes();
        DecimalSymbols d = makeDecimalFormatSymbols();
        DecimalFormatManager dfm = getPreparedStylesheet().getDecimalFormatManager();
        if (name==null) {
            try {
                dfm.setDefaultDecimalFormat(d, getPrecedence());
            } catch (XPathException err) {
                compileError(err.getMessage(), err.getErrorCodeQName());
            }
        } else {
            try {
                StructuredQName formatName = makeQName(name);
                try {
                    dfm.setNamedDecimalFormat(formatName, d, getPrecedence());
                } catch (XPathException err) {
                    compileError(err.getMessage(), err.getErrorCodeQName());
                }
            } catch (XPathException err) {
                compileError("Invalid decimal format name. " + err.getMessage(), "XTSE0020");
View Full Code Here

Examples of net.sf.saxon.trans.DecimalFormatManager

     * @return the DecimalFormatManager containing the named xsl:decimal-format definitions
     */

    public DecimalFormatManager getDecimalFormatManager() {
        if (decimalFormatManager == null) {
            decimalFormatManager = new DecimalFormatManager();
        }
        return decimalFormatManager;
    }
View Full Code Here

Examples of net.sf.saxon.trans.DecimalFormatManager

    */

    public String evaluateAsString(XPathContext context) throws XPathException {
        int numArgs = argument.length;
        Controller ctrl = context.getController();
        DecimalFormatManager dfm = ctrl.getDecimalFormatManager();
        DecimalFormatSymbols dfs;

        AtomicValue av0 = (AtomicValue)argument[0].evaluateItem(context);
        NumericValue number = (NumericValue)av0.getPrimitiveValue();
        String format = argument[1].evaluateItem(context).getStringValue();

        if (numArgs==2) {
            dfs = dfm.getDefaultDecimalFormat();
        } else {
            String uri = dfURI;
            String localName = dfLocalName;
            if (localName==null) {
                // the decimal-format name was given as a run-time expression
                String qname = argument[2].evaluateItem(context).getStringValue();
                if (!Name.isQName(qname)) {
                    DynamicError e = new DynamicError("Decimal format name '" + qname + "' is not a valid QName");
                    e.setXPathContext(context);
                    e.setErrorCode("XT1280");
                    throw e;
                }
                try {
                    String[] parts = Name.getQNameParts(qname);
                    localName = parts[1];
                    uri = nsContext.getURIForPrefix(parts[0], false);
                    if (uri==null) {
                        DynamicError e = new DynamicError("Namespace prefix '" + parts[0] + "' has not been defined");
                        e.setXPathContext(context);
                        e.setErrorCode("XT1280");
                        throw e;
                    }
                } catch (QNameException e) {
                    dynamicError("Invalid decimal format name. " + e.getMessage(), "XT1280", context);
                }
            }
            dfs = dfm.getNamedDecimalFormat(uri, localName);
            if (dfs==null) {
                DynamicError e = new DynamicError(
                    "format-number function: decimal-format '" + localName + "' is not defined");
                e.setXPathContext(context);
                e.setErrorCode("XT1280");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.