Example #1
0
  /**
   * <code>systemId</code> returns the system id of the current context node.
   *
   * @param context an <code>ExpressionContext</code> value
   * @return a <code>String</code> value
   */
  public static String systemId(ExpressionContext context) {
    Node contextNode = context.getContextNode();
    int nodeHandler = ((DTMNodeProxy) contextNode).getDTMNodeNumber();
    SourceLocator locator = ((DTMNodeProxy) contextNode).getDTM().getSourceLocatorFor(nodeHandler);

    if (locator != null) return locator.getSystemId();
    else return null;
  }
Example #2
0
  /**
   * <code>columnNumber</code> returns the column number of the current context node.
   *
   * <p>NOTE: Xalan does not normally record location information for each node. To obtain it, you
   * must set the custom TrAX attribute "http://xml.apache.org/xalan/features/source_location" true
   * in the TransformerFactory before generating the Transformer and executing the stylesheet.
   * Storage cost per node will be noticably increased in this mode.
   *
   * @param context an <code>ExpressionContext</code> value
   * @return an <code>int</code> value. This may be -1 to indicate that the column number is not
   *     known.
   */
  public static int columnNumber(ExpressionContext context) {
    Node contextNode = context.getContextNode();
    int nodeHandler = ((DTMNodeProxy) contextNode).getDTMNodeNumber();
    SourceLocator locator = ((DTMNodeProxy) contextNode).getDTM().getSourceLocatorFor(nodeHandler);

    if (locator != null) return locator.getColumnNumber();
    else return -1;
  }