You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Bummer <sa...@gmail.com> on 2007/05/17 13:41:22 UTC

doesn't work ? (Xpath router)

I have tried out the xpath router using xslt component.
It seems to work ok except that "<jbi:forward..." tag. 

I got the following error with <jbi:forward...>
[...]
[Fatal Error] :-1:-1: Premature end of file.
file:///D:/apache-servicemix-3.2-incubating-SNAPSHOT/dummy.xsl; row #0;
column #0; org.xml.sax.SAXParseException: Premature end of file.
[...]

So I had to use <jbi:invoke> instead with the following.

<jbi:invoke service="xpathrouting:trace">
     <jbi:copyProperties/>
     <xsl:copy-of select="/" />
 </jbi:invoke>

Isn't that supposed to be same as the following ?

<jbi:forward service="xpathrouting:trace"/>


-- 
View this message in context: http://www.nabble.com/%3Cjbi%3Afoward-...%3E-doesn%27t-work----%28Xpath-router%29-tf3771463s12049.html#a10662618
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: doesn't work ? (Xpath router)

Posted by mayra <ch...@ngc.com>.
I seem to be getting the same end of file warning with both forward and
invoke.  It actually completes the transformation, it just gives me the
"fatal error".  Was this issue ever resolved?  Below is my xsl, seems pretty
basic: 

- <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:jbi="xalan://org.apache.servicemix.components.xslt.XalanExtension"
extension-element-prefixes="jbi" xmlns:foo="http://servicemix.org/demo/"
version="1.0">
- <xsl:template match="/*">
- <xsl:choose>
- <!--  lets forward the inbound message to a service 
  --> 
- <xsl:when test="@id = '1'">
  <jbi:forward service="foo:fileSender1" /> 
  </xsl:when>
- <xsl:otherwise>
  <jbi:forward service="foo:fileSender2" /> 
  </xsl:otherwise>
  </xsl:choose>
  </xsl:template>
  </xsl:stylesheet>


Gert Vanthienen wrote:
> 
> L.S.,
> 
> I don't see anything wrong with this XSL.  Can you try to set the log 
> level to DEBUG and retry this to see if that gives us any useful 
> information?
> 
> Regards,
> 
> Gert
> 
> Bummer wrote:
>> Following is my router.xsl which was deployed inside xslt SU file.
>> =================
>>
>> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>> 	
>> xmlns:jbi="xalan://org.apache.servicemix.components.xslt.XalanExtension"
>> 		extension-element-prefixes="jbi"
>> 		xmlns:xpathrouting="http://servicemix.apache.org/samples/xpathrouting"
>> 		version="1.0">
>>    
>>    <xsl:template match="/*">
>>       <xsl:choose>
>> 	 <xsl:when test="@id = '4'">
>> 	    <!-- lets forward the inbound message to a service        -->
>> 	    <!-- forward doesn't seem to work !! use invoke instead   -->
>> 	    <!-- <jbi:forward service="xpathrouting:trace"/>          -->
>> 	    <jbi:invoke service="xpathrouting:trace">
>> 	       <jbi:copyProperties/>
>> 	       <xsl:copy-of select="/" />
>> 	    </jbi:invoke>
>> 	 </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'">
>> 	    <jbi:invoke service="xpathrouting:trace">
>> 	       <jbi:copyProperties/>
>> 	       <jbi:setOutProperty name="foo" select="@sent"/>
>> 	       <cheese code="{@id}">
>> 		  <description>This is some content generated from the routing
>> XSL</description>
>> 	       </cheese>
>> 	    </jbi:invoke>
>> 	 </xsl:when>
>> 	 
>> 	 <xsl:when test="@id != '2'">
>> 	    <jbi:forward service="xpathrouting:trace"/>
>> 	 </xsl:when>
>> 	 
>> 	 <xsl:otherwise>
>> 	    <jbi:forward service="xpathrouting:trace"/>
>> 	 </xsl:otherwise>
>>       </xsl:choose>
>>    </xsl:template>
>>    
>> </xsl:stylesheet>
>>   
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/%3Cjbi%3Afoward-...%3E-doesn%27t-work----%28Xpath-router%29-tf3771463s12049.html#a12192020
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: doesn't work ? (Xpath router)

Posted by Gert Vanthienen <ge...@skynet.be>.
L.S.,

I don't see anything wrong with this XSL.  Can you try to set the log 
level to DEBUG and retry this to see if that gives us any useful 
information?

Regards,

Gert

Bummer wrote:
> Following is my router.xsl which was deployed inside xslt SU file.
> =================
>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> 		xmlns:jbi="xalan://org.apache.servicemix.components.xslt.XalanExtension"
> 		extension-element-prefixes="jbi"
> 		xmlns:xpathrouting="http://servicemix.apache.org/samples/xpathrouting"
> 		version="1.0">
>    
>    <xsl:template match="/*">
>       <xsl:choose>
> 	 <xsl:when test="@id = '4'">
> 	    <!-- lets forward the inbound message to a service        -->
> 	    <!-- forward doesn't seem to work !! use invoke instead   -->
> 	    <!-- <jbi:forward service="xpathrouting:trace"/>          -->
> 	    <jbi:invoke service="xpathrouting:trace">
> 	       <jbi:copyProperties/>
> 	       <xsl:copy-of select="/" />
> 	    </jbi:invoke>
> 	 </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'">
> 	    <jbi:invoke service="xpathrouting:trace">
> 	       <jbi:copyProperties/>
> 	       <jbi:setOutProperty name="foo" select="@sent"/>
> 	       <cheese code="{@id}">
> 		  <description>This is some content generated from the routing
> XSL</description>
> 	       </cheese>
> 	    </jbi:invoke>
> 	 </xsl:when>
> 	 
> 	 <xsl:when test="@id != '2'">
> 	    <jbi:forward service="xpathrouting:trace"/>
> 	 </xsl:when>
> 	 
> 	 <xsl:otherwise>
> 	    <jbi:forward service="xpathrouting:trace"/>
> 	 </xsl:otherwise>
>       </xsl:choose>
>    </xsl:template>
>    
> </xsl:stylesheet>
>   


Re: doesn't work ? (Xpath router)

Posted by Bummer <sa...@gmail.com>.
Following is my router.xsl which was deployed inside xslt SU file.
=================

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
		xmlns:jbi="xalan://org.apache.servicemix.components.xslt.XalanExtension"
		extension-element-prefixes="jbi"
		xmlns:xpathrouting="http://servicemix.apache.org/samples/xpathrouting"
		version="1.0">
   
   <xsl:template match="/*">
      <xsl:choose>
	 <xsl:when test="@id = '4'">
	    <!-- lets forward the inbound message to a service        -->
	    <!-- forward doesn't seem to work !! use invoke instead   -->
	    <!-- <jbi:forward service="xpathrouting:trace"/>          -->
	    <jbi:invoke service="xpathrouting:trace">
	       <jbi:copyProperties/>
	       <xsl:copy-of select="/" />
	    </jbi:invoke>
	 </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'">
	    <jbi:invoke service="xpathrouting:trace">
	       <jbi:copyProperties/>
	       <jbi:setOutProperty name="foo" select="@sent"/>
	       <cheese code="{@id}">
		  <description>This is some content generated from the routing
XSL</description>
	       </cheese>
	    </jbi:invoke>
	 </xsl:when>
	 
	 <xsl:when test="@id != '2'">
	    <jbi:forward service="xpathrouting:trace"/>
	 </xsl:when>
	 
	 <xsl:otherwise>
	    <jbi:forward service="xpathrouting:trace"/>
	 </xsl:otherwise>
      </xsl:choose>
   </xsl:template>
   
</xsl:stylesheet>
-- 
View this message in context: http://www.nabble.com/%3Cjbi%3Afoward-...%3E-doesn%27t-work----%28Xpath-router%29-tf3771463s12049.html#a10729766
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: doesn't work ? (Xpath router)

Posted by Gert Vanthienen <ge...@skynet.be>.
L.S.,

Yes, this should get you the same result.  Can you post the complete XSL
file?  The exception seems to indicate that something else is wrong with
your XML file (unbalanced tags, forgotten a " around an attribute, ...)

Regards,

Gert Vanthienen


Bummer wrote:
> 
> I have tried out the xpath router using xslt component.
> It seems to work ok except that "<jbi:forward..." tag. 
> 
> I got the following error with <jbi:forward...>
> [...]
> [Fatal Error] :-1:-1: Premature end of file.
> file:///D:/apache-servicemix-3.2-incubating-SNAPSHOT/dummy.xsl; row #0;
> column #0; org.xml.sax.SAXParseException: Premature end of file.
> [...]
> 
> So I had to use <jbi:invoke> instead with the following.
> 
> <jbi:invoke service="xpathrouting:trace">
>      <jbi:copyProperties/>
>      <xsl:copy-of select="/" />
>  </jbi:invoke>
> 
> Isn't that supposed to be same as the following ?
> 
> <jbi:forward service="xpathrouting:trace"/>
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/%3Cjbi%3Afoward-...%3E-doesn%27t-work----%28Xpath-router%29-tf3771463s12049.html#a10714272
Sent from the ServiceMix - User mailing list archive at Nabble.com.