code: protected void addImports(Stylesheet stylesheet, boolean addToList, Vector importList)
    {
  
      // Get the direct imports of this sheet.
  
      int n = stylesheet.getImportCount();
  
      if (n > 0)
      {
        for (int i = 0; i < n; i++)
        {
          Stylesheet imported = stylesheet.getImport(i);
  
          addImports(imported, true, importList);
        }
      }
  
      n = stylesheet.getIncludeCount();
  
      if (n > 0)
      {
        for (int i = 0; i < n; i++)
        {
          Stylesheet included = stylesheet.getInclude(i);
  
          addImports(included, false, importList);
        }
      }
  
      if (addToList)
        importList.addElement(stylesheet);
  
    }
docs: Add the imports in the given sheet to the working importList vector.
  The will be added from highest import precedence to
  least import precedence.  This is a post-order traversal of the
  import tree as described in <a href="http://www.w3.org/TR/xslt.html#import">the
  XSLT Recommendation</a>.
  <p>For example, suppose</p>
  <p>stylesheet A imports stylesheets B and C in that order;</p>
  <p>stylesheet B imports stylesheet D;</p>
  <p>stylesheet C imports stylesheet E.</p>
  <p>Then the order of import precedence (highest first) is
  A, C, E, B, D.</p>
  
  @param stylesheet Stylesheet to examine for imports.
  @param addToList  <code>true</code> if this template should be added to the import list
  @param importList The working import list.  Templates are added here in the reverse
  order of priority.  When we're all done, we'll reverse this to the correct
  priority in an array.