net.sf.saxon.style

## Class StyleNodeFactory

- java.lang.Object
- - net.sf.saxon.style.StyleNodeFactory

- All Implemented Interfaces:
    Serializable, NodeFactory

      public class StyleNodeFactory
      extends Object
      implements NodeFactory

  Class StyleNodeFactory.
  A Factory for nodes in the stylesheet tree.
  Currently only allows Element nodes to be user-constructed.
  Author:
    Michael H. Kay
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Configuration` | `config`
    `protected NamePool` | `namePool`
    `protected DecimalValue` | `processorVersion`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `StyleNodeFactory(Configuration config)` Create the node factory for representing an XSLT stylesheet as a tree structure

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `compileContentValueTemplate(TextImpl node, List<Expression> contents)` Compile a content value text node.
    `DecimalValue` | `getXsltProcessorVersion()` Get the XSLT processor version to be used by this node factory.
    `boolean` | `isElementAvailable(String uri, String localName)` Method to support the element-available() function
    `void` | `makeAccumulatorManager(PreparedStylesheet pss)`
    `ElementImpl` | `makeElementNode(NodeInfo parent, NodeName elemName, SchemaType elemType, boolean isNilled, AttributeCollectionImpl attlist, NamespaceBinding[] namespaces, int namespacesUsed, PipelineConfiguration pipe, int locationId, int sequence)` Create an Element node.
    `TextImpl` | `makeTextNode(NodeInfo parent, CharSequence content)` Make a text node
    `protected StyleElement` | `makeXSLElement(int f, NodeInfo parent)` Make an XSL element node
    `void` | `setXsltProcessorVersion(DecimalValue version)` Set the XSLT processor version to be used by this node factory.
    `boolean` | `validateTextNode(NodeInfo node)` Validate a text node in the stylesheet

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### config

          protected Configuration config

    - #### namePool

          protected NamePool namePool

    - #### processorVersion

          protected DecimalValue processorVersion

  - ### Constructor Detail

    - #### StyleNodeFactory

          public StyleNodeFactory(Configuration config)

      Create the node factory for representing an XSLT stylesheet as a tree structure
      Parameters:
        `config` - the Saxon configuration

  - ### Method Detail

    - #### setXsltProcessorVersion

          public void setXsltProcessorVersion(DecimalValue version)

      Set the XSLT processor version to be used by this node factory. This must be 0.0, 2.0 or 3.0. The value 3.0 is ignored in Saxon-HE. The value 0.0 indicates that the processor version is to be taken from the version attribute of the xsl:stylesheet element.
      Parameters:
        `version` - the XSLT version number, as a decimal

    - #### getXsltProcessorVersion

          public DecimalValue getXsltProcessorVersion()

      Get the XSLT processor version to be used by this node factory.
      Returns:
        the processor version (always 2.0 or 3.0 once the stylesheet version attribute has been read)

    - #### makeElementNode

          public ElementImpl makeElementNode(NodeInfo parent,
                                    NodeName elemName,
                                    SchemaType elemType,
                                    boolean isNilled,
                                    AttributeCollectionImpl attlist,
                                    NamespaceBinding[] namespaces,
                                    int namespacesUsed,
                                    PipelineConfiguration pipe,
                                    int locationId,
                                    int sequence)

      Create an Element node. Note, if there is an error detected while constructing the Element, we add the element anyway, and return success, but flag the element with a validation error. This allows us to report more than one error from a single compilation.
      Specified by:
        `makeElementNode` in interface `NodeFactory`
      Parameters:
        `parent` - The parent element
        `elemName` - The element name
        `elemType` - The type annotation of the element
        `isNilled` - true if the element is to be marked as nilled
        `attlist` - The attribute collection, excluding any namespace attributes
        `namespaces` - List of new namespace declarations for this element, as a sequence of namespace codes representing pairs of strings: (prefix1, uri1), (prefix2, uri2)...
        `namespacesUsed` - the number of elemnts of the namespaces array actually used
        `pipe` - The pipeline configuration (provides access to the error listener and the location provider)
        `locationId` - Indicates the source document and line number containing the node
        `sequence` - Sequence number to be assigned to represent document order.

    - #### makeXSLElement

          protected StyleElement makeXSLElement(int f,
                                    NodeInfo parent)

      Make an XSL element node
      Parameters:
        `f` - the fingerprint of the node name
        `parent` - the parent node
      Returns:
        the constructed element node

    - #### makeTextNode

          public TextImpl makeTextNode(NodeInfo parent,
                              CharSequence content)

      Make a text node
      Specified by:
        `makeTextNode` in interface `NodeFactory`
      Parameters:
        `content` - the content of the text node
      Returns:
        the constructed text node

    - #### isElementAvailable

          public boolean isElementAvailable(String uri,
                                   String localName)

      Method to support the element-available() function
      Parameters:
        `uri` - the namespace URI
        `localName` - the local Name
      Returns:
        true if an extension element of this name is recognized

    - #### makeAccumulatorManager

          public void makeAccumulatorManager(PreparedStylesheet pss)

    - #### validateTextNode

          public boolean validateTextNode(NodeInfo node)
                                   throws XPathException

      Validate a text node in the stylesheet
      Parameters:
        `node` - the text node
      Returns:
        true if the node is a text value template containing one or more expressions
      Throws:
        `XPathException` - if the node is invalid

    - #### compileContentValueTemplate

          public void compileContentValueTemplate(TextImpl node,
                                         List<Expression> contents)
                                           throws XPathException

      Compile a content value text node. Dummy implementation (these can exist only in Saxon-PE or higher)
      Throws:
        `XPathException`

Copyright (c) 2004-2013 Saxonica Limited. All rights reserved.