/** * Construct a dummy parameter argument, with no QName and no * value (either expression string or value XObject). isVisible * defaults to true. */ public Arg() { m_qname = new QName(""); ; // so that string compares can be done. m_val = null; m_expression = null; m_isVisible = true; m_isFromWithParam = false; }
/** * Get the "name" attribute. * If there is a name attribute, then the element declares a named * decimal-format; otherwise, it declares the default decimal-format. * * @return the value of the "name" attribute. */ public QName getName() { if (m_qname == null) return new QName(""); else return m_qname; }
/** * Get the "name" attribute. * If there is a name attribute, then the element declares a named * decimal-format; otherwise, it declares the default decimal-format. * * @return the value of the "name" attribute. */ public QName getName() { if (m_qname == null) return new QName(""); else return m_qname; }
/** * Construct a dummy parameter argument, with no QName and no * value (either expression string or value XObject). isVisible * defaults to true. */ public Arg() { m_qname = new QName(""); ; // so that string compares can be done. m_val = null; m_expression = null; m_isVisible = true; m_isFromWithParam = false; }
/** * Given a string, create and return a QName object * * * @param name String to use to create QName * * @return a QName object */ public static QName getQNameFromString(String name) { StringTokenizer tokenizer = new StringTokenizer(name, "{}", false); QName qname; String s1 = tokenizer.nextToken(); String s2 = tokenizer.hasMoreTokens() ? tokenizer.nextToken() : null; if (null == s2) qname = new QName(null, s1); else qname = new QName(s1, s2); return qname; }
/** * Given a string, create and return a QName object * * * @param name String to use to create QName * * @return a QName object */ public static QName getQNameFromString(String name) { StringTokenizer tokenizer = new StringTokenizer(name, "{}", false); QName qname; String s1 = tokenizer.nextToken(); String s2 = tokenizer.hasMoreTokens() ? tokenizer.nextToken() : null; if (null == s2) qname = new QName(null, s1); else qname = new QName(s1, s2); return qname; }
/** * Set a foreign property from the attribute value. * @param newValue non-null reference to attribute value. */ public void addLiteralResultAttribute(String attrUri, String attrLocalName, String attrRawName, String attrValue) { QName key = new QName(attrUri, attrLocalName); m_outputProperties.setProperty(key, attrValue); }
/** * Set a foreign property from the attribute value. * @param newValue non-null reference to attribute value. */ public void setForeignAttr(String attrUri, String attrLocalName, String attrRawName, String attrValue) { QName key = new QName(attrUri, attrLocalName); m_outputProperties.setProperty(key, attrValue); }
/** * Set a foreign property from the attribute value. * @param newValue non-null reference to attribute value. */ public void setForeignAttr(String attrUri, String attrLocalName, String attrRawName, String attrValue) { QName key = new QName(attrUri, attrLocalName); m_outputProperties.setProperty(key, attrValue); }
/** * Set a foreign property from the attribute value. * @param newValue non-null reference to attribute value. */ public void addLiteralResultAttribute(String attrUri, String attrLocalName, String attrRawName, String attrValue) { QName key = new QName(attrUri, attrLocalName); m_outputProperties.setProperty(key, attrValue); }
qnames.addElement(new QName(tokenizer.nextToken(), handler));
/** * Get the ElemExsltFunction element associated with the * function. * * @param funcName Local name of the function. * @return the ElemExsltFunction element associated with * the function, null if none exists. */ public ElemExsltFunction getFunction(String funcName) { QName qname = new QName(m_namespace, funcName); ElemTemplate templ = m_stylesheet.getTemplateComposed(qname); if (templ != null && templ instanceof ElemExsltFunction) return (ElemExsltFunction) templ; else return null; }
/** * Construct an instance of XSLTElementDef. * * @param namespace The Namespace URI, "*", or null. * @param name The local name (without prefix), "*", or null. * @param nameAlias A potential alias for the name, or null. * @param elements An array of allowed child element defs, or null. * @param attributes An array of allowed attribute defs, or null. * @param contentHandler The element processor for this element. * @param classObject The class of the object that this element def should produce. */ XSLTElementDef(XSLTSchema schema, String namespace, String name, String nameAlias, XSLTElementDef[] elements, XSLTAttributeDef[] attributes, XSLTElementProcessor contentHandler, Class classObject) { build(namespace, name, nameAlias, elements, attributes, contentHandler, classObject); if ( (null != namespace) && (namespace.equals(Constants.S_XSLNAMESPACEURL) || namespace.equals(Constants.S_BUILTIN_EXTENSIONS_URL) || namespace.equals(Constants.S_BUILTIN_OLD_EXTENSIONS_URL))) { schema.addAvailableElement(new QName(namespace, name)); if(null != nameAlias) schema.addAvailableElement(new QName(namespace, nameAlias)); } }
/** * Construct an instance of XSLTElementDef. * * @param namespace The Namespace URI, "*", or null. * @param name The local name (without prefix), "*", or null. * @param nameAlias A potential alias for the name, or null. * @param elements An array of allowed child element defs, or null. * @param attributes An array of allowed attribute defs, or null. * @param contentHandler The element processor for this element. * @param classObject The class of the object that this element def should produce. */ XSLTElementDef(XSLTSchema schema, String namespace, String name, String nameAlias, XSLTElementDef[] elements, XSLTAttributeDef[] attributes, XSLTElementProcessor contentHandler, Class classObject) { build(namespace, name, nameAlias, elements, attributes, contentHandler, classObject); if ( (null != namespace) && (namespace.equals(Constants.S_XSLNAMESPACEURL) || namespace.equals(Constants.S_BUILTIN_EXTENSIONS_URL) || namespace.equals(Constants.S_BUILTIN_OLD_EXTENSIONS_URL))) { schema.addAvailableElement(new QName(namespace, name)); if(null != nameAlias) schema.addAvailableElement(new QName(namespace, nameAlias)); } }
/** * Create a psuedo variable reference that will represent the * shared redundent XPath, and add it to the stylesheet. * * @param psuedoVarRecipient The broadest scope of where the variable * should be inserted, usually an xsl:template or xsl:for-each. * @param lpi The LocationPathIterator that the variable should represent. * @param isGlobal true if the paths are global. * @return The new psuedo var element. */ protected ElemVariable createPseudoVarDecl( ElemTemplateElement psuedoVarRecipient, LocPathIterator lpi, boolean isGlobal) throws org.w3c.dom.DOMException { QName uniquePseudoVarName = new QName (PSUEDOVARNAMESPACE, "#"+getPseudoVarID()); if(isGlobal) { return createGlobalPseudoVarDecl(uniquePseudoVarName, (StylesheetRoot)psuedoVarRecipient, lpi); } else return createLocalPseudoVarDecl(uniquePseudoVarName, psuedoVarRecipient, lpi); }
/** * Create a psuedo variable reference that will represent the * shared redundent XPath, and add it to the stylesheet. * * @param psuedoVarRecipient The broadest scope of where the variable * should be inserted, usually an xsl:template or xsl:for-each. * @param lpi The LocationPathIterator that the variable should represent. * @param isGlobal true if the paths are global. * @return The new psuedo var element. */ protected ElemVariable createPseudoVarDecl( ElemTemplateElement psuedoVarRecipient, LocPathIterator lpi, boolean isGlobal) throws org.w3c.dom.DOMException { QName uniquePseudoVarName = new QName (PSUEDOVARNAMESPACE, "#"+getPseudoVarID()); if(isGlobal) { return createGlobalPseudoVarDecl(uniquePseudoVarName, (StylesheetRoot)psuedoVarRecipient, lpi); } else return createLocalPseudoVarDecl(uniquePseudoVarName, psuedoVarRecipient, lpi); }
/** * Set a parameter for the templates. * * @param name The name of the parameter. * @param namespace The namespace of the parameter. * @param value The value object. This can be any valid Java object * -- it's up to the processor to provide the proper * coersion to the object, or simply pass it on for use * in extensions. */ public void setParameter(String name, String namespace, Object value) { VariableStack varstack = getXPathContext().getVarStack(); QName qname = new QName(namespace, name); XObject xobject = XObject.create(value, getXPathContext()); StylesheetRoot sroot = m_stylesheetRoot; Vector vars = sroot.getVariablesAndParamsComposed(); int i = vars.size(); while (--i >= 0) { ElemVariable variable = (ElemVariable)vars.elementAt(i); if(variable.getXSLToken() == Constants.ELEMNAME_PARAMVARIABLE && variable.getName().equals(qname)) { varstack.setGlobalVariable(i, xobject); } } }
/** * Compile a variable reference. * * @param opPos The current position in the m_opMap array. * * @return reference to {@link org.apache.xpath.operations.Variable} instance. * * @throws TransformerException if a error occurs creating the Expression. */ protected Expression variable(int opPos) throws TransformerException { Variable var = new Variable(); opPos = getFirstChildPos(opPos); int nsPos = getOp(opPos); java.lang.String namespace = (OpCodes.EMPTY == nsPos) ? null : (java.lang.String) getTokenQueue().elementAt(nsPos); java.lang.String localname = (java.lang.String) getTokenQueue().elementAt(getOp(opPos+1)); QName qname = new QName(namespace, localname); var.setQName(qname); return var; }
/** * Compile a variable reference. * * @param opPos The current position in the m_opMap array. * * @return reference to {@link org.apache.xpath.operations.Variable} instance. * * @throws TransformerException if a error occurs creating the Expression. */ protected Expression variable(int opPos) throws TransformerException { Variable var = new Variable(); opPos = getFirstChildPos(opPos); int nsPos = getOp(opPos); java.lang.String namespace = (OpCodes.EMPTY == nsPos) ? null : (java.lang.String) getTokenQueue().elementAt(nsPos); java.lang.String localname = (java.lang.String) getTokenQueue().elementAt(getOp(opPos+1)); QName qname = new QName(namespace, localname); var.setQName(qname); return var; }