/** * Get the name of the property expressed as a QName. * The namespace will be null for standard serialization properties, * and will be the Saxon namespace <code>http://saxon.sf.net/</code> for Saxon extensions * * @return the name of the serialization property as a QName */ public QName getQName() { return QName.fromClarkName(name); }
/** * Get the name of the property expressed as a QName. * The namespace will be null for standard serialization properties, * and will be the Saxon namespace <code>http://saxon.sf.net/</code> for Saxon extensions * * @return the name of the serialization property as a QName */ public QName getQName() { return QName.fromClarkName(name); }
/** * Supply an initial mode for a transformation. * <p>This is a Saxon extension to the JAXP interface, needed for XSLT 2.0</p> * * @param name the name of the initial mode, in Clark notation (either a local name, * or "{uri}local") * @throws IllegalArgumentException if the argument is invalid, for example if the * format of the name is incorrect or if there is no mode with this name */ public void setInitialMode(String name) throws IllegalArgumentException { xsltTransformer.setInitialMode(QName.fromClarkName(name)); }
/** * Supply an initial mode for a transformation. * <p>This is a Saxon extension to the JAXP interface, needed for XSLT 2.0</p> * * @param name the name of the initial mode, in Clark notation (either a local name, * or "{uri}local") * @throws IllegalArgumentException if the argument is invalid, for example if the * format of the name is incorrect or if there is no mode with this name */ public void setInitialMode(String name) throws IllegalArgumentException { xsltTransformer.setInitialMode(QName.fromClarkName(name)); }
/** * Get the initial named template for the transformation, if one has been set * @return the name of the initial template, or null if none has been set */ public QName getInitialTemplate() { String template = controller.getInitialTemplate(); return (template == null ? null : QName.fromClarkName(template)); }
/** * Supply an initial template for a transformation. * <p>This is a Saxon extension to the JAXP interface, needed for XSLT 2.0</p> * <p>Changed in 9.9 so it no longer validates the supplied name; an incorrect name will * lead to an error later.</p> * * @param name the name of the initial template, in Clark notation (either a local name, * or "{uri}local") */ public void setInitialTemplate(String name) { xsltTransformer.setInitialTemplate(QName.fromClarkName(name)); }
/** * Adds the step. * * @param stepProvider * the step provider * @param properties * the properties */ public void addStep(XProcStepProvider stepProvider, Map<?, ?> properties) { QName type = QName.fromClarkName((String) properties.get("type")); logger.debug("Adding step to registry: {}", type.toString()); stepProviders.put(type, stepProvider); }
private void setElementVisibility (ElementVisibility vis, Map<String, String> args) { String qnameList = args.get(vis.name().toLowerCase()); if (qnameList != null) { for (String name : qnameList.split(",")) { QName.fromClarkName(name); // expect the name in Clark notation: {namespace}local-name elVis.put(name, vis); } } }
/** * Supply an initial template for a transformation. * <p>This is a Saxon extension to the JAXP interface, needed for XSLT 2.0</p> * <p>Changed in 9.9 so it no longer validates the supplied name; an incorrect name will * lead to an error later.</p> * * @param name the name of the initial template, in Clark notation (either a local name, * or "{uri}local") */ public void setInitialTemplate(String name) { xsltTransformer.setInitialTemplate(QName.fromClarkName(name)); }
/** * Supply an initial mode for a transformation. * <p>This is a Saxon extension to the JAXP interface, needed for XSLT 2.0</p> * * @param name the name of the initial mode, in Clark notation (either a local name, * or "{uri}local") * @throws IllegalArgumentException if the argument is invalid, for example if the * format of the name is incorrect or if there is no mode with this name */ public void setInitialMode(String name) throws IllegalArgumentException { xsltTransformer.setInitialMode(QName.fromClarkName(name)); }
/** * Supply an initial mode for a transformation. * <p>This is a Saxon extension to the JAXP interface, needed for XSLT 2.0</p> * * @param name the name of the initial mode, in Clark notation (either a local name, * or "{uri}local") * @throws IllegalArgumentException if the argument is invalid, for example if the * format of the name is incorrect or if there is no mode with this name */ public void setInitialMode(String name) throws IllegalArgumentException { xsltTransformer.setInitialMode(QName.fromClarkName(name)); }
/** * Removes the step from the registry * * @param stepProvider * the step provider * @param properties * the properties */ public void removeStep(XProcStepProvider stepProvider, Map<?, ?> properties) { QName type = QName.fromClarkName((String) properties.get("type")); logger.debug("Removing step from registry: {}", type.toString()); stepProviders.remove(type); }
/** * Get the initial mode for the transformation, if one has been set. * @return the initial mode for the transformation. Returns null if no mode has been set, * or if the mode was set to null to represent the default (unnamed) mode */ public QName getInitialMode() { String mode = controller.getInitialMode(); if (mode == null) { return null; } else { return QName.fromClarkName(mode); } }
/** * Set any output properties appearing on the command line in the form {@code !indent=yes} * as properties of the supplied {@code Serializer} * @param serializer the supplied {@code Serializer}, whose serialization properties * are to be modified. */ public void setSerializationProperties(Serializer serializer) { for (Enumeration e = serializationParams.propertyNames(); e.hasMoreElements(); ) { String name = (String) e.nextElement(); String value = serializationParams.getProperty(name); // parameters starting with "!" are taken as output properties // Allow the prefix "!saxon:" instead of "!{http://saxon.sf.net}" if (name.startsWith("saxon:")) { name = "{" + NamespaceConstant.SAXON + "}" + name.substring(6); } serializer.setOutputProperty(QName.fromClarkName(name), value); } }
/** * Set any output properties appearing on the command line in the form {@code !indent=yes} * as properties of the supplied {@code Serializer} * @param serializer the supplied {@code Serializer}, whose serialization properties * are to be modified. */ public void setSerializationProperties(Serializer serializer) { for (Enumeration e = serializationParams.propertyNames(); e.hasMoreElements(); ) { String name = (String) e.nextElement(); String value = serializationParams.getProperty(name); // parameters starting with "!" are taken as output properties // Allow the prefix "!saxon:" instead of "!{http://saxon.sf.net}" if (name.startsWith("saxon:")) { name = "{" + NamespaceConstant.SAXON + "}" + name.substring(6); } serializer.setOutputProperty(QName.fromClarkName(name), value); } }
private void findStepClasses() { Iterable<Class<?>> classes = findClasses(XMLCalabash.class); for (Class<?> klass : classes) { XMLCalabash annotation = klass.getAnnotation(XMLCalabash.class); for (String clarkName: annotation.type().split("\\s+")) { try { QName name = QName.fromClarkName(clarkName); logger.trace("Found step type annotation: " + clarkName); if (implementations.containsKey(name)) { logger.debug("Ignoring step type annotation for configured step: " + clarkName); } implementations.put(name, klass); } catch (IllegalArgumentException iae) { logger.debug("Failed to parse step annotation type: " + clarkName); } } } }
private void findStepClasses() { Iterable<Class<?>> classes = ClassFilter.only().from(ClassIndex.getAnnotated(XMLCalabash.class)); for (Class<?> klass : classes) { XMLCalabash annotation = klass.getAnnotation(XMLCalabash.class); for (String clarkName: annotation.type().split("\\s+")) { try { QName name = QName.fromClarkName(clarkName); logger.trace("Found step type annotation: " + clarkName); if (implementations.containsKey(name)) { logger.debug("Ignoring step type annotation for configured step: " + clarkName); } implementations.put(name, klass); } catch (IllegalArgumentException iae) { logger.debug("Failed to parse step annotation type: " + clarkName); } } } }
private QName makeQName(String name) { QName qname; if (name == null) { qname = new QName(""); } else if (name.indexOf("{") == 0) { qname = fromClarkName(name); } else { int cpos = name.indexOf(":"); if (cpos > 0) { String prefix = name.substring(0, cpos); if (!bindings.containsKey(prefix)) { throw new XProcException("Unbound prefix '" + prefix + "' in: '" + name + "'."); } String uri = bindings.get(prefix); qname = new QName(prefix, uri, name.substring(cpos + 1)); } else { qname = new QName("", name); } } return qname; }
private QName makeQName(String name) { QName qname; if (name == null) { qname = new QName(""); } else if (name.indexOf("{") == 0) { qname = fromClarkName(name); } else { int cpos = name.indexOf(":"); if (cpos > 0) { String prefix = name.substring(0, cpos); if (!bindings.containsKey(prefix)) { throw new XProcException("Unbound prefix '" + prefix + "' in: '" + name + "'."); } String uri = bindings.get(prefix); qname = new QName(prefix, uri, name.substring(cpos + 1)); } else { qname = new QName("", name); } } return qname; }
/** * Apply XSLT 3.0 static parameters to a compilerInfo. Actually this sets all parameter values, whether static or dynamic. * This is possible because the stylesheet is compiled for once-only use. * * @param compiler The XsltCompiler object into which the parameters are copied * @throws SaxonApiException if invalid options are found */ public void applyStaticParams(XsltCompiler compiler) throws SaxonApiException { Processor processor = compiler.getProcessor(); for (Enumeration e = paramValues.propertyNames(); e.hasMoreElements(); ) { String name = (String) e.nextElement(); String value = paramValues.getProperty(name); compiler.setParameter(QName.fromClarkName(name), new XdmAtomicValue(value, ItemType.UNTYPED_ATOMIC)); } for (Enumeration e = paramExpressions.propertyNames(); e.hasMoreElements(); ) { String name = (String) e.nextElement(); String value = paramExpressions.getProperty(name); // parameters starting with "?" are taken as XPath expressions XPathCompiler xpc = processor.newXPathCompiler(); XPathExecutable xpe = xpc.compile(value); XdmValue val = xpe.load().evaluate(); compiler.setParameter(QName.fromClarkName(name), val); } }