Given the following xml fragment:
file1
desc1
&l
This solution is a little bit simpler, more efficient and at the same time more general than the one presented by Richard:
This transformation:
when applied to the provided XML document:
file1
desc1
file1
desc2
file2
desc1
Produces the wanted result:
file1
desc1
desc2
file2
desc1
Do note the simple match pattern of the first
, we locate all "Description
" elements that are siblings of a "File
" element that has a given value.
We could have used more templates instead of
Also note, that in XSLT 2.0 one will typically use the