A followup, the following XSL functions properly in XML Spy, but seems to
have no effect in ServiceMix:

<?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" xmlns:demo="http://servicemix.org/demo";
version="1.0">
        <xsl:template match="/*">
                <xsl:variable name="receiverID">
                        <xsl:value-of
select="ceXML/CexpInvoice/ReceiverID/text()"/>
                </xsl:variable>
                <xsl:choose>
                        <!-- lets forward the inbound message to a service
-->
                        <xsl:when test="$receiverID='PEOPLESOFT'">
                                <jbi:invoke service="demo:subscriber">
                                        <jbi:copyProperties/>
                                        <xsl:copy-of select="/"/>
                                </jbi:invoke>
                        </xsl:when>
                        <xsl:otherwise>
                                <!-- not working <jbi:forward
service="demo:subscriber"/> -->
                                <jbi:invoke service="demo:receiver">
                                        <jbi:copyProperties/>
                                        <xsl:copy-of select="/"/>
                                </jbi:invoke>
                        </xsl:otherwise>
                </xsl:choose>
        </xsl:template>
</xsl:stylesheet>

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, December 07, 2005 6:18 PM
> To: [email protected]
> Subject: [servicemix-user] XPath Router Question
> 
> 
> I know that I'm missing something obvious here, and am 
> hopeful that some one
> will be able to point out my folly to me. I am working on a 
> simple XPath
> Router that should perform a query on the body of an incoming 
> XML message
> and route appropriately. My logic is as follows:
> 
> <xsl:template match="/*">
>   <xsl:choose>
>     <xsl:when test="ceXML/CexpInvoice/RecieverID/text() = 
> 'PEOPLESOFT'">
>       <jbi:invoke ...
>     </xsl:when>
>     <xsl:otherwise>
>       <jbi:invoke ...
>     </xsl:otherwise>
> 
> The body of the XML looks like this:
> <!xml version="1.0" encoding="UTF-8"?>
> <Message xmlns="...">
> <ceXML>
>   <CexpInvoice>
>     <ReceiverID>PEOPLESOFT</ReceiverID>
>     <SenderID>12345</SenderID>
>     <TransactionID>TRD</TransactionID>
> 
> 
> I'd think that the match command positions me within the 
> <Message> node, so
> that the comparison should be from that point on down. This 
> code never works
> as expected - the <xsl:otherwise> route is always selected, 
> so I think that
> my XPat is bad. Any help is appreciated.
> 
> /jonathan
> 

Reply via email to