This is what i have achieved from transformation of old xml tags into new.
Now the next step is to create a whole new hierarchy of tags based on the above. Here the value "First" is how i got above from the transformed new XML which is a node value. This is the new xml I need to append.
*******************************************
<root>
<parent>First</parent>
<name> Child1 </name>
</root>
*******************************************
This I have to do for every transformed tag i.e. First, Second, Third etc. The same set of XML tags as mentioned above needs to be generated.
Now should I be hard coding the same in my XSL transformation where in I convert the old xml to new or can i automate this process by specifying the hierarchy in some variables or arrays & then jus creating place holders which can be filled from the data from arrays/variables.
Currently what I have done is hard code something like this
*****************************************
<xsl:variable name="temp"> <xsl:for-each select="ancestor::*"> <xsl:value-of select="normalize-space(node_name)"/> <xsl:if test = "position() != '1' "> <xsl:text>/</xsl:text>
</xsl:if> </xsl:for-each>
</xsl:variable>
and so on
******************************************
This amounts to a lot of hard coding & not very flexible. Do post your thoughts if there is a better solution.
As I have to create the same set of hierarchial xml tags for each node that I transform I want to just create a template. This template is gonna be huge because of a long hierarchy where in I got to create.
This is the pre defined hierarchy which I need to include under every transformed node.
Child1/
Child2/
Child22/
Child3/
Child33/
Child333/
Subject:adding a whole new hierarchy in xml transformation Author:James Durning Date:30 Nov 2006 01:21 PM
I find it hard to track what exactly you are transforming, and what is your expected output.
Could you use a globally unique node id to reference parent nodes as opposed to paths?
eg. have a parent-id attribute, and an id attribute for each node.