473,386 Members | 1,801 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

XSL to convert an XML in similar format's without changing any tags

Hi All,

I am stuck in a pretty simple problem.

I need an XSL to convert an XML with similar format's and some
additions, please consider the following example to understand my
issue.

Input XML

<Root>
<Name>amit</Name>
<Name1>gupta</Name1>
<other>bla bla bla</other>
<Root>

Output Desired XML

<Root>
<Name>amit</Name>
<Name1>gupta</Name1>
<other>bla bla bla</other>
<AdditionalTagAddition to previous xml </AdditionalTag>
<Root>

I know, how to add new tag's. My problem is that I want some generic
XSL to convert, all tag's in input xml, no matter how many they are,
to output xml, with some additional tags.

Thanks in Advance,
Regards,
-Amit Gupta

May 31 '07 #1
1 1597
Amit wrote:
<Root>
<Name>amit</Name>
<Name1>gupta</Name1>
<other>bla bla bla</other>
<Root>

Output Desired XML

<Root>
<Name>amit</Name>
<Name1>gupta</Name1>
<other>bla bla bla</other>
<AdditionalTagAddition to previous xml </AdditionalTag>
<Root>
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>

<xsl:template match="Root">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
<AdditionalTagAddition to previous xml </AdditionalTag>
</xsl:copy>
</xsl:template>

should do it. If there are different kind of root elements then it
should also suffice to use e.g.

<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>

<xsl:template match="/*">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
<AdditionalTagAddition to previous xml </AdditionalTag>
</xsl:copy>
</xsl:template>
--

Martin Honnen
http://JavaScript.FAQTs.com/
May 31 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Jens Mueller | last post by:
Hi there, this is a Java-XML Question, so I am not sure whether this is the right place, haven't found anything better .... I try to convert a Java object to XML via SAX and let the FOP...
8
by: Brett | last post by:
Both make use of DIV tags or layers. What are the main differences between DHTML and style sheets? Also, what type of problems might an author experience in the way of incompatibilities? For...
2
by: Franck | last post by:
Hi, 'm gettin mad about date conversion. Here is the point. Got and add-in for Excel which call functions from a web service (on a remote server) The remote server has regional settings...
4
by: 2803stan | last post by:
Hi, I need to know if my regular relational database, now in DB2 v9.1 can be transformed to an XML database easily? The data can very easily be represented in XML, but can I convert a regular...
6
by: arti | last post by:
I dont want to use Convert(Char(9),date,106) function to show date in dd/MM/yyyy format. It changes the datatype of my column to char & I cant perform other date operations on it without changing it...
4
by: =?Utf-8?B?YW5kcmV3?= | last post by:
I am running an ASP.net program written in VB. At one point I try to convert a date string into a date time object... this string is from a central dev server and the code works on many other...
2
by: Vamp4L | last post by:
Hello, Specifically, I'm trying to convert the Internet Explorer history file (index.dat) into a readable format. Anyone done something similar or know of any functions that may help with such a...
5
OuTCasT
by: OuTCasT | last post by:
Hi. I would like to know how to convert the short date format to the long date format for my application without changing the regional settings from short date to long date. ?
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.