-
Notifications
You must be signed in to change notification settings - Fork 0
/
data_transform.xsl
42 lines (34 loc) · 989 Bytes
/
data_transform.xsl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" omit-xml-declaration="yes" />
<xsl:template match="mysqldump">
<xsl:apply-templates select="database" />
</xsl:template>
<xsl:template match="database">
<sales>
<xsl:apply-templates select="table_data" />
</sales>
</xsl:template>
<xsl:template match="table_data">
<xsl:for-each select="row">
<xsl:element name="{../@name}">
<xsl:attribute name="date">
<xsl:value-of select="field[2]/text()" />
</xsl:attribute>
<amount>
<xsl:value-of select="field[3]/text()" />
</amount>
<paid>
<xsl:value-of select="field[4]/text()" />
</paid>
<description>
<xsl:value-of select="field[5]/text()" />
</description>
<salesperson>
<xsl:value-of select="field[6]/text()" />
</salesperson>
</xsl:element>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>