0

I am using a framework where the XML DOM (instance of org.w3c.dom.Document) has listeners attached to it which basically helps it keeping track of all changes done to it once it was created (it is used internally to generate deltas). Now my requirement is to modify this DOM using XSL which will be passed to me from outside . I tried using Transformer but it always create new DOM which does not solves my purpose. I basically want to transform exisiting DOM based on some XSL . Any suggestions ?

ramoh
  • 153
  • 3
  • 15

1 Answers1

2

XSLT takes an input tree and transforms it into a new result tree, I don't think you can use XSLT the way you want, namely to manipulate an existing tree directly, without first creating a new tree.

Thus if you really want to manipulate an existing DOM Document object, use the W3C DOM API with methods like createElement, appendChild, replaceChild, setAttribute, XSLT is not useful if you can't afford the creation of a new tree.

Martin Honnen
  • 160,499
  • 6
  • 90
  • 110