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