org.activemath.exercises.openmath
Class ExpressionTransformer

java.lang.Object
  extended by org.activemath.exercises.openmath.ExpressionTransformer
Direct Known Subclasses:
ExpressionTransformerWiris, ExpressionTransformerYacas

public class ExpressionTransformer
extends Object

OpenMath expression transformer. Transforms an OM expression into another.

Version:
$Revision: 1.5 $ $Date: 2009/10/25 17:57:59 $

Constructor Summary
ExpressionTransformer()
           
 
Method Summary
 Templates compileStylesheet(String stylesheetPath)
          Create an XSTL compiled stylesheet object with the given stylesheet file.
protected  org.jdom.Document getStylesheet(String stylesheetPath)
           
 org.jdom.Element transform(org.jdom.Element input, Transformer transformer)
          Transform the given input using the given XSLT transformer.
 org.jdom.Element transformFromService(org.jdom.Element expressionOmobj)
          Transform the expression from the format provided by the service.
 org.jdom.Element transformToService(org.jdom.Element expressionOmobj)
          Transform the expression to the format required by the service.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExpressionTransformer

public ExpressionTransformer()
Method Detail

transformToService

public org.jdom.Element transformToService(org.jdom.Element expressionOmobj)
Transform the expression to the format required by the service. The version in the base class just returns the given expression without modification.

Parameters:
expressionOmobj - Mathematical expression to be transformed, as a JDOM tree.
Returns:
transformed expression, as a JDOM tree.

transformFromService

public org.jdom.Element transformFromService(org.jdom.Element expressionOmobj)
Transform the expression from the format provided by the service. The version in the base class just returns the given expression without modification.

Parameters:
expressionOmobj - Mathematical expression to be transformed, as a JDOM tree.
Returns:
transformed expression, as a JDOM tree.

compileStylesheet

public Templates compileStylesheet(String stylesheetPath)
                            throws TransformerException
Create an XSTL compiled stylesheet object with the given stylesheet file. Just a convenience function for subclasses.

Parameters:
stylesheetPath - path to the XSLT stylesheet file.
Returns:
XSLT stylesheet, compiled into a Templates object.
Throws:
TransformerException - if there is some problem with the stylesheet.

transform

public org.jdom.Element transform(org.jdom.Element input,
                                  Transformer transformer)
Transform the given input using the given XSLT transformer. Just a convenience function for subclasses.

Parameters:
input - XML tree.
transformer - XSLT transformer object produced with newTransformer.
Returns:
transformed XML tree.

getStylesheet

protected org.jdom.Document getStylesheet(String stylesheetPath)