You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Jaime Fernández <jj...@gmail.com> on 2006/03/21 16:06:34 UTC

XPath Router

I've tested XPath router in a very simple example as it's explained in
http://www.servicemix.org/XPath+Router. I want to route to two diferent ESB
services depending on the value of one of the fields. I want to use the
jbi:forward tag, but it fails with the next exception:
...
[Fatal Error] :-1:-1: Premature end of file.
file:///C:/java/servicemix-3.0-SNAPSHOT_18032006/examples/test/res/branch.xsl;
Line num.13; Column num.44; org.xml.sax.SAXParseException: Premature end of
file.
...
However it works with jbi:invoke.
Here it is the xsl file where the first routing condition is correct
(invoke) but the second one fails (forward):

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="
http://www.w3.org/1999/XSL/Transform"
xmlns:jbi="xalan://org.apache.servicemix.components.xslt.XalanExtension"
xmlns:telas="http://www.telas.com/test" extension-element-prefixes="jbi">
    <xsl:template match="/*">
        <xsl:choose>
            <xsl:when test="telas:fieldCheck >= '10000'">
                <jbi:invoke service="telas:service1">
                    <jbi:copyProperties/>
                    <xsl:copy-of select="/"/>
                </jbi:invoke>
            </xsl:when>
            <xsl:when test="telas:fieldCheck &lt; 10000 ">
                <jbi:forward service="telas:service2"/>
            </xsl:when>
        </xsl:choose>
    </xsl:template>
</xsl:stylesheet>