i'm again. I've a new problem.
I like to strip/reduce an xml structure to only needed elements.
To explain the problem i built a simplyfied random structure.
<ROOT>
<DATA>
<ALLOC>
<TYPE>Test</TYPE>
<NAME>something text</NAME>
<VALUE>4711</VALUE>
</ALLOC>
<ALLOC>
<TYPE>Test</TYPE>
<NAME>something text</NAME>
<VALUE>4712</VALUE>
</ALLOC>
<ALLOC>
<TYPE>Test</TYPE>
<NAME>something text</NAME>
<VALUE>4713</VALUE>
</ALLOC>
</DATA>
<SOURCE>
<CONNECTION>
<TYPE>SQL</TYPE>
<VALUE>jdbc</VALUE>
<CSTRING>jdbc string</CSTRING>
</CONNECTION>
<CONNECTION>
<TYPE>CSV</TYPE>
<VALUE>CSV</VALUE>
<CSTRING></CSTRING>
</CONNECTION>
</SOURCE>
</ROOT>
Requiered Elements are e.g.:
/ROOT[1]/DATA[1]/ALLOC[2]/VALUE[1]
/ROOT[1]/SOURCE[1]/CONNECTION[1]/CSTRING[1]
The requiered Elements Statements comes from java with xmlassert.equal > xmldiff
Now i have to strip the xml structure, to requiered elements, but keeping the xml structure (xpath) of elements.
The desired output is:
<ROOT>
<DATA>
<ALLOC>
<VALUE>4712</VALUE>
</ALLOC>
</DATA>
<SOURCE>
<CONNECTION>
<CSTRING>jdbc string</CSTRING>
</CONNECTION>
</SOURCE>
</ROOT>
The real structure is huge (minimum 6x A4 Pages if you would print it), complex and has multilevels. The requested Elements are also dynamically.
I spent the last hours with reading threads in a lot of fourms, tries with a lot of amount of different xslt's and reading of more threads.
How can i do that?
Thank you so much in advance.