开发者

Tracing source elements through multiple XSL transforms

I'm looking for ideas on how to trace source elements throughout multiple XML to XML transformations. I have very large policy XMLs that are 3-50MB that go through at least two separate XSLTs at different times. The XSLTs thems开发者_运维技巧elves have thousands and thousands of lines of code. The output can be vastly different depending on the source XML.

Example: Say I have a source element called COMMISSION that is 10 levels deep in the original source XML:

<COMMISSION>$0.00</COMMISSION>

and after two separate transforms it is now called B_COMMSN two levels in

<B_COMMSN>$0.00</B_COMMSN>

I'm not the original coder and I need a way to quickly find what the original source element of B_COMMSN is...other than tracing back through the XSLTs and all the templates. This will just be a tool for me...so code efficiency isn't the highest priority...XSLT 2.0 is fine.

Simply changing all the values to unique numbers isn't sufficient because 1) the XSLTs contain data-type comparisons, and 2) Lookups are done. For instance I might have location number 3 in one element and the XSLT uses that value to go to another nodeset to look up the address for that location.

Ideas??? Solutions??? Is it all wishful thinking?


A number of IDEs (e.g. IIRC Oxygen and Stylus Studio) do "backtracking" - telling you where in the stylesheet a particular result tree node was generated, and/or what the context in the source document was at the time. You won't be able to automate the analysis all the way back through several stylesheets, but it's a useful investigative tool.


If this could help even just a bit:

Some XSLT 1.0 debuggers have "data breakpoints" -- setting a breakpoint on a certain node in an XML document causes the debugger to break every time this node has is matched by an <xsl:template> or <xsl:for-each>.

Of course, the most general case of this problem is ill-defined and unsolvable, because a single node may affect many output nodes/items, and a specific output node/item may depend on a number of nodes from different XML documents.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜