XSLT Adapter
The XSLT adapter (<<XSLTAdapter>>) enables the transformation of XML documents into XHTML documents or to other XML documents. The E2E Builder supports the import of XSLT scripts or XSLT script archives into the UML model. XSLT scripts can be called in the UML model with the XSLT adapter. The XSLT processor chosen in the component diagram executes the transformation as defined for the XSLT adapter in the activity diagram.
Refer to the example model referenced below, which shows how to transform an XML document into an HTML document.
Example File (Builder project Add-ons/XSLT):
<your example path>\Add-ons\XSLT\uml\xslt.xml |
Parameter
Refer to the example model referenced below, which shows how to transform an XML document into an HTML document.
Example File (Builder project Add-ons/XSLT):
<your example path>\Add-ons\XSLT\uml\xsltParameters.xml |
Logging with XSLT
It is possible to write logs into the E2E Bridge using XSLT. While the syntax for the two XSLT processors Saxon and Xalan is slightly different, the procedure is the same: First, the prefix must be declared. Second, the logging is executed.
Four methods are available for both loggers. The methods correspond to the Bridge Server Log Levels:
Method | Bridge Server Log Level |
---|---|
error | Error |
warning | Warning |
info | Info |
debug | Debug |
Examples
In the examples below, the syntax for the two XSLT processors Saxon and Xalan is shown using the method logger:info.
Logging with Saxon
<?xml version="1.0"?>
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
xmlns:logger="java:ch.e2e.bridge.server.xslt.XSLTSaxonLogger"
extension-element-prefixes="bridgeLog">
<xsl:template match="/">
<xsl:value-of select="logger:info('XSLT_01', 'Starting script mySaxonScript.xsl')"/>
</xsl:template>
</xsl:transform>
Logging with Xalan
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:xalan="http://xml.apache.org/xalan"
xmlns:logger="BridgeLogger"
extension-element-prefixes="logger">
<xalan:component prefix="logger" elements="debug info warning error">
<xalan:script lang="javaclass" src="xalan://ch.e2e.bridge.server.xslt.XSLTXalanLogger"/>
</xalan:component>
<xsl:template match="/">
<logger:info code="XSLT_01" message="Starting script myXalanScript.xsl"/>
</xsl:template>
</xsl:stylesheet>