![]() |
| ||
| Adding New Element using XSLT Hi All, I have a set of elements to be added to an existing XML document. I would like to write a XSLT tranformation for this. My requirement is that I need to check whether the element is already there in the XML file. Only if its non existent, I need to add that element. I have to repeat this step for a set of elements. Also, my XML file is namespace based. Please advise. Regards Ramesh |
| ||
| Re: Adding New Element using XSLT Here is a simple example of adding an element. Suppose you have the folllowing XML document <root>and you want to add an extra element <c>. The following stylesheet is one way of adding this element. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" >The output is <root> |
| ||
| Re: Adding New Element using XSLT Thanks for the help. I was trying the same thing with my examples. But it looks like only the identity transformation template is only invoked. The other template is not invoked. There is a namespace associated with the XML file. ( The schema that defines the XML has the targetnamespace). Is this why the other templates are not invoked? How to handle namespace based insertion. Thanks |
| ||
| Re: Adding New Element using XSLT Yes, you have to specifically handle the extra namespace issues. |
| All times are GMT -4. The time now is 8:55 pm. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC