Class LiteralResultElement

All Implemented Interfaces:
Source, SourceLocator, ActiveSource, GroundedValue, Item, MutableNodeInfo, NamespaceResolver, NodeInfo, Sequence, Location, SteppingNode, SiblingCountingNode, Locator

public class LiteralResultElement extends StyleElement
This class represents a literal result element in the style sheet (typically an HTML element to be output).
It is also used to represent unknown top-level elements, which are ignored.
  • Constructor Details

    • LiteralResultElement

      public LiteralResultElement()
  • Method Details

    • mayContainSequenceConstructor

      protected boolean mayContainSequenceConstructor()
      Determine whether this type of element is allowed to contain a sequence constructor
      Overrides:
      mayContainSequenceConstructor in class StyleElement
      Returns:
      true: yes, it may contain a sequence constructor
    • isInstruction

      public boolean isInstruction()
      Specify that this is an instruction
      Overrides:
      isInstruction in class StyleElement
      Returns:
      true if this element is an instruction
    • isInXsltNamespace

      public boolean isInXsltNamespace()
      Ask whether the element is in the XSLT namespace
      Overrides:
      isInXsltNamespace in class StyleElement
      Returns:
      true if the element is in the XSLT namespace
    • processStandardAttributes

      public void processStandardAttributes(NamespaceUri namespace)
      Description copied from class: StyleElement
      Process the standard attributes such as [xsl:]expand-text. Invokes StyleElement.compileError(String) or similar if the value of any of these attributes is invalid.

      The method processes:

      • extension-element-prefixes
      • exclude-result-prefixes
      • version
      • default-xpath-namespace
      • default-validation
      • expand-text

      but not:

      • default-collation
      • default-mode
      Overrides:
      processStandardAttributes in class StyleElement
      Parameters:
      namespace - either "" to find the attributes in the null namespace, or NamespaceConstant.XSLT to find them in the XSLT namespace
    • prepareAttributes

      protected void prepareAttributes()
      Process the attribute list
      Specified by:
      prepareAttributes in class StyleElement
    • validate

      public void validate(ComponentDeclaration decl) throws XPathException
      Validate that this node is OK
      Overrides:
      validate in class StyleElement
      Parameters:
      decl - the declaration to be validated
      Throws:
      XPathException - if any error is found during validation
    • validateChildren

      protected void validateChildren(ComponentDeclaration decl, boolean excludeStylesheet) throws XPathException
      Validate the children of this node, recursively. Overridden for top-level data elements.
      Overrides:
      validateChildren in class StyleElement
      Parameters:
      decl - the declaration whose children are to be validated
      excludeStylesheet - true if the xsl:stylesheet element is to be excluded
      Throws:
      XPathException - if validation fails
    • compile

      public Expression compile(Compilation exec, ComponentDeclaration decl) throws XPathException
      Compile code to process the literal result element at runtime
      Overrides:
      compile in class StyleElement
      Parameters:
      exec - the compilation episode
      decl - the containing top-level declaration, for example xsl:function or xsl:template
      Returns:
      either a ComputedExpression, or null. The value null is returned when compiling an instruction that returns a no-op, or when compiling a top-level object such as an xsl:template that compiles into something other than an instruction.
      Throws:
      XPathException - if validation fails
    • makeStylesheet

      public DocumentImpl makeStylesheet(boolean topLevel) throws XPathException
      Make a top-level literal result element into a stylesheet. This implements the "Simplified Stylesheet" facility.
      Parameters:
      topLevel - true if this is the top level module of a stylesheet; false if it is included or imported
      Returns:
      the reconstructed stylesheet with an xsl:stylesheet and xsl:template element added
      Throws:
      XPathException - if anything goes wrong
    • getObjectName

      public StructuredQName getObjectName()
      Get a name identifying the object of the expression, for example a function name, template name, variable name, key name, element name, etc. This is used only where the name is known statically. If there is no name, the value will be -1.
      Overrides:
      getObjectName in class StyleElement
      Returns:
      the name of the literal result element