stylesheet.java

来自「java jdk 1.4的源码」· Java 代码 · 共 1,548 行 · 第 1/3 页

JAVA
1,548
字号
  /**   * Get the number of imported stylesheets.   * @see <a href="http://www.w3.org/TR/xslt#import">import in XSLT Specification</a>   *   * @return the number of imported stylesheets.   */  public int getImportCount()  {    return (null != m_imports) ? m_imports.size() : 0;  }  /**   * The "xsl:include" properties.   * @serial   */  private Vector m_includes;  /**   * Add a stylesheet to the "include" list.   * @see <a href="http://www.w3.org/TR/xslt#include">include in XSLT Specification</a>   *   * @param v Stylesheet to add to the "include" list     */  public void setInclude(Stylesheet v)  {    if (null == m_includes)      m_includes = new Vector();    m_includes.addElement(v);  }  /**   * Get the stylesheet at the given in index in "include" list   * @see <a href="http://www.w3.org/TR/xslt#include">include in XSLT Specification</a>   *   * @param i Index of stylesheet to get   *   * @return Stylesheet at the given index   *   * @throws ArrayIndexOutOfBoundsException   */  public Stylesheet getInclude(int i) throws ArrayIndexOutOfBoundsException  {    if (null == m_includes)      throw new ArrayIndexOutOfBoundsException();    return (Stylesheet) m_includes.elementAt(i);  }  /**   * Get the number of included stylesheets.   * @see <a href="http://www.w3.org/TR/xslt#import">import in XSLT Specification</a>   *   * @return the number of included stylesheets.   */  public int getIncludeCount()  {    return (null != m_includes) ? m_includes.size() : 0;  }  /**   * Table of tables of element decimal-format.   * @see DecimalFormatProperties   * @serial   */  Stack m_DecimalFormatDeclarations;  /**   * Process the xsl:decimal-format element.   *   * @param edf Decimal-format element to push into stack     */  public void setDecimalFormat(DecimalFormatProperties edf)  {    if (null == m_DecimalFormatDeclarations)      m_DecimalFormatDeclarations = new Stack();    // Elements are pushed in by order of importance    // so that when recomposed, they get overiden properly.    m_DecimalFormatDeclarations.push(edf);  }  /**   * Get an "xsl:decimal-format" property.   *    * @see DecimalFormatProperties   * @see <a href="http://www.w3.org/TR/xslt#format-number">format-number in XSLT Specification</a>   *   * @param name The qualified name of the decimal format property.   * @return null if not found, otherwise a DecimalFormatProperties   * object, from which you can get a DecimalFormatSymbols object.   */  public DecimalFormatProperties getDecimalFormat(QName name)  {    if (null == m_DecimalFormatDeclarations)      return null;    int n = getDecimalFormatCount();    for (int i = (n - 1); i >= 0; i++)    {      DecimalFormatProperties dfp = getDecimalFormat(i);      if (dfp.getName().equals(name))        return dfp;    }    return null;  }  /**   * Get an "xsl:decimal-format" property.   * @see <a href="http://www.w3.org/TR/xslt#format-number">format-number in XSLT Specification</a>   * @see DecimalFormatProperties   *   * @param i Index of decimal-format property in stack   *   * @return The decimal-format property at the given index    *   * @throws ArrayIndexOutOfBoundsException   */  public DecimalFormatProperties getDecimalFormat(int i)          throws ArrayIndexOutOfBoundsException  {    if (null == m_DecimalFormatDeclarations)      throw new ArrayIndexOutOfBoundsException();    return (DecimalFormatProperties) m_DecimalFormatDeclarations.elementAt(i);  }  /**   * Get the number of xsl:decimal-format declarations.   * @see DecimalFormatProperties   *   * @return the number of xsl:decimal-format declarations.   */  public int getDecimalFormatCount()  {    return (null != m_DecimalFormatDeclarations)           ? m_DecimalFormatDeclarations.size() : 0;  }  /**   * The "xsl:strip-space" properties,   * A lookup table of all space stripping elements.   * @serial   */  private Vector m_whitespaceStrippingElements;  /**   * Set the "xsl:strip-space" properties.   * @see <a href="http://www.w3.org/TR/xslt#strip">strip in XSLT Specification</a>   *   * @param wsi WhiteSpaceInfo element to add to list    */  public void setStripSpaces(WhiteSpaceInfo wsi)  {    if (null == m_whitespaceStrippingElements)    {      m_whitespaceStrippingElements = new Vector();    }    m_whitespaceStrippingElements.addElement(wsi);  }  /**   * Get an "xsl:strip-space" property.   * @see <a href="http://www.w3.org/TR/xslt#strip">strip in XSLT Specification</a>   *   * @param i Index of WhiteSpaceInfo to get   *   * @return WhiteSpaceInfo at given index   *   * @throws ArrayIndexOutOfBoundsException   */  public WhiteSpaceInfo getStripSpace(int i) throws ArrayIndexOutOfBoundsException  {    if (null == m_whitespaceStrippingElements)      throw new ArrayIndexOutOfBoundsException();    return (WhiteSpaceInfo) m_whitespaceStrippingElements.elementAt(i);  }  /**   * Get the number of "xsl:strip-space" properties.   * @see <a href="http://www.w3.org/TR/xslt#strip">strip in XSLT Specification</a>   *   * @return the number of "xsl:strip-space" properties.   */  public int getStripSpaceCount()  {    return (null != m_whitespaceStrippingElements)           ? m_whitespaceStrippingElements.size() : 0;  }  /**   * The "xsl:preserve-space" property,   * A lookup table of all space preserving elements.   * @serial   */  private Vector m_whitespacePreservingElements;  /**   * Set the "xsl:preserve-space" property.   * @see <a href="http://www.w3.org/TR/xslt#strip">strip in XSLT Specification</a>   *   * @param wsi WhiteSpaceInfo element to add to list   */  public void setPreserveSpaces(WhiteSpaceInfo wsi)  {    if (null == m_whitespacePreservingElements)    {      m_whitespacePreservingElements = new Vector();    }    m_whitespacePreservingElements.addElement(wsi);  }  /**   * Get a "xsl:preserve-space" property.   * @see <a href="http://www.w3.org/TR/xslt#strip">strip in XSLT Specification</a>   *   * @param i Index of WhiteSpaceInfo to get   *   * @return WhiteSpaceInfo at the given index   *   * @throws ArrayIndexOutOfBoundsException   */  public WhiteSpaceInfo getPreserveSpace(int i) throws ArrayIndexOutOfBoundsException  {    if (null == m_whitespacePreservingElements)      throw new ArrayIndexOutOfBoundsException();    return (WhiteSpaceInfo) m_whitespacePreservingElements.elementAt(i);  }  /**   * Get the number of "xsl:preserve-space" properties.   * @see <a href="http://www.w3.org/TR/xslt#strip">strip in XSLT Specification</a>   *   * @return the number of "xsl:preserve-space" properties.   */  public int getPreserveSpaceCount()  {    return (null != m_whitespacePreservingElements)           ? m_whitespacePreservingElements.size() : 0;  }  /**   * The "xsl:output" properties.  This is a vector of OutputProperties objects.   * @serial   */  private Vector m_output;  /**   * Set the "xsl:output" property.   * @see <a href="http://www.w3.org/TR/xslt#output">output in XSLT Specification</a>   *   * @param v non-null reference to the OutputProperties object to be    *          added to the collection.   */  public void setOutput(OutputProperties v)  {    if (null == m_output)    {      m_output = new Vector();    }    m_output.addElement(v);  }  /**   * Get an "xsl:output" property.   * @see <a href="http://www.w3.org/TR/xslt#output">output in XSLT Specification</a>   *   * @param i Index of OutputFormatExtended to get   *   * @return non-null reference to an OutputProperties object.   *   * @throws ArrayIndexOutOfBoundsException   */  public OutputProperties getOutput(int i) throws ArrayIndexOutOfBoundsException  {    if (null == m_output)      throw new ArrayIndexOutOfBoundsException();    return (OutputProperties) m_output.elementAt(i);  }  /**   * Get the number of "xsl:output" properties.   * @see <a href="http://www.w3.org/TR/xslt#output">output in XSLT Specification</a>   *   * @return The number of OutputProperties objects contained in this stylesheet.   */  public int getOutputCount()  {    return (null != m_output)           ? m_output.size() : 0;  }  /**   * The "xsl:key" property.   * @serial   */  private Vector m_keyDeclarations;  /**   * Set the "xsl:key" property.   * @see <a href="http://www.w3.org/TR/xslt#key">key in XSLT Specification</a>   *   * @param v KeyDeclaration element to add to the list of key declarations    */  public void setKey(KeyDeclaration v)  {    if (null == m_keyDeclarations)      m_keyDeclarations = new Vector();    m_keyDeclarations.addElement(v);  }  /**   * Get an "xsl:key" property.   * @see <a href="http://www.w3.org/TR/xslt#key">key in XSLT Specification</a>   *   * @param i Index of KeyDeclaration element to get   *   * @return KeyDeclaration element at given index in list    *   * @throws ArrayIndexOutOfBoundsException   */  public KeyDeclaration getKey(int i) throws ArrayIndexOutOfBoundsException  {    if (null == m_keyDeclarations)      throw new ArrayIndexOutOfBoundsException();    return (KeyDeclaration) m_keyDeclarations.elementAt(i);  }  /**   * Get the number of "xsl:key" properties.   * @see <a href="http://www.w3.org/TR/xslt#key">key in XSLT Specification</a>   *   * @return the number of "xsl:key" properties.   */  public int getKeyCount()  {    return (null != m_keyDeclarations) ? m_keyDeclarations.size() : 0;  }  /**   * The "xsl:attribute-set" property.   * @serial   */  private Vector m_attributeSets;  /**   * Set the "xsl:attribute-set" property.   * @see <a href="http://www.w3.org/TR/xslt#attribute-sets">attribute-sets in XSLT Specification</a>   *   * @param attrSet ElemAttributeSet to add to the list of attribute sets   */  public void setAttributeSet(ElemAttributeSet attrSet)  {    if (null == m_attributeSets)    {      m_attributeSets = new Vector();    }    m_attributeSets.addElement(attrSet);  }  /**   * Get an "xsl:attribute-set" property.   * @see <a href="http://www.w3.org/TR/xslt#attribute-sets">attribute-sets in XSLT Specification</a>   *   * @param i Index of ElemAttributeSet to get in list   *   * @return ElemAttributeSet at the given index   *   * @throws ArrayIndexOutOfBoundsException   */  public ElemAttributeSet getAttributeSet(int i)          throws ArrayIndexOutOfBoundsException  {    if (null == m_attributeSets)      throw new ArrayIndexOutOfBoundsException();    return (ElemAttributeSet) m_attributeSets.elementAt(i);  }  /**   * Get the number of "xsl:attribute-set" properties.   * @see <a href="http://www.w3.org/TR/xslt#attribute-sets">attribute-sets in XSLT Specification</a>   *   * @return the number of "xsl:attribute-set" properties.   */  public int getAttributeSetCount()  {    return (null != m_attributeSets) ? m_attributeSets.size() : 0;  }  /**   * The "xsl:variable" and "xsl:param" properties.   * @serial   */  private Vector m_topLevelVariables;  /**   * Set the "xsl:variable" property.   * @see <a href="http://www.w3.org/TR/xslt#top-level-variables">top-level-variables in XSLT Specification</a>   *   * @param v ElemVariable object to add to list of top level variables   */  public void setVariable(ElemVariable v)  {    if (null == m_topLevelVariables)      m_topLevelVariables = new Vector();    m_topLevelVariables.addElement(v);  }    /**   * Get an "xsl:variable" or "xsl:param" property.   * @see <a href="http://www.w3.org/TR/xslt#top-level-variables">top-level-variables in XSLT Specification</a>   *   * @param qname non-null reference to the qualified name of the variable.   *   * @return The ElemVariable with the given name in the list or null   */  public ElemVariable getVariableOrParam(QName qname)  {    if (null != m_topLevelVariables)    {      int n = getVariableOrParamCount();      for (int i = 0; i < n; i++)      {        ElemVariable var = (ElemVariable) getVariableOrParam(i);        if (var.getName().equals(qname))          return var;      }    }    return null;  }  /**   * Get an "xsl:variable" property.   * @see <a href="http://www.w3.org/TR/xslt#top-level-variables">top-level-variables in XSLT Specification</a>   *   * @param qname Qualified name of the xsl:variable to get    *   * @return reference to the variable named by qname, or null if not found.   */  public ElemVariable getVariable(QName qname)  {    if (null != m_topLevelVariables)    {      int n = getVariableOrParamCount();      for (int i = 0; i < n; i++)      {        ElemVariable var = getVariableOrParam(i);        if((var.getXSLToken() == Constants.ELEMNAME_VARIABLE) &&           (var.getName().equals(qname)))          return var;      }    }    return null;  }  /**   * Get an "xsl:variable" property.   * @see <a href="http://www.w3.org/TR/xslt#top-level-variables">top-level-variables in XSLT Specification</a>   *   * @param i Index of variable to get in the list   *   * @return ElemVariable at the given index in the list    *   * @throws ArrayIndexOutOfBoundsException   */  public ElemVariable getVariableOrParam(int i) throws ArrayIndexOutOfBoundsException  {    if (null == m_topLevelVariables)      throw new ArrayIndexOutOfBoundsException();    return (ElemVariable) m_topLevelVariables.elementAt(i);  }  /**   * Get the number of "xsl:variable" properties.   * @see <a href="http://www.w3.org/TR/xslt#top-level-variables">top-level-variables in XSLT Specification</a>   *   * @return the number of "xsl:variable" properties.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?