I have a tree-structured flat file for which I need to write into a dynamic XSLT. The flat file data keep changing. For example, I have tag A, B, C, D as given below. Then the next file can have E, F, G, H.The tree itself will have 4-6 levels of depth.
I can read the file into the plain list looping each row but unable to create the same tree structure in XSLT. I want to read the same in java object and then create the same the in XSLT.
To read file:
while ((item = in.readLine()) != null) {
lineNo++;
String rowContent = item;
}
Input file:
Element A Element B Element C Data Element D Data
Expected Output XSLT:
<xsl:template match="/">
<A>
<B>
<C><xsl:text>data</xsl:text></C>
<D><xsl:text>data</xsl:text></D>
</B>
</A>
</xsl:template>
I'm new to XSLT, any help would be appreciated. Thanks!!!