i have to build an XSLT stylesheet that transforms an xml like this:
<message>
<line/>
<silence/>
<dot/><line/><line/>
<silence/>
<dot/>
<silence/>
<line/><dot/><dot/><dot/>
</message>
into something like this:
<complexMessage>
<word code="-"/>
<word code=".--"/>
<word code="."/>
<word code="-..."/>
</complexMessage>
(notice how each word element gets closed after a silence element)
how could I do that?
This solution is both: slightly shorter and, more importantly, more efficient due to the use of keys:
When this transformation is applied on the provided source XML, the correct result is produced: