pass distributed tracing data through xslt transformer
We have a service written in java which do xslt transformations with saxonica. On xslt stylesheets we call other services with fn:doc() or fn:document() functions suppling them HTTP URL. Now we are implementing distributed tracing of our services and faced with need to pass additional tracing headers in HTTP requests which lay under the fn:doc/fn:document calls. How can we achieve it? I guess that I need to supply something to XsltTransformer object but I can't understand what exactly it should be, unfortunately. Help please.
#1 Updated by Michael Kay about 2 months ago
Set a URIResolver on the XSLT Transformer; this will be passed details of URI's supplied to the doc() or document() functions. In your URIResolver, perform the HTTP access using low-level Java HTTP library calls (setting the headers as required), and returning a stream. Wrap this InputStream in a StreamSource, along with the requested (or resolved) URI, and return this from your URIResolver.
Please register to edit this issue