Package client.net.sf.saxon.ce.expr.instruct

Examples of client.net.sf.saxon.ce.expr.instruct.FixedAttribute


                        undeclaredNamespaceError(parts[0], "XTSE0280");
                        return null;
                    }
                }
                int nameCode = getNamePool().allocate(parts[0], nsuri, parts[1]);
                FixedAttribute inst = new FixedAttribute(nameCode);
                inst.setContainer(this);     // temporarily
                compileContent(exec, decl, inst, separator);
                if (LogConfiguration.loggingIsEnabled() && LogController.traceIsEnabled()) {
                  inst.AddTraceProperty("name", attributeName);
                }
                return inst;
            } else if (namespace instanceof StringLiteral) {
                String nsuri = ((StringLiteral)namespace).getStringValue();
                if (nsuri.equals("")) {
                    parts[0] = "";
                } else if (parts[0].equals("")) {
                    // Need to choose an arbitrary prefix
                    // First see if the requested namespace is declared in the stylesheet
                    AxisIterator iter = iterateAxis(Axis.NAMESPACE);
                    while (true) {
                        NodeInfo ns = (NodeInfo)iter.next();
                        if (ns == null) {
                            break;
                        }
                        if (ns.getStringValue().equals(nsuri)) {
                            parts[0] = ns.getLocalPart();
                            break;
                        }
                    }
                    // Otherwise see the URI is known to the namepool
                    if (parts[0].equals("")) {
                        String p = getNamePool().suggestPrefixForURI(
                                ((StringLiteral)namespace).getStringValue());
                        if (p != null) {
                            parts[0] = p;
                        }
                    }
                    // Otherwise choose something arbitrary. This will get changed
                    // if it clashes with another attribute
                    if (parts[0].equals("")) {
                        parts[0] = "ns0";
                    }
                }
                int nameCode = getNamePool().allocate(parts[0], nsuri, parts[1]);
                FixedAttribute inst = new FixedAttribute(nameCode);
                compileContent(exec, decl, inst, separator);
                if (LogConfiguration.loggingIsEnabled() && LogController.traceIsEnabled()) {
                  inst.AddTraceProperty("name", attributeName);
                }
                return inst;
            }
        } else {
            // if the namespace URI must be deduced at run-time from the attribute name
            // prefix, we need to save the namespace context of the instruction

            if (namespace==null) {
                nsContext = this;
            }
        }

        ComputedAttribute inst = new ComputedAttribute( attributeName, namespace, nsContext);
        compileContent(exec, decl, inst, separator);
        if (LogConfiguration.loggingIsEnabled() && LogController.traceIsEnabled()) {
          inst.AddTraceProperty("name", attributeName);
        }
        return inst;
    }
View Full Code Here

TOP

Related Classes of client.net.sf.saxon.ce.expr.instruct.FixedAttribute

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.