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