Hi all.
I've read Michael Kay's "XSLT" book, and used XSLT successfully as an
HTML template system at our company (using basically the
"fill-in-the-blanks" pattern of XSLT use: A template matching the root
node, containing the HTML page, with lots of <xsl:value-of.../>, etc.).
However, I've recently got a task that got me stumped, and I don't know
if I'm missing something obvious, but quite frankly, I don't know where
in the sea of XSLT-information to start looking (although I'll continue
with that after having posted this), that I kindly ask for some
guidance from you.
The problem is this: We have a quite complex source XML document like
this (each element may have several attributes):
<root>
<element1 ...>
<element2...>
<element3...>
<element4...>
...
</element4>
</element3>
.... (lots more elements and attributes)
We'd like to basically copy this to the result XML, as it is, but
change a few of the elements, like this:
<root>
<element1 ...>
<element2...>
<element3...>
<element4...>
<new_element...>
<another_new..../>
</new_element>
</element4>
</element3>
.... (lots more elements and attributes)
Is there a way to write an XSLT template that does this (passes the
source XML unchanged, and changing only some elements), without
creating a massive XSLT template that does a match on each element type
in the source XML, having to enumerate all atttributes that has to be
copied, etc.?
Any hints or pointers appreciated.
Regards,
Terje Slettebø