XSLTGeneral questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.
You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
Logic:- The source.xml has <td5> document element and two child elements, namely <separator> and <value>. Each <separator> element is "optionally" followed by a <value> element.
The logic to be implemented is, if the <separator> element is followed by a <value> element then that <value> element should go into target.xml and If <separator> element is NOT FOLLOWED by a <value> element then for every two continuous <separator> elements one new blank <value> element (which is <value/>) should go into the target.xml.
In the given source.xml there are three continuous <separator> elements and hence in the target.xml they are replaced by 2 <value/> elements.
The xslt-sheet that I came up with is as follows. Of course , there is no big difference between your xslt and mine. I'm using * and you are using node(). What I could not understand is why doesn't your xslt which uses node() give the same output as mine that uses *? Does this have anything to do with XALAN or if everything is working as expected and your code is not complete ;)