1. /*
  2. * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
  3. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  4. */
  5. /*
  6. * @(#)Templates.java 1.9 03/01/23
  7. */
  8. package javax.xml.transform;
  9. import java.util.Properties;
  10. import javax.xml.transform.TransformerException;
  11. /**
  12. * An object that implements this interface is the runtime representation of processed
  13. * transformation instructions.
  14. *
  15. * <p>Templates must be threadsafe for a given instance
  16. * over multiple threads running concurrently, and may
  17. * be used multiple times in a given session.</p>
  18. */
  19. public interface Templates {
  20. /**
  21. * Create a new transformation context for this Templates object.
  22. *
  23. * @return A valid non-null instance of a Transformer.
  24. *
  25. * @throws TransformerConfigurationException if a Transformer can not be created.
  26. */
  27. Transformer newTransformer() throws TransformerConfigurationException;
  28. /**
  29. * Get the static properties for xsl:output. The object returned will
  30. * be a clone of the internal values. Accordingly, it can be mutated
  31. * without mutating the Templates object, and then handed in to
  32. * {@link javax.xml.transform.Transformer#setOutputProperties}.
  33. *
  34. * <p>The properties returned should contain properties set by the stylesheet,
  35. * and these properties are "defaulted" by default properties specified by
  36. * <a href="http://www.w3.org/TR/xslt#output">section 16 of the
  37. * XSL Transformations (XSLT) W3C Recommendation</a>. The properties that
  38. * were specifically set by the stylesheet should be in the base
  39. * Properties list, while the XSLT default properties that were not
  40. * specifically set should be in the "default" Properties list. Thus,
  41. * getOutputProperties().getProperty(String key) will obtain any
  42. * property in that was set by the stylesheet, <em>or</em> the default
  43. * properties, while
  44. * getOutputProperties().get(String key) will only retrieve properties
  45. * that were explicitly set in the stylesheet.</p>
  46. *
  47. * <p>For XSLT,
  48. * <a href="http://www.w3.org/TR/xslt#attribute-value-templates">Attribute
  49. * Value Templates</a> attribute values will
  50. * be returned unexpanded (since there is no context at this point). The
  51. * namespace prefixes inside Attribute Value Templates will be unexpanded,
  52. * so that they remain valid XPath values. (For XSLT 1.0, this is not
  53. * a problem since Attribute Value Templates are not allowed for xsl:output
  54. * attributes. However, the will be allowed in versions after 1.1.)</p>
  55. *
  56. * @return A Properties object, never null.
  57. */
  58. Properties getOutputProperties();
  59. }