2 <xsl:stylesheet version=
"1.0" xmlns:
xsl=
"http://www.w3.org/1999/XSL/Transform">
3 <xsl:output method=
"xml" indent=
"yes" doctype-system=
"device.dtd"/>
5 <xsl:template match=
"AVRPART">
7 <xsl:apply-templates select=
"MEMORY | PACKAGE | INTERRUPT_VECTOR | V2"/>
11 <xsl:template match=
"MEMORY" priority=
"10">
14 <xsl:attribute name=
"size">
15 <xsl:value-of select=
"PROG_FLASH/text()"/>
20 <xsl:attribute name=
"start">
22 select=
"IO_MEMORY/MEM_START_ADDR/text()"/>
24 <xsl:attribute name=
"stop">
26 select=
"IO_MEMORY/MEM_STOP_ADDR/text()"/>
31 <xsl:attribute name=
"size">
32 <xsl:value-of select=
"INT_SRAM/SIZE/text()"/>
37 <xsl:attribute name=
"size">
38 <xsl:value-of select=
"EXT_SRAM/SIZE/text()"/>
43 <xsl:apply-templates select=
"IO_MEMORY"/>
46 <xsl:template match=
"IO_MEMORY" priority=
"9">
48 <xsl:for-each select=
"*">
49 <xsl:sort select=
"MEM_ADDR/text()"/>
50 <xsl:if test=
"not( contains(name(), 'ADDR') )">
52 <xsl:attribute name=
"name">
53 <xsl:value-of select=
"name()"/>
57 <xsl:when test=
"contains(IO_ADDR/text(), 'NA')">
58 <xsl:attribute name=
"address">
59 <xsl:value-of select=
"MEM_ADDR/text()"/>
63 <xsl:attribute name=
"address">
64 <xsl:value-of select=
"IO_ADDR/text()"/>
74 <xsl:template match=
"PACKAGE" priority=
"7">
76 <xsl:for-each select=
"PDIP | TQFP | MLF">
78 <xsl:attribute name=
"name">
79 <xsl:value-of select=
"name()"/>
82 <xsl:attribute name=
"pins">
83 <xsl:value-of select=
"NMB_PIN/text()"/>
86 <xsl:for-each select=
"*">
87 <xsl:if test=
"starts-with(name(), 'PIN')">
89 <xsl:attribute name=
"id">
90 <xsl:value-of select=
"substring(name(), 4)"/>
93 <xsl:attribute name=
"name">
94 <xsl:value-of select=
"NAME/text()"/>
97 <xsl:value-of select=
"TEXT/text()"/>
106 <xsl:template match=
"INTERRUPT_VECTOR" priority=
"8">
108 <xsl:attribute name=
"num">
109 <xsl:value-of select=
"NMB_VECTORS/text()"/>
112 <xsl:for-each select=
"*">
113 <xsl:if test=
"starts-with(name(), 'VECTOR')">
115 <xsl:attribute name=
"vector">
116 <xsl:value-of select=
"substring(name(), 7)"/>
119 <xsl:attribute name=
"address">
120 <xsl:value-of select=
"PROGRAM_ADDRESS/text()"/>
123 <xsl:attribute name=
"name">
124 <xsl:value-of select=
"SOURCE/text()"/>
127 <xsl:value-of select=
"DEFINITION/text()"/>
134 <xsl:template match=
"module" priority=
"1">
136 <xsl:attribute name=
"class">
137 <xsl:value-of select=
"@class"/>
140 <xsl:copy-of select=
"registers"/>
144 <xsl:template match=
"V2" priority=
"6">
146 <xsl:comment>Everything after this needs editing!!!
</xsl:comment>
147 <xsl:apply-templates select=
"templates/module"/>