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"/>
8 <xsl:apply-templates select=
"INTERRUPT_VECTOR"/>
9 <xsl:apply-templates select=
"PACKAGE"/>
10 <xsl:apply-templates select=
"V2"/>
14 <xsl:template match=
"MEMORY">
17 <xsl:attribute name=
"size">
18 <xsl:value-of select=
"PROG_FLASH/text()"/>
20 <xsl:attribute name=
"page">
21 <xsl:value-of select=
"/AVRPART/PROGRAMMING/FlashPageSize/text()"/>
26 <xsl:attribute name=
"start">
28 select=
"IO_MEMORY/MEM_START_ADDR/text()"/>
30 <xsl:attribute name=
"stop">
32 select=
"IO_MEMORY/MEM_STOP_ADDR/text()"/>
37 <xsl:attribute name=
"size">
38 <xsl:value-of select=
"INT_SRAM/SIZE/text()"/>
43 <xsl:attribute name=
"size">
44 <xsl:value-of select=
"EXT_SRAM/SIZE/text()"/>
49 <xsl:apply-templates select=
"IO_MEMORY"/>
52 <xsl:template match=
"IO_MEMORY">
54 <xsl:for-each select=
"*">
55 <xsl:sort select=
"MEM_ADDR/text()"/>
56 <xsl:if test=
"not( contains(name(), 'ADDR') )">
58 <xsl:attribute name=
"name">
59 <xsl:value-of select=
"name()"/>
62 <xsl:attribute name=
"address">
63 <xsl:value-of select=
"MEM_ADDR/text()"/>
71 <xsl:template match=
"PACKAGE">
73 <xsl:for-each select=
"PDIP | TQFP | MLF">
75 <xsl:attribute name=
"name">
76 <xsl:value-of select=
"name()"/>
79 <xsl:attribute name=
"pins">
80 <xsl:value-of select=
"NMB_PIN/text()"/>
83 <xsl:for-each select=
"*">
84 <xsl:if test=
"starts-with(name(), 'PIN')">
86 <xsl:attribute name=
"id">
87 <xsl:value-of select=
"substring(name(), 4)"/>
90 <xsl:attribute name=
"name">
91 <xsl:value-of select=
"NAME/text()"/>
94 <xsl:value-of select=
"TEXT/text()"/>
103 <xsl:template match=
"INTERRUPT_VECTOR">
105 <xsl:attribute name=
"num">
106 <xsl:value-of select=
"NMB_VECTORS/text()"/>
109 <xsl:for-each select=
"*">
110 <xsl:if test=
"starts-with(name(), 'VECTOR')">
112 <xsl:attribute name=
"vector">
113 <xsl:value-of select=
"substring(name(), 7)"/>
116 <xsl:attribute name=
"address">
117 <xsl:value-of select=
"PROGRAM_ADDRESS/text()"/>
120 <xsl:attribute name=
"name">
121 <xsl:value-of select=
"SOURCE/text()"/>
124 <xsl:value-of select=
"DEFINITION/text()"/>
131 <xsl:template match=
"module">
133 <xsl:attribute name=
"class">
134 <xsl:value-of select=
"@class"/>
137 <xsl:copy-of select=
"registers"/>
141 <xsl:template match=
"V2">
143 <xsl:comment>Everything after this needs editing!!!
</xsl:comment>
144 <xsl:apply-templates select=
"templates/module"/>