Home | History | Annotate | Download | only in transform
      1 /*
      2  * Licensed to the Apache Software Foundation (ASF) under one or more
      3  * contributor license agreements.  See the NOTICE file distributed with
      4  * this work for additional information regarding copyright ownership.
      5  * The ASF licenses this file to You under the Apache License, Version 2.0
      6  * (the "License"); you may not use this file except in compliance with
      7  * the License.  You may obtain a copy of the License at
      8  *
      9  *     http://www.apache.org/licenses/LICENSE-2.0
     10  *
     11  * Unless required by applicable law or agreed to in writing, software
     12  * distributed under the License is distributed on an "AS IS" BASIS,
     13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     14  * See the License for the specific language governing permissions and
     15  * limitations under the License.
     16  */
     17 
     18 // $Id: Templates.java 570103 2007-08-27 13:24:55Z mrglavas $
     19 
     20 package javax.xml.transform;
     21 
     22 import java.util.Properties;
     23 
     24 /**
     25  * An object that implements this interface is the runtime representation of processed
     26  * transformation instructions.
     27  *
     28  * <p>Templates must be thread-safe for a given instance
     29  * over multiple threads running concurrently, and may
     30  * be used multiple times in a given session.</p>
     31  */
     32 public interface Templates {
     33 
     34     /**
     35      * Create a new transformation context for this Templates object.
     36      *
     37      * @return A valid non-null instance of a Transformer.
     38      *
     39      * @throws TransformerConfigurationException if a Transformer can not be created.
     40      */
     41     Transformer newTransformer() throws TransformerConfigurationException;
     42 
     43     /**
     44      * Get the properties corresponding to the effective xsl:output element.
     45      * The object returned will
     46      * be a clone of the internal values. Accordingly, it can be mutated
     47      * without mutating the Templates object, and then handed in to
     48      * {@link javax.xml.transform.Transformer#setOutputProperties}.
     49      *
     50      * <p>The properties returned should contain properties set by the stylesheet,
     51      * and these properties are "defaulted" by default properties specified by
     52      * <a href="http://www.w3.org/TR/xslt#output">section 16 of the
     53      * XSL Transformations (XSLT) W3C Recommendation</a>.  The properties that
     54      * were specifically set by the stylesheet should be in the base
     55      * Properties list, while the XSLT default properties that were not
     56      * specifically set should be in the "default" Properties list.  Thus,
     57      * getOutputProperties().getProperty(String key) will obtain any
     58      * property in that was set by the stylesheet, <em>or</em> the default
     59      * properties, while
     60      * getOutputProperties().get(String key) will only retrieve properties
     61      * that were explicitly set in the stylesheet.</p>
     62      *
     63      * <p>For XSLT,
     64      * <a href="http://www.w3.org/TR/xslt#attribute-value-templates">Attribute
     65      * Value Templates</a> attribute values will
     66      * be returned unexpanded (since there is no context at this point).  The
     67      * namespace prefixes inside Attribute Value Templates will be unexpanded,
     68      * so that they remain valid XPath values.</p>
     69      *
     70      * @return A Properties object, never null.
     71      */
     72     Properties getOutputProperties();
     73 }
     74