org.ejen.ext
Class XSLUtil

java.lang.Object
  |
  +--org.ejen.ext.XSLUtil

public class XSLUtil
extends Object

XSL operations utility (static methods).

This class only wrappes some methods implemented in the XSLUtil class.

Usage (XSL stylesheet)

  <?xml version="1.0" encoding="iso-8859-1"?>

  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                  ...
                  xmlns:xsu="org.ejen.ext.XSLUtil"
                  extension-element-prefixes="xsu ..."
                  exclude-result-prefixes="xsu ..."
                  version="1.0">

    <xsl:output method="xml" encoding="iso-8859-1"/>

    <xsl:template match="ejen">

      <xsu:evaluate avt="{./file}.xml"/>
      <xsl:variable name="avt" select="xsu:evaluate('{./file}.xml')"/>
      <xsl:if test="xsu:equals($nodes1,$nodes2)">
        ...
      </xsl:if>
      <xsl:if test="xsu:equals($node1,$node2)">
        ...
      </xsl:if>

    </xsl:template>

  </xsl:stylesheet>
 

Version:
1.0
Author:
F. Wolff

Constructor Summary
protected XSLUtil()
          Prevents instanciation.
 
Method Summary
static boolean equals(ExpressionContext context, NodeIterator ni1, NodeIterator ni2)
          Checks ni1 and ni2 for strict equality (same names, same attributes, same child nodes...).
static boolean equals(ExpressionContext context, Node n1, Node n2)
          Checks n1 and n2 for strict equality (same names, same attributes, same child nodes...).
static String evaluate(ExpressionContext context, String avt)
          Returns an interpreted value (AVT) of a Node attribute whose name is equals to the avt parameter.
static String evaluate(XSLProcessorContext context, ElemExtensionCall elem)
          Returns an interpreted value (AVT) of a Node attribute whose name is "avt".
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XSLUtil

protected XSLUtil()
Prevents instanciation.

Method Detail

evaluate

public static String evaluate(XSLProcessorContext context,
                              ElemExtensionCall elem)
Returns an interpreted value (AVT) of a Node attribute whose name is "avt".


  <xsu:evaluate avt="{./file}.xml"/>
 

XSLT Attributes:
avt [Mandatory/AVT] AVT to be evaluated.

Parameters:
context - the XSLProcessorContext to be used.
elem - the ElemExtensionCall to be used.
Returns:
the evaluated result.
Throws:
IllegalArgumentException - bad context.
WrappedRuntimeException - ...

evaluate

public static String evaluate(ExpressionContext context,
                              String avt)
Returns an interpreted value (AVT) of a Node attribute whose name is equals to the avt parameter.


  <xsl:variable name="avt" select="xsu:evaluate('{./file}.xml')">
 

XSLT parameters:
[Mandatory/AVT] AVT expression to be evaluated.

Parameters:
context - automatically passed by the xalan extension mechanism.
avt - the name of the attribute.
Returns:
the evaluated result.
Throws:
IllegalArgumentException - bad context.
WrappedRuntimeException - ...

equals

public static boolean equals(ExpressionContext context,
                             NodeIterator ni1,
                             NodeIterator ni2)
Checks ni1 and ni2 for strict equality (same names, same attributes, same child nodes...).


  <xsl:if test="xsu:equals($nodes1,$nodes2)">
    ...
  </xsl:if>
 

XSLT parameters:
[Mandatory] the first NodeIterator.
[Mandatory] the second NodeIterator.

Parameters:
context - automatically passed by the xalan extension mechanism.
ni1 - the first NodeIterator.
ni2 - the second NodeIterator.
Returns:
true if ni1 equals ni2, false otherwise.

equals

public static boolean equals(ExpressionContext context,
                             Node n1,
                             Node n2)
Checks n1 and n2 for strict equality (same names, same attributes, same child nodes...).


  <xsl:if test="xsu:equals($node1,$node2)">
    ...
  </xsl:if>
 

XSLT parameters:
[Mandatory] the first Node.
[Mandatory] the second Node.

Parameters:
context - automatically passed by the xalan extension mechanism.
n1 - the first Node.
n2 - the second Node.
Returns:
true if n1 equals n2, false otherwise.