I have some original file with a header I want to change for another one (stored i other file):
original file:
<doc1>
<header>
<a>aaaa</a>
<b>bbbb</b>
</header>
<content>
<z>zzzzzzzzzzzzz</z>
</content>
</doc1>
new header (in a file):
<header>
<c>cccc</c>
</header>
expected result:
<doc1>
<header>
<c>cccc</c>
</header>
<content>
<z>zzzzzzzzzzzzz</z>
</content>
</doc1>
Thanks in advance!
This transformation (for demo-only purposes the new header is imbedded in the XSLT stylesheet):
when applied on the provided XML document:
produces the wanted, correct result:
In the real case you will have:
and the
headerdocument will be in the file named'Header.xml'that resides in the same directory as the XSLT stylesheet (if in another directory, then change the document URL accordingly).In the real case, no
xsl:namespace node will be copied on theheaderelement.Do note: The use of the standard XSLT function
document().