This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I am transforming a XML file to another XML file using XSL. The XSL did the intended transformation except a part of the XML input file is not supposed to appear in the XML output file.
I think it is a problem in my XSL file. But, I do not know how to suppress something from showing up in the output file. I appreciate your help.
Below is my XML input file. I need the information inside the <pathParametersExt> node to do the XSL transformation; however, I do not want the information inside the <pathParametersExt> node to be included in the output file.
Here is my XSL transformation (the CommonFunctions.xsl only has some date time and encoding utilities):
The <pathParametersExt> node and its child nodes in the XML output file is redundant. Here is the unexpected output file:
Well, the main processing part of your XSLT code is from lines 72 to 82 in your post. And what you have there is the standard identity transformation, which recursively copies each node from the input to the output. (The only difference is line 75, which looks like it throws an exception if the setup was incomplete.) And you have overridden that identity transformation so that when it gets to the h:queryParametersExt element, it does something other than just copying the element. That starts at line 92.
But you don't have any code to say what to do with the h:pathParametersExt element, so by default it is copied to the output. And that isn't what you want. So you need to add another template (like the one starting at line 92) which says "When you get to the h:pathParametersExt element, don't do anything".
Joined: May 06, 2003
Thanks for your help and explanation. It is working now.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: An Unwanted Part of the XML Input File is Included in the XSL Transformation Result