/** * Get the value of a serialization property. * * <p>Unlike the method {@link #getOutputProperty(Property)}, this method allows properties * to be read whose names are not in the standard set of property names defined in the W3C specifications, * nor in a recognized Saxon extension. This enables properties to be set for use by a custom serialization * method.</p> * * @param property the name of the required property * @return the value of the required property as a string, or null if the property has * not been given any value. */ public String getOutputProperty(QName property) { return properties.get(property.getStructuredQName()); }
/** * Get the value of a serialization property. * * <p>Unlike the method {@link #getOutputProperty(Property)}, this method allows properties * to be read whose names are not in the standard set of property names defined in the W3C specifications, * nor in a recognized Saxon extension. This enables properties to be set for use by a custom serialization * method.</p> * * @param property the name of the required property * @return the value of the required property as a string, or null if the property has * not been given any value. */ public String getOutputProperty(QName property) { return properties.get(property.getStructuredQName()); }
/** * Get the name of the function, as a QName. * <p>This method must be implemented in all subclasses</p> * * @return the function name */ @Override public StructuredQName getFunctionQName() { return function.getName().getStructuredQName(); }
/** * Get the name of the function, as a QName. * <p>This method must be implemented in all subclasses</p> * * @return the function name */ @Override public StructuredQName getFunctionQName() { return function.getName().getStructuredQName(); }
/** * Create an <tt>xs:QName</tt> atomic value * * @param value the <tt>xs:QName</tt> value, as a QName */ public XdmAtomicValue(QName value) { this(new QNameValue(value.getStructuredQName(), BuiltInAtomicType.QNAME), true); }
/** * Create an <tt>xs:QName</tt> atomic value * @param value the <tt>xs:QName</tt> value, as a QName */ public XdmAtomicValue(QName value) { super(new QNameValue(value.getStructuredQName(), BuiltInAtomicType.QNAME)); }
/** * Create an <tt>xs:QName</tt> atomic value * * @param value the <tt>xs:QName</tt> value, as a QName */ public XdmAtomicValue(QName value) { this(new QNameValue(value.getStructuredQName(), BuiltInAtomicType.QNAME), true); }
/** * Get the value of a serialization property * * @param property the name of the required property. This method only considers properties * explicitly set on this Serialized object, it does not return values * obtained from the stylesheet or query. * @return the value of the required property as a string, or null if the property has * not been given any value. */ public String getOutputProperty(Property property) { return properties.get(property.getQName().getStructuredQName()); }
/** * Get the value of a serialization property * * @param property the name of the required property. This method only considers properties * explicitly set on this Serialized object, it does not return values * obtained from the stylesheet or query. * @return the value of the required property as a string, or null if the property has * not been given any value. */ public String getOutputProperty(Property property) { return properties.get(property.getQName().getStructuredQName()); }
/** * Set the initial mode for the transformation * * @param modeName the name of the initial mode. Two special values are recognized, in the * reserved XSLT namespace: * xsl:unnamed to indicate the mode with no name, and xsl:default to indicate the * mode defined in the stylesheet header as the default mode. * The value null also indicates the default mode (which defaults to the unnamed * mode, but can be set differently in an XSLT 3.0 stylesheet). * @throws IllegalArgumentException if the requested mode is not defined in the stylesheet * @since changed in 9.6 to throw an exception if the mode is not defined in the stylesheet. * Chaned in 9.7 so that null means the default mode, not necessarily the unnamed mode. */ public void setInitialMode(QName modeName) throws IllegalArgumentException { try { controller.setInitialMode(modeName == null ? null : modeName.getStructuredQName()); } catch (XPathException e) { throw new IllegalArgumentException(e); } }
/** * Get the value that has been set for a stylesheet parameter * * @param name the parameter whose name is required * @return the value that has been set for the parameter, or null if no value has been set */ public XdmValue getParameter(QName name) { Sequence<?> oval = parameters.get(name.getStructuredQName()); return oval == null ? null : XdmValue.wrap(oval); }
/** * Get the value that has been set for an external variable * * @param name the name of the external variable whose value is required * @return the value that has been set for the external variable, or null if no value has been set */ public XdmValue getExternalVariable(QName name) { GroundedValue<?> oval = context.getParameter(name.getStructuredQName()); if (oval == null) { return null; } return XdmValue.wrap(oval); }
/** * Get the value that has been set for a stylesheet parameter * * @param name the parameter whose name is required * @return the value that has been set for the parameter, or null if no value has been set */ public XdmValue getParameter(QName name) { Sequence<?> oval = parameters.get(name.getStructuredQName()); return oval == null ? null : XdmValue.wrap(oval); }
/** * Get the value that has been set for an external variable * * @param name the name of the external variable whose value is required * @return the value that has been set for the external variable, or null if no value has been set */ public XdmValue getExternalVariable(QName name) { GroundedValue<?> oval = context.getParameter(name.getStructuredQName()); if (oval == null) { return null; } return XdmValue.wrap(oval); }
/** * Set the value of a stylesheet parameter * @param name the name of the stylesheet parameter, as a QName * @param value the value of the stylesheet parameter, or null to clear a previously set value */ public void setParameter(QName name, XdmValue value) { controller.setParameter(name.getStructuredQName(), (value == null ? null : value.getUnderlyingValue())); }
/** * Set the value of external variable defined in the query * * @param name the name of the external variable, as a QName * @param value the value of the external variable, or null to clear a previously set value * @throws SaxonApiUncheckedException if the value is evaluated lazily, and evaluation fails */ public void setExternalVariable(QName name, XdmValue value) { try { context.setParameter(name.getStructuredQName(), value == null ? null : ((Sequence<?>) value.getUnderlyingValue()).materialize()); } catch (XPathException e) { throw new SaxonApiUncheckedException(e); } }
/** * Set the value of external variable defined in the query * * @param name the name of the external variable, as a QName * @param value the value of the external variable, or null to clear a previously set value * @throws SaxonApiUncheckedException if the value is evaluated lazily, and evaluation fails */ public void setExternalVariable(QName name, XdmValue value) { try { context.setParameter(name.getStructuredQName(), value == null ? null : ((Sequence<?>) value.getUnderlyingValue()).materialize()); } catch (XPathException e) { throw new SaxonApiUncheckedException(e); } }
/** * Get a system function. This can be any function defined in XPath 3.1 functions and operators, * including functions in the math, map, and array namespaces. It can also be a Saxon extension * function, provided a licensed Processor is used. * @return the requested function, or null if there is no such function. Note that some functions * (those with particular context dependencies) may be unsuitable for dynamic calling. * @throws SaxonApiException if dynamic function calls are not permitted by this Saxon Configuration */ public static XdmFunctionItem getSystemFunction(Processor processor, QName name, int arity) throws SaxonApiException { try { Configuration config = processor.getUnderlyingConfiguration(); Function f = config.getSystemFunction(name.getStructuredQName(), arity); return f==null ? null : new XdmFunctionItem(f); } catch (XPathException e) { throw new SaxonApiException(e); } }
private Component getFunctionComponent(QName function, XdmValue[] arguments) throws XPathException { SymbolicName fName = new SymbolicName.F(function.getStructuredQName(), arguments.length); PreparedStylesheet pss = (PreparedStylesheet) controller.getExecutable(); Component f = pss.getComponent(fName); if (f == null) { throw new XPathException("No public function with name " + function.getClarkName() + " and arity " + arguments.length + " has been declared in the stylesheet", "XTDE0041"); } else if (f.getVisibility() != Visibility.FINAL && f.getVisibility() != Visibility.PUBLIC) { throw new XPathException("Cannot invoke " + fName + " externally, because it is not public", "XTDE0041"); } return f; }
private Component getFunctionComponent(QName function, XdmValue[] arguments) throws XPathException { SymbolicName fName = new SymbolicName.F(function.getStructuredQName(), arguments.length); PreparedStylesheet pss = (PreparedStylesheet) controller.getExecutable(); Component f = pss.getComponent(fName); if (f == null) { throw new XPathException("No public function with name " + function.getClarkName() + " and arity " + arguments.length + " has been declared in the stylesheet", "XTDE0041"); } else if (f.getVisibility() != Visibility.FINAL && f.getVisibility() != Visibility.PUBLIC) { throw new XPathException("Cannot invoke " + fName + " externally, because it is not public", "XTDE0041"); } return f; }