Search in sources :

Example 1 with XslTypeTransformation

use of eu.esdihumboldt.hale.io.xslt.XslTypeTransformation in project hale by halestudio.

the class XsltGenerator method generateTypeTransformation.

/**
 * Generate a XSL fragment for transformation based on the given type
 * relation.
 *
 * @param templateName name of the XSL template
 * @param typeCell the type relation
 * @param targetfile the target file to write the fragment to
 * @param targetElement the target element to use to hold a transformed
 *            instance
 * @throws TransformationException if an unrecoverable error occurs during
 *             the XSLT transformation generation
 */
protected void generateTypeTransformation(String templateName, XmlElement targetElement, Cell typeCell, File targetfile) throws TransformationException {
    XslTypeTransformation xslt;
    try {
        xslt = XslTypeTransformationExtension.getInstance().getTransformation(typeCell.getTransformationIdentifier());
    } catch (Exception e) {
        throw new TransformationException("Could not retrieve XSLT transformation generator for cell function", e);
    }
    xslt.setContext(context);
    xslt.generateTemplate(templateName, targetElement, typeCell, new FileIOSupplier(targetfile));
}
Also used : TransformationException(eu.esdihumboldt.hale.common.align.transformation.function.TransformationException) XslTypeTransformation(eu.esdihumboldt.hale.io.xslt.XslTypeTransformation) FileIOSupplier(eu.esdihumboldt.hale.common.core.io.supplier.FileIOSupplier) XMLStreamException(javax.xml.stream.XMLStreamException) TransformationException(eu.esdihumboldt.hale.common.align.transformation.function.TransformationException) ParseErrorException(org.apache.velocity.exception.ParseErrorException) IOException(java.io.IOException) ResourceNotFoundException(org.apache.velocity.exception.ResourceNotFoundException)

Aggregations

TransformationException (eu.esdihumboldt.hale.common.align.transformation.function.TransformationException)1 FileIOSupplier (eu.esdihumboldt.hale.common.core.io.supplier.FileIOSupplier)1 XslTypeTransformation (eu.esdihumboldt.hale.io.xslt.XslTypeTransformation)1 IOException (java.io.IOException)1 XMLStreamException (javax.xml.stream.XMLStreamException)1 ParseErrorException (org.apache.velocity.exception.ParseErrorException)1 ResourceNotFoundException (org.apache.velocity.exception.ResourceNotFoundException)1