    All Packages  Class Hierarchy  This Package  Previous  Next  Index

# Class xs.xs_Stylist

    java.lang.Object
       |
       +----xs.xs_Stylist

public class xs_Stylist
extends Object

The applier of style (as defined in a stylesheet definition supplied) to a given XML element, outputting results to a given Writer. This class is the XSL lynchpin: deciding which XSL rule to apply, and then invoking the appropriate action.

##

TheStylesheetDefn
  The definition of the stylesheet which is currently being applied.

##

xs_Stylist(xs_StylesheetDefn)
  Construct an XSL stylist with a stylesheet definition.

##

applyStyle(xg_Element, Writer, JProgressBar)
  Apply style to the given source element, and write the results to the InputResultsWriter.
applyStyleRules(xg_Element)
  Apply all appropriate style rules to the element (placing the net result in a 'style="..."' attribute within it).
applyStyleRules(xg_Element, Vector, Vector)
  Apply all appropriate style rules to the element (placing the net result in a 'style="..."' attribute within it).
buildStyleAttList(xg_Element, Vector, Vector)
  Build a composite attribute list of the net result of applying all the style rules in the InputStyleRules, with the order of applying them determined by the precedence of each style rule's best pattern from the InputBestPatterns.
getStylesheetDefn()
  Get the definition of the stylesheet currently being applied.
identifyStyleRules(xg_Element, Vector, Vector)
  Create a list of every style rule which is applicable to this element, and a second list of the best pattern for each such rule.
invokeRuleAction(xg_Node, xg_Element, Writer, JProgressBar)

  Invoke the InputRuleAction, to apply style to the InputSourceElement, and write the results to the InputResultsWriter.

invokeRuleActionChildren(xg_Node, xg_Element, Writer, JProgressBar)
  Process each of the children InputRuleAction, treating each one as an action and invoking it.
invokeRuleActions(xs_RuleElement, xg_Element, Writer, JProgressBar)
  Invoke the actions of the InputSelectedRule, to apply style to the given source element, and write the results to the InputResultsWriter.
selectRule(xg_Element)
  Select the rule most suitable to the InputSourceElement.

##

TheStylesheetDefn

     protected xs_StylesheetDefn TheStylesheetDefn

  The definition of the stylesheet which is currently being applied.

##

xs_Stylist

     public xs_Stylist(xs_StylesheetDefn InputStylesheetDefn)

  Construct an XSL stylist with a stylesheet definition.

  Parameters:
    InputStylesheetDefn - The definition of the stylesheet to apply

##

applyStyle

     public void applyStyle(xg_Element InputSourceElement,
                            Writer InputResultsWriter,
                            JProgressBar InputProgressBar) throws xs_StyleException, IOException

  Apply style to the given source element, and write the results to the InputResultsWriter.

  Parameters:
    InputSourceElement - The pre-parsed source element
    InputResultsWriter - The writer to which to write the results of applying a stylesheet to the source element
    InputProgressBar - Bar on which to show progress (as measured by the end offset of each node after it is processed).
  Throws: xs_StyleException
    Error applying style
  Throws: IOException
    Error writing to results writer

applyStyleRules

     protected xg_AttList applyStyleRules(xg_Element InputSourceElement) throws xs_StyleException

  Apply all appropriate style rules to the element (placing the net result in a 'style="..."' attribute within it). The element's original attributes are passed back for safekeeping, to be restored later.

  Parameters:
    InputSourceElement - The pre-parsed source element
  Returns:
    The element's original attribute list
  Throws: xs_StyleException
    Error applying style

identifyStyleRules

     protected void identifyStyleRules(xg_Element InputSourceElement,
                                       Vector OutputStyleRules,
                                       Vector OutputBestPatterns) throws xs_StyleException

  Create a list of every style rule which is applicable to this element, and a second list of the best pattern for each such rule.

  Parameters:
    InputSourceElement - The pre-parsed source element
    OutputStyleRules - List of style rules to apply
    OutputBestPatterns - The best pattern in each of the applicable style rules
  Throws: xs_StyleException
    Error applying style

applyStyleRules

     protected xg_AttList applyStyleRules(xg_Element InputSourceElement,
                                          Vector InputStyleRules,
                                          Vector InputBestPatterns) throws xs_StyleException

  Apply all appropriate style rules to the element (placing the net result in a 'style="..."' attribute within it). The element's original attributes are passed back for safekeeping, to be restored later.

  Parameters:
    InputSourceElement - The pre-parsed source element
    InputStyleRules - List of style rules to apply
    InputBestPatterns - The best pattern in each of the applicable style rules
  Returns:
    The element's original attribute list
  Throws: xs_StyleException
    Error applying style

buildStyleAttList

     protected xs_StyleAttList buildStyleAttList(xg_Element InputSourceElement,
                                                 Vector InputStyleRules,
                                                 Vector InputBestPatterns) throws xs_StyleException

  Build a composite attribute list of the net result of applying all the style rules in the InputStyleRules, with the order of applying them determined by the precedence of each style rule's best pattern from the InputBestPatterns.

  Parameters:
    InputSourceElement - The pre-parsed source element
    InputStyleRules - List of style rules to apply
    InputBestPatterns - The best pattern in each of the applicable style rules
  Returns:
    List of all style attributes from applicable style rules
  Throws: xs_StyleException
    Error applying style

selectRule

     public xs_RuleElement selectRule(xg_Element InputSourceElement) throws xs_StyleException

  Select the rule most suitable to the InputSourceElement. Search through the rules to find the best one.

  Parameters:
    InputSourceElement - The pre-parsed source element
  Throws: xs_StyleException
    Error applying style

invokeRuleActions

     public void invokeRuleActions(xs_RuleElement InputSelectedRule,
                                   xg_Element InputSourceElement,
                                   Writer InputResultsWriter,
                                   JProgressBar InputProgressBar) throws xs_StyleException, IOException

  Invoke the actions of the InputSelectedRule, to apply style to the given source element, and write the results to the InputResultsWriter.

  Parameters:
    InputSelectedRule - The rule whose actions are to be invoked
    InputSourceElement - The pre-parsed source element
    InputResultsWriter - The writer to which to write the results of applying a stylesheet to the source element
    InputProgressBar - Bar on which to show progress (as measured by the end offset of each node after it is processed).
  Throws: xs_StyleException
    Error applying style
  Throws: IOException
    Error writing to results writer

invokeRuleAction

     public void invokeRuleAction(xg_Node InputRuleAction,
                                  xg_Element InputSourceElement,
                                  Writer InputResultsWriter,
                                  JProgressBar InputProgressBar) throws xs_StyleException, IOException

  Invoke the InputRuleAction, to apply style to the InputSourceElement, and write the results to the InputResultsWriter. If InputRuleAction is an xs_ActionElement, invoke it to perform its specific type of XSL action; if InputRuleAction is an xg_Element, write its start tag, process its children (noting that one or more of them may be xs_ActionElement objects), then its end tag; otherwise just write the content of xs_ActionElement.

  This method is invoked recursively, when making our way through the children of an InputRuleAction.

  Parameters:
    InputRuleAction - The rule action to be invoked
    InputSourceElement - The pre-parsed source element
    InputResultsWriter - The writer to which to write the results of applying a stylesheet to the source element
    InputProgressBar - Bar on which to show progress (as measured by the end offset of each node after it is processed).
  Throws: xs_StyleException
    Error applying style
  Throws: IOException
    Error writing to results writer

invokeRuleActionChildren

     public void invokeRuleActionChildren(xg_Node InputRuleAction,
                                          xg_Element InputSourceElement,
                                          Writer InputResultsWriter,
                                          JProgressBar InputProgressBar) throws xs_StyleException, IOException

  Process each of the children InputRuleAction, treating each one as an action and invoking it.

  Parameters:
    InputRuleAction - The rule action whose children are to be invoked
    InputSourceElement - The pre-parsed source element
    InputResultsWriter - The writer to which to write the results of applying a stylesheet to the source element
    InputProgressBar - Bar on which to show progress (as measured by the end offset of each node after it is processed).
  Throws: xs_StyleException
    Error applying style
  Throws: IOException
    Error writing to results writer

getStylesheetDefn

     public xs_StylesheetDefn getStylesheetDefn()

  Get the definition of the stylesheet currently being applied.

  Returns:
    The definition of the stylesheet currently being applied

    All Packages  Class Hierarchy  This Package  Previous  Next  Index