| Commit in servicemix/base/src on MAIN | |||
| main/java/org/servicemix/components/xslt/XalanExtension.java | +4 | -4 | 1.2 -> 1.3 |
| test/resources/org/servicemix/components/xslt/router.xsl | +15 | -8 | 1.2 -> 1.3 |
| +19 | -12 | ||
tidied up the examples
servicemix/base/src/main/java/org/servicemix/components/xslt
diff -u -r1.2 -r1.3 --- XalanExtension.java 5 Aug 2005 08:13:32 -0000 1.2 +++ XalanExtension.java 5 Aug 2005 12:48:16 -0000 1.3 @@ -47,7 +47,7 @@
* An extension to allow <a href="">Xalan</a> to perform XPath based routing using * ServiceMix. *
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
*/
public class XalanExtension extends MarshalerSupport {
@@ -58,7 +58,7 @@
/**
* Forwards the inbound message to the destination copying the content and properties
*/
- public void invoke(XSLProcessorContext context, Element element) throws MessagingException {
+ public void forward(XSLProcessorContext context, Element element) throws MessagingException {
ComponentSupport component = getComponent(context, element);
if (component == null) {
throw new MessagingException("Could not find a component on which to perform the service invocation!");
@@ -82,7 +82,7 @@
/**
* Invokes the service with the XML content included in the XML element
*/
- public void invokeWith(XSLProcessorContext context, ElemTemplateElement element) throws MessagingException, ParserConfigurationException, TransformerException {
+ public void invoke(XSLProcessorContext context, ElemTemplateElement element) throws MessagingException, ParserConfigurationException, TransformerException {
ComponentSupport component = getComponent(context, element);
if (component == null) {
throw new MessagingException("Could not find a component on which to perform the service invocation!");
@@ -115,7 +115,7 @@
/**
* Calls the service with the XML content included in the XML element and outputs the XML content
*/
- public void callWith(XSLProcessorContext context, ElemTemplateElement element) throws MessagingException, ParserConfigurationException, TransformerException {
+ public void call(XSLProcessorContext context, ElemTemplateElement element) throws MessagingException, ParserConfigurationException, TransformerException {
ComponentSupport component = getComponent(context, element);
if (component == null) {
throw new MessagingException("Could not find a component on which to perform the service invocation!");
servicemix/base/src/test/resources/org/servicemix/components/xslt
diff -u -r1.2 -r1.3 --- router.xsl 5 Aug 2005 08:13:33 -0000 1.2 +++ router.xsl 5 Aug 2005 12:48:16 -0000 1.3 @@ -1,4 +1,5 @@
<?xml version="1.0"?>
+<!-- START SNIPPET: route -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:jbi="xalan://org.servicemix.components.xslt.XalanExtension" extension-element-prefixes="jbi"
@@ -8,26 +9,32 @@
<xsl:template match="/*">
<xsl:choose>
+ + <!-- lets forward the inbound message to a service --> + <xsl:when test="@id = '4'"> + <jbi:forward service="foo:trace"/> + </xsl:when> + + <!-- lets generate the output XML to use as input, copy the input properties and define some new propertes -->
<xsl:when test="@id = '12'">
- <!-- lets generate the output XML to invoke, copy the input properties and define some new ones --> - <jbi:invokeWith service="foo:script">
+ <jbi:invoke service="foo:script">
<jbi:copyProperties/>
<jbi:setOutProperty name="foo" select="@sent"/>
<cheese code="[EMAIL PROTECTED]">
<description>This is some content generated from the routing XSL</description>
</cheese>
- </jbi:invokeWith> - </xsl:when> - <xsl:when test="@id = '4'"> - <jbi:invoke service="foo:trace"/>
+ </jbi:invoke>
</xsl:when>
+
<xsl:when test="@id != '2'">
- <jbi:invoke service="foo:receiver"/>
+ <jbi:forward service="foo:receiver"/>
</xsl:when>
+
<xsl:otherwise>
- <jbi:invoke service="foo:trace"/>
+ <jbi:forward service="foo:trace"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
+<!-- END SNIPPET: route -->
