Path: blob/master/src/java.xml/share/classes/javax/xml/transform/Templates.java
40948 views
/*1* Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package javax.xml.transform;2627import java.util.Properties;2829303132/**33* An object that implements this interface is the runtime representation of processed34* transformation instructions.35*36* <p>Templates must be threadsafe for a given instance37* over multiple threads running concurrently, and may38* be used multiple times in a given session.</p>39*40* @since 1.441*/42public interface Templates {4344/**45* Create a new transformation context for this Templates object.46*47* @return A valid non-null instance of a Transformer.48*49* @throws TransformerConfigurationException if a Transformer can not be created.50*/51Transformer newTransformer() throws TransformerConfigurationException;5253/**54* Get the properties corresponding to the effective xsl:output element.55* The object returned will56* be a clone of the internal values. Accordingly, it can be mutated57* without mutating the Templates object, and then handed in to58* {@link javax.xml.transform.Transformer#setOutputProperties}.59*60* <p>The properties returned should contain properties set by the stylesheet,61* and these properties are "defaulted" by default properties specified by62* <a href="http://www.w3.org/TR/xslt#output">section 16 of the63* XSL Transformations (XSLT) W3C Recommendation</a>. The properties that64* were specifically set by the stylesheet should be in the base65* Properties list, while the XSLT default properties that were not66* specifically set should be in the "default" Properties list. Thus,67* getOutputProperties().getProperty(String key) will obtain any68* property in that was set by the stylesheet, <em>or</em> the default69* properties, while70* getOutputProperties().get(String key) will only retrieve properties71* that were explicitly set in the stylesheet.</p>72*73* <p>For XSLT,74* <a href="http://www.w3.org/TR/xslt#attribute-value-templates">Attribute75* Value Templates</a> attribute values will76* be returned unexpanded (since there is no context at this point). The77* namespace prefixes inside Attribute Value Templates will be unexpanded,78* so that they remain valid XPath values.</p>79*80* @return A Properties object, never null.81*/82Properties getOutputProperties();83}848586