Efficient XSLT pipeline, with params, in Java

后端 未结 2 837
孤城傲影
孤城傲影 2021-01-18 17:00

The top answer to this question describes a technique to implement an efficient XSLT pipeline in Java:

Efficient XSLT pipeline in Java (or redirecting Results to Sou

2条回答
  •  旧巷少年郎
    2021-01-18 17:50

    The problem is that each TransformerHandler has a separate Transformer associated with it. There's a problem with your 2nd template, but as this is an example I guess that doesn't matter. You want:

    //SETTING PARAMETERS HERE
    th1.getTransformer().setParameter("foo","this is from param 1");
    th2.getTransformer().setParameter("bar","this is from param 2");
    

    Note that you also don't need to create a 3rd transformer you can just start the transform chain on th1.getTransformer()

提交回复
热议问题