1 <xsl:stylesheet version="1.0" |
1 <xsl:stylesheet xmlns:func="http://exslt.org/functions" xmlns:dyn="http://exslt.org/dynamic" xmlns:str="http://exslt.org/strings" xmlns:math="http://exslt.org/math" xmlns:exsl="http://exslt.org/common" extension-element-prefixes="ns" xmlns:yml="http://fdik.org/yml" xmlns:set="http://exslt.org/sets" version="1.0" xmlns:ns="entries_list_ns" exclude-result-prefixes="ns" xmlns:regexp="http://exslt.org/regular-expressions" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:output method="xml"/><xsl:variable name="space" select="' '"/><xsl:param name="autoindent" select="4"/><xsl:param name="min_index"/><xsl:param name="max_index"/><xsl:template match="text()"><xsl:param name="_indent" select="0"/></xsl:template><xsl:template match="Device"><xsl:param name="_indent" select="0"/><xsl:apply-templates select="Profile/Dictionary/Objects/Object"><xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/></xsl:apply-templates><xsl:for-each select="RxPdo"><xsl:call-template name="pdo_entries"><xsl:with-param name="direction" select="'Receive'"/></xsl:call-template></xsl:for-each><xsl:for-each select="TxPdo"><xsl:call-template name="pdo_entries"><xsl:with-param name="direction" select="'Transmit'"/></xsl:call-template></xsl:for-each></xsl:template><xsl:template match="Object"><xsl:param name="_indent" select="0"/><xsl:variable name="index"><xsl:value-of select="ns:HexDecValue(Index/text())"/></xsl:variable><xsl:variable name="entry_name"><xsl:value-of select="ns:EntryName(Name)"/></xsl:variable><xsl:choose><xsl:when test="$index >= $min_index and $index <= $max_index"><xsl:variable name="datatype_name"><xsl:value-of select="Type/text()"/></xsl:variable><xsl:choose><xsl:when test="ancestor::Dictionary/child::DataTypes/DataType[Name/text()=$datatype_name][SubItem]"><xsl:apply-templates select="ancestor::Dictionary/child::DataTypes/DataType[Name/text()=$datatype_name][SubItem]"><xsl:with-param name="_indent" select="$_indent + (1) * $autoindent"/><xsl:with-param name="index"><xsl:value-of select="$index"/></xsl:with-param><xsl:with-param name="entry_name"><xsl:value-of select="$entry_name"/></xsl:with-param></xsl:apply-templates></xsl:when><xsl:otherwise><xsl:variable name="subindex"><xsl:text>0</xsl:text></xsl:variable><xsl:variable name="entry"><xsl:value-of select="ns:AddEntry($index, $subindex, $entry_name, $datatype_name, BitSize/text(), Flags/Access/text(), Flags/PdoMapping/text())"/></xsl:variable></xsl:otherwise></xsl:choose></xsl:when></xsl:choose></xsl:template><xsl:template match="DataType"><xsl:param name="_indent" select="0"/><xsl:param name="index"/><xsl:param name="entry_name"/><xsl:for-each select="SubItem"><xsl:variable name="subindex"><xsl:value-of select="ns:HexDecValue(SubIdx/text())"/></xsl:variable><xsl:variable name="subentry_name"><xsl:value-of select="$entry_name"/><xsl:text> - </xsl:text><xsl:value-of select="ns:EntryName(DisplayName, Name/text())"/></xsl:variable><xsl:variable name="entry"><xsl:value-of select="ns:AddEntry($index, $subindex, $subentry_name, Type/text(), BitSize/text(), Flags/Access/text(), Flags/PdoMapping/text())"/></xsl:variable></xsl:for-each></xsl:template><xsl:template name="pdo_entries"><xsl:param name="_indent" select="0"/><xsl:param name="direction"/><xsl:variable name="pdo_index"><xsl:value-of select="ns:HexDecValue(Index/text())"/></xsl:variable><xsl:variable name="pdo_name"><xsl:value-of select="ns:EntryName(Name)"/></xsl:variable><xsl:for-each select="Entry"><xsl:variable name="index"><xsl:value-of select="ns:HexDecValue(Index/text())"/></xsl:variable><xsl:choose><xsl:when test="$index >= $min_index and $index <= $max_index"><xsl:variable name="subindex"><xsl:value-of select="ns:HexDecValue(SubIndex/text())"/></xsl:variable><xsl:variable name="subentry_name"><xsl:value-of select="ns:EntryName(Name)"/></xsl:variable><xsl:variable name="access"><xsl:choose><xsl:when test="$direction='Transmit'"><xsl:text>ro</xsl:text></xsl:when><xsl:otherwise><xsl:text>wo</xsl:text></xsl:otherwise></xsl:choose></xsl:variable><xsl:variable name="pdo_mapping"><xsl:choose><xsl:when test="$direction='Transmit'"><xsl:text>T</xsl:text></xsl:when><xsl:otherwise><xsl:text>R</xsl:text></xsl:otherwise></xsl:choose></xsl:variable><xsl:variable name="entry"><xsl:value-of select="ns:AddEntry($index, $subindex, $subentry_name, DataType/text(), BitLen/text(), $access, $pdo_mapping, $pdo_index, $pdo_name, $direction)"/></xsl:variable></xsl:when></xsl:choose></xsl:for-each></xsl:template></xsl:stylesheet> |
2 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
|
3 xmlns:ns="entries_list_ns" |
|
4 extension-element-prefixes="ns" |
|
5 exclude-result-prefixes="ns"> |
|
6 <xsl:param name="min_index"/> |
|
7 <xsl:param name="max_index"/> |
|
8 <xsl:template match="Device"> |
|
9 <xsl:apply-templates select="Profile/Dictionary/Objects/Object"/> |
|
10 <xsl:for-each select="RxPdo"> |
|
11 <xsl:call-template name="pdo_entries"> |
|
12 <xsl:with-param name="direction" select="'Receive'"/> |
|
13 </xsl:call-template> |
|
14 </xsl:for-each> |
|
15 <xsl:for-each select="TxPdo"> |
|
16 <xsl:call-template name="pdo_entries"> |
|
17 <xsl:with-param name="direction" select="'Transmit'"/> |
|
18 </xsl:call-template> |
|
19 </xsl:for-each> |
|
20 </xsl:template> |
|
21 <xsl:template match="Object"> |
|
22 <xsl:variable name="index"> |
|
23 <xsl:value-of select="ns:HexDecValue(Index/text())"/> |
|
24 </xsl:variable> |
|
25 <xsl:variable name="entry_name"> |
|
26 <xsl:value-of select="ns:EntryName(Name)"/> |
|
27 </xsl:variable> |
|
28 <xsl:choose> |
|
29 <xsl:when test="$index >= $min_index and $index <= $max_index"> |
|
30 <xsl:variable name="datatype_name"> |
|
31 <xsl:value-of select="Type/text()"/> |
|
32 </xsl:variable> |
|
33 <xsl:choose> |
|
34 <xsl:when test="ancestor::Dictionary/child::DataTypes/DataType[Name/text()=$datatype_name][SubItem]"> |
|
35 <xsl:apply-templates select="ancestor::Dictionary/child::DataTypes/DataType[Name/text()=$datatype_name][SubItem]"> |
|
36 <xsl:with-param name="index"> |
|
37 <xsl:value-of select="$index"/> |
|
38 </xsl:with-param> |
|
39 <xsl:with-param name="entry_name"> |
|
40 <xsl:value-of select="$entry_name"/> |
|
41 </xsl:with-param> |
|
42 </xsl:apply-templates> |
|
43 </xsl:when> |
|
44 <xsl:otherwise> |
|
45 <ns:add_entry> |
|
46 <Index><xsl:value-of select="$index"/></Index> |
|
47 <SubIndex><xsl:text>0</xsl:text></SubIndex> |
|
48 <Name><xsl:value-of select="$entry_name"/></Name> |
|
49 <Type><xsl:value-of select="$datatype_name"/></Type> |
|
50 <BitSize><xsl:value-of select="BitSize/text()"/></BitSize> |
|
51 <Access><xsl:value-of select="Flags/Access/text()"/></Access> |
|
52 <PDOMapping><xsl:value-of select="Flags/PdoMapping/text()"/></PDOMapping> |
|
53 </ns:add_entry> |
|
54 </xsl:otherwise> |
|
55 </xsl:choose> |
|
56 </xsl:when> |
|
57 </xsl:choose> |
|
58 </xsl:template> |
|
59 <xsl:template match="DataType"> |
|
60 <xsl:param name="index"/> |
|
61 <xsl:param name="entry_name"/> |
|
62 <xsl:for-each select="SubItem"> |
|
63 <xsl:variable name="subentry_names"> |
|
64 <xsl:value-of select="DisplayName"/> |
|
65 <Default><xsl:value-of select="Name/text()"/></Default> |
|
66 </xsl:variable> |
|
67 <ns:add_entry> |
|
68 <Index><xsl:value-of select="$index"/></Index> |
|
69 <SubIndex><xsl:value-of select="ns:HexDecValue(SubIdx/text())"/></SubIndex> |
|
70 <Name> |
|
71 <xsl:value-of select="$entry_name"/> |
|
72 <xsl:text> - </xsl:text> |
|
73 <xsl:value-of select="ns:EntryName($subentry_names)"/> |
|
74 </Name> |
|
75 <Type><xsl:value-of select="Type/text()"/></Type> |
|
76 <BitSize><xsl:value-of select="BitSize/text()"/></BitSize> |
|
77 <Access><xsl:value-of select="Flags/Access/text()"/></Access> |
|
78 <PDOMapping><xsl:value-of select="Flags/PdoMapping/text()"/></PDOMapping> |
|
79 </ns:add_entry> |
|
80 </xsl:for-each> |
|
81 </xsl:template> |
|
82 <xsl:template name="pdo_entries"> |
|
83 <xsl:param name="direction"/> |
|
84 <xsl:variable name="pdo_index"> |
|
85 <xsl:value-of select="ns:HexDecValue(Index/text())"/> |
|
86 </xsl:variable> |
|
87 <xsl:variable name="pdo_name"> |
|
88 <xsl:value-of select="ns:EntryName(Name)"/> |
|
89 </xsl:variable> |
|
90 <xsl:for-each select="Entry"> |
|
91 <xsl:variable name="index"> |
|
92 <xsl:value-of select="ns:HexDecValue(Index/text())"/> |
|
93 </xsl:variable> |
|
94 <xsl:choose> |
|
95 <xsl:when test="$index >= $min_index and $index <= $max_index"> |
|
96 <ns:add_entry> |
|
97 <Index><xsl:value-of select="$index"/></Index> |
|
98 <SubIndex><xsl:value-of select="ns:HexDecValue(SubIndex/text())"/></SubIndex> |
|
99 <Name><xsl:value-of select="ns:EntryName(Name)"/></Name> |
|
100 <Type><xsl:value-of select="DataType/text()"/></Type> |
|
101 <BitSize><xsl:value-of select="BitLen/text()"/></BitSize> |
|
102 <xsl:choose> |
|
103 <xsl:when test="$direction='Transmit'"> |
|
104 <Access><xsl:text>ro</xsl:text></Access> |
|
105 <PDOMapping><xsl:text>T</xsl:text></PDOMapping> |
|
106 </xsl:when> |
|
107 <xsl:otherwise> |
|
108 <Access><xsl:text>wo</xsl:text></Access> |
|
109 <PDOMapping><xsl:text>R</xsl:text></PDOMapping> |
|
110 </xsl:otherwise> |
|
111 </xsl:choose> |
|
112 <PDO> |
|
113 <index><xsl:value-of select="$pdo_index"/></index> |
|
114 <name><xsl:value-of select="$pdo_name"/></name> |
|
115 <type><xsl:value-of select="$direction"/></type> |
|
116 </PDO> |
|
117 </ns:add_entry> |
|
118 </xsl:when> |
|
119 </xsl:choose> |
|
120 </xsl:for-each> |
|
121 </xsl:template> |
|
122 <xsl:template match="text()"/> |
|
123 </xsl:stylesheet> |
|