Scenario
|
Source Release
|
Target Release
|
Sample xslt
|
Object deletion
|
WTPart
|
Not available
|
No xsl transformation is needed. The object is ignored/handled during importing.
|
Object Addition
|
Not Available
|
WTPart
|
No xsl transformation is needed. There is no data to export.
|
Renaming the object type
|
WTPart
|
WTMyPart
|
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="WTPart">
<WTMyPart>
<xsl:copy-of select = "child::*"></xsl:copy-of>
</WTMyPart></xsl:template>
</xsl:stylesheet>
|
Element Addition
|
NewElement does not exist
|
NewElement in WTPart
|
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="@* | node()"> <xsl:copy> <xsl:apply-templates select="@* | node()"></xsl:apply-templates> </xsl:copy> </xsl:template> <xsl:template match="FederationInfo"> <xsl:copy-of select="."></xsl:copy-of> <NewElement>NewElementAdded</NewElement> </xsl:template> </xsl:stylesheet>
|
Element Deletion
|
FederationInfo in WTPart
|
FederationInfo is not available
|
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"></xsl:apply-templates>
</xsl:copy>
</xsl:template>
<xsl:template match="FederationInfo">
</xsl:template>
</xsl:stylesheet>
|
Renaming the element
|
FederationInfo
|
NewFederationInfo
|
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"></xsl:apply-templates>
</xsl:copy>
</xsl:template>
<xsl:template match="FederationInfo">
<NewFederationInfo>
<xsl:copy-of select="*"></xsl:copy-of>
</NewFederationInfo>
</xsl:template>
</xsl:stylesheet>
|
Addition of an attribute
|
Attribute firstName is not present.
|
firstName is an attribute of WTPrincipal reference
|
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"></xsl:apply-templates>
</xsl:copy>
</xsl:template>
<xsl:template match="WTPrincipalReference">
<xsl:copy>
<xsl:apply-templates select="@* | node()"></xsl:apply-templates>
</xsl:copy>
</xsl:template>
<xsl:template match="createdBy/WTPrincipalReference/@fullName">
<xsl:copy-of select="." />
<xsl:attribute name="firstName">AddedFirstName</xsl:attribute>
</xsl:template>
</xsl:stylesheet>
|
Remove an attribute isInternal from created by WTPrincipalReference
|
isInternal is an attribute of WTPrincipalReference
|
isInternal is not available
|
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"></xsl:apply-templates>
</xsl:copy>
</xsl:template>
<xsl:template match="createdBy/WTPrincipalReference/@isInternal">
</xsl:template>
</xsl:stylesheet>
|
Renaming of an attribute
|
fullName
|
newFullName
|
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"></xsl:apply-templates>
</xsl:copy>
</xsl:template>
<xsl:template match="WTPrincipalReference">
<xsl:copy>
<xsl:apply-templates select="@* | node()"></xsl:apply-templates>
</xsl:copy>
</xsl:template>
<xsl:template match="WTPrincipalReference/@fullName">
<xsl:attribute name="newFullName">
<xsl:copy-of select="*" />
</xsl:attribute>
</xsl:template>
</xsl:stylesheet>
|
Split the value of an attribute into two different attributes
|
FullName = Demo,User
|
FirstName = Demo, LastName = User
|
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"></xsl:apply-templates>
</xsl:copy>
</xsl:template>
<xsl:template match="createdBy/WTPrincipalReference/@fullName"
name="split">
<xsl:param name="fullName">
<xsl:value-of select="." />
</xsl:param>
<xsl:if test="$fullName">
<xsl:param name="firstName">
<xsl:value-of select="substring-before($fullName, ',')" />
</xsl:param>
<xsl:param name="lastName">
<xsl:value-of select="substring-after($fullName, ',')" />
</xsl:param>
<xsl:if test="$firstName">
<xsl:attribute name="firstName"><xsl:value-of
select="$firstName" /></xsl:attribute>
</xsl:if>
<xsl:if test="$lastName">
<xsl:attribute name="lastName"><xsl:value-of
select="$lastName" /></xsl:attribute>
</xsl:if>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
|
Merge WTPart1, WTPArt2 to form WTPart
|
WTPart1, WTPart2
|
WTPart
|
To be done in Java delegates.
|
Split WTPart into WTPart1, WTPart2
|
WTpart
|
WTPart1, WTPart2
|
To be done in Java delegates.
|