This is a very involved problem, and is above my knowledge of XSLT - I am still learning and no matter how much I read through O'Reilly's XSLT book, I am in above my head. I have a multi faciated problem, which I have produced an input XML file for, and am going to try and explain the requirements afterwards too.INPUT\[code\]<roottag><body> <header> <r> <c> <d>Header Tag</d><!-- This can include spaces--> <e>System generated trash</e> </c> </r> <r> <c> <d>Sub Header Tag A</d> <e>System generated trash</e> </c> <c> <d>Sub Header Value A</d> <e>System generated trash</e> </c> </r> <r> <c> <d>Sub Header Tag B</d> <e>System generated trash</e> </c> <c> <d>Sub Header Value B</d> <e>System generated trash</e> </c> </r> <r> <c> <d>Sub Header Tag C</d> <e>System generated trash</e> </c> <c> <d>Sub Header Value C</d> <e>System generated trash</e> </c> </r> </header> <information> <r>Body of document</r> <r>Appears here but have an XSLT that deals with this</r> </informtaion> <footer> <r> <c> <d>Footer Tag</d><!-- This can include spaces--> <e>System generated trash</e> </c> </r> <r> <c> <d>Sub Footer Tag A</d> <e>System generated trash</e> </c> <c> <d>Sub Footer Value A</d> <e>System generated trash</e> </c> </r> <r> <c> <d>Sub Footer Tag B</d> <e>System generated trash</e> </c> <c> <d>Sub Footer Value B</d> <e>System generated trash</e> </c> </r> <r> <c> <d>Sub Footer Tag C</d> <e>System generated trash</e> </c> <c> <d>Sub Footer Value C</d> <e>System generated trash</e> </c> </r> </footer></body></roottag>\[/code\]OUTPUT\[code\]<?xml version="1.0"?><roottag><body> <header> <HeaderTag><!-- without spaces --> <HeaderName>Header Tag</HeaderName><!-- This needs to preserve spaces--> </HeaderTag> <SubHeaderTagA><!-- without spaces --> <HeaderName>Sub Header Tag A</HeaderName><!-- This needs to preserve spaces--> <HeaderValue>Sub Header Value A</HeaderValue> </SubHeaderTagA> <SubHeaderTagB> <HeaderName>Sub Header Tag B</HeaderName> <HeaderValue>Sub Header Value B</HeaderValue> </SubHeaderTagB> <SubHeaderTagC> <HeaderName>Sub Header Tag C</HeaderName> <HeaderValue>Sub Header Value C</HeaderValue> </SubHeaderTagC> </header> <information> <r>Body of document</r> <r>Appears here but have an XSLT that deals with this</r> </informtaion> <footer> <FooterTag> <FooterName>Footer Tag</FooterName> </FooterTag> <SubFooterTagA> <FooterName>Sub Footer Tag A</FooterName> <FooterValue>Sub Footer Value A</FooterValue> </SubHeaderTagA> <SubFooterTagB> <FooterName>Sub Footer Tag B</FooterName> <FooterValue>Sub Footer Value B</FooterValue> </SubHeaderTagB> <SubFooterTagC> <FooterName>Sub Footer Tag C</FooterName> <FooterValue>Sub Footer Value C</FooterValue> </SubHeaderTagC> </footer></body></roottag>\[/code\]So to explain the problem as I see it, and the problems I have faced.[*]RemovingSpacesThe value held within roottag/body/header/r/c/d can and often includes spaces, so I need a way of removing this which I have found from a questions on the site [addLink] however this also replaces the value so when I come to use the data later in the process it has no spaces which is required for outputting. [*]Replacing R with first value onlyI am at a loss of how to do this, everything I have tried and researched seems to use the second value as the value. I am at my wiks end with it. [*]Header or Footer Name/ValueAgain, my knowledge is limited if this is even possible to, or an individual match is required for each tag?[*]Movement of header and footer tag.I've not included this within my required output, but I think I may need to do this - is it possible to move the header tag and footer tag outside of the body tag? so XML would be: roottag-header-body-information-/body-footer/-/rtIf you require any more clarifications, please let me know.Thank you for any adivce on pointers - as mentioned I am still in my training for XSLT and the powers and what breaks what