You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@synapse.apache.org by kbohnenberger <ke...@mantech.com> on 2009/03/25 17:38:50 UTC

need to filter based on results of an xslt

Given incoming xml ...
Is there a way to run an xslt over the incoming xml, look at the results of
the xslt and allow messages through if the xslt results return true.  If the
xslt returns false, I need to do some logging and drop the messages on the
floor.

It looks like I want to use something like the "filter" selection mediator
with the "then/else" but I need it to work off of the results of an xslt.

Thanks

Keith 
-- 
View this message in context: http://www.nabble.com/need-to-filter-based-on-results-of-an-xslt-tp22705788p22705788.html
Sent from the Synapse - User mailing list archive at Nabble.com.


Re: need to filter based on results of an xslt

Posted by "Asankha C. Perera" <as...@apache.org>.
Hi Keith
> Given incoming xml ...
> Is there a way to run an xslt over the incoming xml, look at the results of
> the xslt and allow messages through
Yes
>  if the xslt results return true.  
Not sure I understand this part .. The XSLT mediator "transforms" the 
present message and replaces it with the result of the transformation. 
Now after the XSLT mediator the present message is the result. Next you 
can use a filter mediator on this result as usual
> If the xslt returns false, I need to do some logging and drop the messages on the floor.
>
> It looks like I want to use something like the "filter" selection mediator
> with the "then/else" but I need it to work off of the results of an xslt.
>   
Does the above help you in your use case?

cheers
asankha

-- 
Asankha C. Perera
AdroitLogic, http://adroitlogic.org

http://esbmagic.blogspot.com





Re: need to filter based on results of an xslt

Posted by "Asankha C. Perera" <as...@apache.org>.
> I updated the documentation of the XSLT mediator [1]. You should be
> able to implement your use case with something like this:
>
> <xslt key="..." target="report"/>
> <switch source="$target/...">
>   ...
> </switch>
>
> Note that I didn't test this yet. If you encounter any problem, please
> let us know.
>   
This should work as expected.. I had forgotten about this feature 
myself, as I had not updated the docs :-)

cheers
asankha

-- 
Asankha C. Perera
AdroitLogic, http://adroitlogic.org

http://esbmagic.blogspot.com





Re: need to filter based on results of an xslt

Posted by Andreas Veithen <an...@gmail.com>.
Keith,

I updated the documentation of the XSLT mediator [1]. You should be
able to implement your use case with something like this:

<xslt key="..." target="report"/>
<switch source="$target/...">
  ...
</switch>

Note that I didn't test this yet. If you encounter any problem, please
let us know.

Regards,

Andreas

[1] http://people.apache.org/~veithen/synapse/Synapse_Configuration_Language.html#xslt

On Thu, Mar 26, 2009 at 16:20, kbohnenberger
<ke...@mantech.com> wrote:
>
>
>
> Keith,
>
> The problem with the XSLT mediator is indeed that it replaces the part
> of the message that is the source for the XSL transformation, i.e. the
> input of the transformation will be no longer available after the
> transformation. We are working on a set of mediators that allow to
> copy part of a message; they could be used to preserve the original
> message. Actually I would assume that any logic (returning true or
> false) implemented by an XSLT could also be implemented using XPath.
> Is that not possible in your case?
> < end quote >
>
> The logic that we need for "filtering" is pretty complex and can't
> reasonably be done with xpath.
> We run an xslt to check for messages that should get filtered out.  The xslt
> returns a report not a transformation of the incoming message.  Based on the
> results in the report, we allow the message through or we drop it and log
> some info on why we dropped it.
>
> I'm thinking of writing a custom mediator to handle this but I'm still new
> to Synapse so I'm not sure if that is the best path to go down.   Any
> alternative suggestions would be appreciated.
>
>
> Thanks
>
> Keith
>
>
> --
> View this message in context: http://www.nabble.com/need-to-filter-based-on-results-of-an-xslt-tp22705788p22724155.html
> Sent from the Synapse - User mailing list archive at Nabble.com.
>
>

Re: need to filter based on results of an xslt

Posted by Andreas Veithen <an...@gmail.com>.
The XSLT mediator actually supports storing the result of the
transformation in a property (instead of replacing the original node),
but this is not yet documented. If you use this feature you can then
check for the result of the transformation using a simple XPath
expression. I will update the documentation and come back to you.

Andreas

On Thu, Mar 26, 2009 at 16:20, kbohnenberger
<ke...@mantech.com> wrote:
>
>
>
> Keith,
>
> The problem with the XSLT mediator is indeed that it replaces the part
> of the message that is the source for the XSL transformation, i.e. the
> input of the transformation will be no longer available after the
> transformation. We are working on a set of mediators that allow to
> copy part of a message; they could be used to preserve the original
> message. Actually I would assume that any logic (returning true or
> false) implemented by an XSLT could also be implemented using XPath.
> Is that not possible in your case?
> < end quote >
>
> The logic that we need for "filtering" is pretty complex and can't
> reasonably be done with xpath.
> We run an xslt to check for messages that should get filtered out.  The xslt
> returns a report not a transformation of the incoming message.  Based on the
> results in the report, we allow the message through or we drop it and log
> some info on why we dropped it.
>
> I'm thinking of writing a custom mediator to handle this but I'm still new
> to Synapse so I'm not sure if that is the best path to go down.   Any
> alternative suggestions would be appreciated.
>
>
> Thanks
>
> Keith
>
>
> --
> View this message in context: http://www.nabble.com/need-to-filter-based-on-results-of-an-xslt-tp22705788p22724155.html
> Sent from the Synapse - User mailing list archive at Nabble.com.
>
>

Re: need to filter based on results of an xslt

Posted by kbohnenberger <ke...@mantech.com>.


Keith,

The problem with the XSLT mediator is indeed that it replaces the part
of the message that is the source for the XSL transformation, i.e. the
input of the transformation will be no longer available after the
transformation. We are working on a set of mediators that allow to
copy part of a message; they could be used to preserve the original
message. Actually I would assume that any logic (returning true or
false) implemented by an XSLT could also be implemented using XPath.
Is that not possible in your case?
< end quote >

The logic that we need for "filtering" is pretty complex and can't
reasonably be done with xpath.
We run an xslt to check for messages that should get filtered out.  The xslt
returns a report not a transformation of the incoming message.  Based on the
results in the report, we allow the message through or we drop it and log
some info on why we dropped it.

I'm thinking of writing a custom mediator to handle this but I'm still new
to Synapse so I'm not sure if that is the best path to go down.   Any
alternative suggestions would be appreciated.


Thanks

Keith


-- 
View this message in context: http://www.nabble.com/need-to-filter-based-on-results-of-an-xslt-tp22705788p22724155.html
Sent from the Synapse - User mailing list archive at Nabble.com.


Re: need to filter based on results of an xslt

Posted by Andreas Veithen <an...@gmail.com>.
Keith,

The problem with the XSLT mediator is indeed that it replaces the part
of the message that is the source for the XSL transformation, i.e. the
input of the transformation will be no longer available after the
transformation. We are working on a set of mediators that allow to
copy part of a message; they could be used to preserve the original
message. Actually I would assume that any logic (returning true or
false) implemented by an XSLT could also be implemented using XPath.
Is that not possible in your case?

Andreas

On Wed, Mar 25, 2009 at 17:38, kbohnenberger
<ke...@mantech.com> wrote:
>
> Given incoming xml ...
> Is there a way to run an xslt over the incoming xml, look at the results of
> the xslt and allow messages through if the xslt results return true.  If the
> xslt returns false, I need to do some logging and drop the messages on the
> floor.
>
> It looks like I want to use something like the "filter" selection mediator
> with the "then/else" but I need it to work off of the results of an xslt.
>
> Thanks
>
> Keith
> --
> View this message in context: http://www.nabble.com/need-to-filter-based-on-results-of-an-xslt-tp22705788p22705788.html
> Sent from the Synapse - User mailing list archive at Nabble.com.
>
>