I'm not sure if this is possible (but I haven't played with Saxon component
much),
you could put this information into message payload instead of property (in
marshaller, or somewhere else) but it's ugly workaround because it mixes
data and metadata 


java programmer-2 wrote:
> 
> Hello,
> I have a question about the way how I can add attribute / variable /
> something else to saxon XSLT transformation (or process after that
> transformation if isn't possible directly in XSLT).
> Probabbly better than words would be piece of code:
> 
> I have got marshaller which allows me to get time when I enter the
> marshaller, and when I leave marshaller so I can set property as
> difference between those two times, and send it further - marshaller
> communicates between connector (here I measure the time of remote
> request), which is a normal HTTP binding component designed in XML:
> <http:provider service="myhttpProvider"                                       
>                                          endpoint="myhttpEndpoint"
>                                          marshaler="#myProviderMarshaler" 
> .... />
> 
> Here is myProviderMarshaler:
> 
> public class HttpProviderMarshaler extends DefaultHttpProviderMarshaler {
>       
>       public void handleResponse(MessageExchange messageExchange,
> SmxHttpExchange smxHttpExchange) throws Exception {
>               NormalizedMessage inMessage = messageExchange.getMessage("in");
>               super.handleResponse(messageExchange, smxHttpExchange);
>               NormalizedMessage outMessage = 
> messageExchange.getMessage("out");
>               outMessage.setProperty("timing", System.nanoTime() - ((Long)
> inMessage.getProperty("timing")));
>       }
> 
>       public void createRequest(MessageExchange exchange, NormalizedMessage
> inMessage, SmxHttpExchange httpExchange) throws Exception {
>               super.createRequest(exchange, inMessage, httpExchange);
>               inMessage.setProperty("timing", System.nanoTime());
>       }
> }
> 
> This part working fine - but I don't know how can I get this property
> into transformation part:
> <saxon:xslt service="responseXsltTransformator" endpoint="endpoint"
> resource="classpath:xslt/response.xslt" />
> 
> I need to put that JBI property "timing" into XSLT template, as
> variable / constant / anything else - but I don't know the way it's
> commonly done. Saxon has <saxon:parameters> but how can I get here
> property "timing", and how I can send it to template?
> 
> Can you help me with that part?
> 
> Thanks in advance,
> Adr
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Add-attribute-to-XSLT-transformation-from-JBI-header-tp20458578p20479960.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Reply via email to