Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.novell.xsl.process
Class ChooseTemplate

    java.lang.Object
      com.novell.xsl.process.TemplateCollection
          com.novell.xsl.process.ChooseTemplate

All Implemented Interfaces:
  Template

    public class ChooseTemplate

extends TemplateCollection

A template that instantiates the content of the first `xsl:when` child element whose pattern selects at least one node. If there is no such `xsl:when` child element, the content of the optional `xsl:otherwise` child element is instantiated instead. This template corresponds to the `xsl:choose` element.

Constructor Summary
`ChooseTemplate(WhenTemplate[] whenTemplates, OtherwiseTemplate otherwiseTemplate, Node nsContext)` Constructs a `ChooseTemplate` containing the specified when and otherwise templates.

Method Summary
`void` | `dump(PrintWriter out, int indent)` Dumps this object to the specified output stream.
`OtherwiseTemplate` | `getOtherwiseTemplate()` Returns this template's otherwise template.
`void` | `instantiate(ProcessingEnv env, Node currentNode, ResultHandler result)` Instantiates this template for the specified current node and sends the result to the specified result handler.

Methods inherited from class com.novell.xsl.process.TemplateCollection
`getNamespaceContext, getTemplates, instantiateTemplates`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ChooseTemplate

    public ChooseTemplate(WhenTemplate[] whenTemplates,
                          OtherwiseTemplate otherwiseTemplate,
                          Node nsContext)

  Constructs a `ChooseTemplate` containing the specified when and otherwise templates. The when templates are stored in the template collection while the when template is stored separately.

  Parameters:
    `whenTemplates` - the when templates
    `otherwiseTemplate` - the otherwise template, or `null` if none
    `nsContext` - The node in the style sheet from which this template comes

Method Detail

### getOtherwiseTemplate

    public OtherwiseTemplate getOtherwiseTemplate()

  Returns this template's otherwise template.

  Returns:
    the otherwise template, or `null` if none

### instantiate

    public void instantiate(ProcessingEnv env,
                            Node currentNode,
                            ResultHandler result)
                     throws XSLException

  Instantiates this template for the specified current node and sends the result to the specified result handler.

  For a `ChooseTemplate`, this method instantiates the first `xsl:when` template whose pattern selects at least one node. If there is no such `xsl:when` template but there is an `otherwise` template, the `otherwise` template is instantiated. Otherwise nothing is instantiated.

  Parameters:
    `env` - the current processing environment
    `currentNode` - the current source node
    `result` - the handler to which results are sent
  Throws:
    `XSLException` - if a fatal error occurs during instantiation

### dump

    public void dump(PrintWriter out,
                     int indent)

  Dumps this object to the specified output stream.

  Specified by:
    `dump` in interface `Template`
  Overrides:
    `dump` in class `TemplateCollection`
  Parameters:
    `out` - the output stream to write to
    `indent` - number of tabs to indent

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD