472,143 Members | 1,292 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,143 software developers and data experts.

XSLT: Passing the whole source XML through to the result XML with only some elements altered

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):

<element1 ...>
.... (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:

<element1 ...>
.... (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.


Terje Slettebø

Aug 7 '06 #1
1 1225
I found the answer myself, now, in this great FAQ:


It works great.

Aug 7 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Jon Martin Solaas | last post: by
7 posts views Thread by Harolds | last post: by
3 posts views Thread by thomas.porschberg | last post: by
3 posts views Thread by super.raddish | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.