File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

An Unwanted Part of the XML Input File is Included in the XSL Transformation Result

 
Natalie Kopple
Ranch Hand
Posts: 325
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:





 
Paul Clapham
Sheriff
Pie
Posts: 20185
26
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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".
 
Natalie Kopple
Ranch Hand
Posts: 325
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your help and explanation. It is working now.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic