If I have an XML file that contains the following branches: grandfather table, father table, and son table, I have linked the grandfather table to the father table as shown in this code. However, I was unable to link the son table to the father table because there is no linking number PK in the father Table.
Can the attached code be used to add auto number to the father table and add it to the son table so that I can link the father to the son?
These are the names to understand the explanation: grandfather, father, and grandson.
Here actual table Name
Employees <<<<< GrandFather
--------Enrollment <<<<Father
--------------------CafeteriaData <<<<Son
Can the attached code be used to add auto number to the father table and add it to the son table so that I can link the father to the son?
These are the names to understand the explanation: grandfather, father, and grandson.
Here actual table Name
Employees <<<<< GrandFather
--------Enrollment <<<<Father
--------------------CafeteriaData <<<<Son
Code:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<dataroot>
<xsl:apply-templates select="@*|node()"/>
</dataroot>
</xsl:template>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="Employees">
<xsl:apply-templates select="@*|node()"/>
</xsl:template>
<xsl:template match="Enrollment">
<Enrollment>
<ExternalEmployeeId><xsl:value-of select="../../ExternalEmployeeId"/></ExternalEmployeeId>
<xsl:apply-templates select="@*|node()"/>
</Enrollment>
</xsl:template>
<xsl:template match="CafeteriaData">
<CafeteriaData>
<PKAutoNumber><xsl:value-of select="../../../PKAutoNumber"/></ExternalEmployeeId>
<xsl:apply-templates select="@*|node()"/>
</CafeteriaData>
</xsl:template>
</xsl:stylesheet>
Last edited: