private static StructuredQName getStructuredQName(String vName) { //return new StructuredQName(qname.getPrefix(), qname.getNamespaceURI(), qname.getLocalPart()); return StructuredQName.fromClarkName(vName); }
/** * Set the initial mode for the transformation. * <p> * XSLT 2.0 allows a transformation to be started in a mode other than the default mode. * The transformation then starts by looking for the template rule in this mode that best * matches the initial context node. * <p> * This method may eventually be superseded by a standard JAXP method. * * @param expandedModeName the name of the initial mode. The mode is * supplied as an expanded QName, that is "localname" if there is no * namespace, or "{uri}localname" otherwise * @since 8.4 */ public void setInitialMode(String expandedModeName) { if (expandedModeName==null) return; if (expandedModeName.length() == 0) return; initialMode = StructuredQName.fromClarkName(expandedModeName); }
/** * Set the initial mode for the transformation. * <p> * XSLT 2.0 allows a transformation to be started in a mode other than the default mode. * The transformation then starts by looking for the template rule in this mode that best * matches the initial context node. * <p> * This method may eventually be superseded by a standard JAXP method. * * @param expandedModeName the name of the initial mode. The mode is * supplied as an expanded QName, that is "localname" if there is no * namespace, or "{uri}localname" otherwise * @since 8.4 */ public void setInitialMode(String expandedModeName) { if (expandedModeName==null) return; if (expandedModeName.length() == 0) return; initialMode = StructuredQName.fromClarkName(expandedModeName); }
/** * Set output properties, from a {@link Properties} object. The keys in the supplied * {@code Properties} object are QNames in Clark format, that is "{uri}local"; any QNames * within the values must also be in this format. * The values supplied are typically those specified in the stylesheet or query. In the case of XSLT, * they are typically the properties associated with unnamed xsl:output declarations. * * @param suppliedProperties the output properties to be used. These overwrite any properties * that have been individually specified using * {@link #setOutputProperty(Property, String)} setOutputProperty} */ public void setOutputProperties(Properties suppliedProperties) { for (String name : suppliedProperties.stringPropertyNames()) { properties.put(StructuredQName.fromClarkName(name), suppliedProperties.getProperty(name)); } }
/** * Set output properties, from a {@link Properties} object. The keys in the supplied * {@code Properties} object are QNames in Clark format, that is "{uri}local"; any QNames * within the values must also be in this format. * The values supplied are typically those specified in the stylesheet or query. In the case of XSLT, * they are typically the properties associated with unnamed xsl:output declarations. * * @param suppliedProperties the output properties to be used. These overwrite any properties * that have been individually specified using * {@link #setOutputProperty(Property, String)} setOutputProperty} */ public void setOutputProperties(Properties suppliedProperties) { for (String name : suppliedProperties.stringPropertyNames()) { properties.put(StructuredQName.fromClarkName(name), suppliedProperties.getProperty(name)); } }
/** * Get a parameter to the transformation. This returns the value of a parameter * that has been previously set using the {@link #setParameter} method. The value * is returned exactly as supplied, that is, before any conversion to an XPath value. * * @param expandedName the name of the required parameter, in * "{uri}local-name" format * @return the value of the parameter, if it exists, or null otherwise */ public Object getParameter(String expandedName) { if (parameters==null) { return null; } return parameters.get(StructuredQName.fromClarkName(expandedName)); }
/** * Get a parameter to the transformation. This returns the value of a parameter * that has been previously set using the {@link #setParameter} method. The value * is returned exactly as supplied, that is, before any conversion to an XPath value. * * @param expandedName the name of the required parameter, in * "{uri}local-name" format * @return the value of the parameter, if it exists, or null otherwise */ public Object getParameter(String expandedName) { if (parameters==null) { return null; } return parameters.get(StructuredQName.fromClarkName(expandedName)); }
/** * Extract the list of CDATA elements from the output properties * * @param details the output properties */ private void getCdataElements(Properties details) { boolean isHTML = "html".equals(details.getProperty(OutputKeys.METHOD)); boolean isHTML5 = isHTML && "5.0".equals(details.getProperty(OutputKeys.VERSION)); boolean isHTML4 = isHTML && !isHTML5; String cdata = details.getProperty(OutputKeys.CDATA_SECTION_ELEMENTS); if (cdata == null) { // this doesn't happen, but there's no harm allowing for it nameList = new HashSet<NodeName>(0); return; } nameList = new HashSet<NodeName>(10); StringTokenizer st2 = new StringTokenizer(cdata, " \t\n\r", false); while (st2.hasMoreTokens()) { String expandedName = st2.nextToken(); StructuredQName sq = StructuredQName.fromClarkName(expandedName); String uri = sq.getURI(); if (!isHTML || (isHTML4 && !uri.equals("")) || (isHTML5 && !uri.equals("") && !uri.equals(NamespaceConstant.XHTML))) { nameList.add(new FingerprintedQName("", sq.getURI(), sq.getLocalPart())); } } }
/** * Extract the list of CDATA elements from the output properties * * @param details the output properties */ private void getCdataElements(Properties details) { boolean isHTML = "html".equals(details.getProperty(OutputKeys.METHOD)); boolean isHTML5 = isHTML && "5.0".equals(details.getProperty(OutputKeys.VERSION)); boolean isHTML4 = isHTML && !isHTML5; String cdata = details.getProperty(OutputKeys.CDATA_SECTION_ELEMENTS); if (cdata == null) { // this doesn't happen, but there's no harm allowing for it nameList = new HashSet<NodeName>(0); return; } nameList = new HashSet<NodeName>(10); StringTokenizer st2 = new StringTokenizer(cdata, " \t\n\r", false); while (st2.hasMoreTokens()) { String expandedName = st2.nextToken(); StructuredQName sq = StructuredQName.fromClarkName(expandedName); String uri = sq.getURI(); if (!isHTML || (isHTML4 && !uri.equals("")) || (isHTML5 && !uri.equals("") && !uri.equals(NamespaceConstant.XHTML))) { nameList.add(new FingerprintedQName("", sq.getURI(), sq.getLocalPart())); } } }
private void setProp(int propertyCode, String value, int precedence) throws XPathException { try { symbols.setProperty(propertyCode, value, precedence); } catch (XPathException err) { String attName = DecimalSymbols.propertyNames[propertyCode]; err.setLocation(new AttributeLocation(this, StructuredQName.fromClarkName(attName))); throw err; } }
private void setProp(int propertyCode, String value, int precedence) throws XPathException { try { symbols.setProperty(propertyCode, value, precedence); } catch (XPathException err) { String attName = DecimalSymbols.propertyNames[propertyCode]; err.setLocation(new AttributeLocation(this, StructuredQName.fromClarkName(attName))); throw err; } }
/** * Compile time error, specifying an error code and the name of the attribute that * is in error. * * @param message the error message * @param errorCode the error code. May be null if not known or not defined * @param attributeName the name of the attribute. For attributes in no namespace * this is the local part of the name; for namespaced attributes * a name in Clark format may be supplied. */ public void compileErrorInAttribute(String message, String errorCode, String attributeName) { StructuredQName att = StructuredQName.fromClarkName(attributeName); Location location = new AttributeLocation(this, att); compileError(new XPathException(message, errorCode, location)); }
while (st.hasMoreTokens()) { String expandedName = st.nextToken(); StructuredQName qName = StructuredQName.fromClarkName(expandedName); IntHashMap map = (IntHashMap)characterMapIndex.get(qName); if (map==null) {
/** * Compile time error, specifying an error code and the name of the attribute that * is in error. * * @param message the error message * @param errorCode the error code. May be null if not known or not defined * @param attributeName the name of the attribute. For attributes in no namespace * this is the local part of the name; for namespaced attributes * a name in Clark format may be supplied. */ public void compileErrorInAttribute(String message, String errorCode, String attributeName) { StructuredQName att = StructuredQName.fromClarkName(attributeName); Location location = new AttributeLocation(this, att); compileError(new XPathException(message, errorCode, location)); }
while (st.hasMoreTokens()) { String expandedName = st.nextToken(); StructuredQName qName = StructuredQName.fromClarkName(expandedName); CharacterMap map = getCharacterMap(qName); if (map == null) {
/** * Process the QName of the variable. Validate the name and place it in the "name" field; * if invalid, construct an error message and place a dummy name in the "name" field for * recovery purposes. * * @param nameAttribute the lexical QName * @throws XPathException if the name is invalid */ private void processVariableName(String nameAttribute) throws XPathException { try { if (nameAttribute != null) { name = sourceElement.makeQName(nameAttribute); } } catch (XPathException err) { name = errorName(); StructuredQName n = StructuredQName.fromClarkName("name"); throw new XPathException("Invalid variable name: " + err.getMessage() + (nameAttribute.startsWith("$") ? " (No '$' sign needed)" : ""), "XTSE0020", new AttributeLocation(sourceElement, n)); } }
/** * Process the QName of the variable. Validate the name and place it in the "name" field; * if invalid, construct an error message and place a dummy name in the "name" field for * recovery purposes. * * @param nameAttribute the lexical QName * @throws XPathException if the name is invalid */ private void processVariableName(String nameAttribute) throws XPathException { try { if (nameAttribute != null) { name = sourceElement.makeQName(nameAttribute); } } catch (XPathException err) { name = errorName(); StructuredQName n = StructuredQName.fromClarkName("name"); throw new XPathException("Invalid variable name: " + err.getMessage() + (nameAttribute.startsWith("$") ? " (No '$' sign needed)" : ""), "XTSE0020", new AttributeLocation(sourceElement, n)); } }
} catch (XPathException err) { setObjectName(new StructuredQName("", "", "attribute-set-error-name")); err.setLocation(new AttributeLocation(this, StructuredQName.fromClarkName("name"))); throw err;
return; StructuredQName qName = StructuredQName.fromClarkName(expandedName); Template t = getExecutable().getNamedTemplate(qName); if (t == null) {
return; StructuredQName qName = StructuredQName.fromClarkName(expandedName); Template t = getExecutable().getNamedTemplate(qName); if (t == null) {