Class Stylesheet


  • public class Stylesheet
    extends Object

    Stylesheet implements an XSLT stylesheet such that rules can be added to the stylesheet and the stylesheet can be applied to a source document or node.

    • Constructor Detail

      • Stylesheet

        public Stylesheet()
        Creates a new empty stylesheet.
    • Method Detail

      • addRule

        public void addRule​(Rule rule)
        Add a rule to this stylesheet.
        Parameters:
        rule - the rule to add
      • removeRule

        public void removeRule​(Rule rule)
        Removes the specified rule from this stylesheet.
        Parameters:
        rule - the rule to remove
      • applyTemplates

        public void applyTemplates​(Object input,
                                   XPath xpath)
                            throws Exception
        Processes the result of the xpath expression. The xpath expression is evaluated against the provided input object.
        Parameters:
        input - the input object
        xpath - the xpath expression
        Throws:
        Exception - if something goes wrong
      • applyTemplates

        public void applyTemplates​(Object input,
                                   XPath xpath,
                                   String mode)
                            throws Exception
        Processes the result of the xpath expression in the given mode. The xpath expression is evaluated against the provided input object.
        Parameters:
        input - the input object
        xpath - the xpath expression
        mode - the mode
        Throws:
        Exception - if something goes wrong
      • applyTemplates

        public void applyTemplates​(Node node)
                            throws Exception
        If input is a Node, this will processes all of the children of that node. If input is a List of Nodess, these nodes will be iterated and all children of each node will be processed.
        Parameters:
        node - the input object
        Throws:
        Exception - if something goes wrong
      • applyTemplates

        public void applyTemplates​(Element element)
                            throws Exception
        If input is a Node, this will processes all of the children of that node. If input is a List of Nodess, these nodes will be iterated and all children of each node will be processed.
        Parameters:
        element - the input object
        Throws:
        Exception - if something goes wrong
      • applyTemplates

        public void applyTemplates​(Document document)
                            throws Exception
        If input is a Node, this will processes all of the children of that node. If input is a List of Nodess, these nodes will be iterated and all children of each node will be processed.
        Parameters:
        document - the input object
        Throws:
        Exception - if something goes wrong
      • applyTemplates

        public void applyTemplates​(List<Node> list)
                            throws Exception
        If input is a Node, this will processes all of the children of that node. If input is a List of Nodess, these nodes will be iterated and all children of each node will be processed.
        Parameters:
        list - the input object
        Throws:
        Exception - if something goes wrong
      • applyTemplates

        public void applyTemplates​(Node node,
                                   String mode)
                            throws Exception
        Processes the input object in the given mode. If input is a Node, this will processes all of the children of that node. If input is a List of Nodess, these nodes will be iterated and all children of each node will be processed.
        Parameters:
        node - the input object
        mode - the mode
        Throws:
        Exception - if something goes wrong
      • applyTemplates

        public void applyTemplates​(Element element,
                                   String mode)
                            throws Exception
        Processes the input object in the given mode. If input is a Node, this will processes all of the children of that node. If input is a List of Nodess, these nodes will be iterated and all children of each node will be processed.
        Parameters:
        element - the input object
        mode - the mode
        Throws:
        Exception - if something goes wrong
      • applyTemplates

        public void applyTemplates​(Document document,
                                   String mode)
                            throws Exception
        Processes the input object in the given mode. If input is a Node, this will processes all of the children of that node. If input is a List of Nodess, these nodes will be iterated and all children of each node will be processed.
        Parameters:
        document - the input object
        mode - the mode
        Throws:
        Exception - if something goes wrong
      • applyTemplates

        public void applyTemplates​(List<? extends Node> list,
                                   String mode)
                            throws Exception
        Processes the input object in the given mode. If input is a Node, this will processes all of the children of that node. If input is a List of Nodess, these nodes will be iterated and all children of each node will be processed.
        Parameters:
        list - list of Elements or Documents
        mode - the mode
        Throws:
        Exception - if something goes wrong
      • clear

        public void clear()
      • getModeName

        public String getModeName()
        DOCUMENT ME!
        Returns:
        the name of the mode the stylesheet uses by default
      • setModeName

        public void setModeName​(String modeName)
        Sets the name of the mode that the stylesheet uses by default.
        Parameters:
        modeName - DOCUMENT ME!
      • getValueOfAction

        public Action getValueOfAction()
        DOCUMENT ME!
        Returns:
        the default value-of action which is used in the default rules for the pattern "text()|@"
      • setValueOfAction

        public void setValueOfAction​(Action valueOfAction)
        Sets the default value-of action which is used in the default rules for the pattern "text()|@"
        Parameters:
        valueOfAction - DOCUMENT ME!