etherlab/entries_list.ysl2
author Andrey Skvortsov <andrej.skvortzov@gmail.com>
Fri, 05 Oct 2018 14:22:01 +0300
changeset 2437 105c20fdeb19
parent 2165 02a2b5dee5e3
child 2641 c9deff128c37
permissions -rw-r--r--
python3 support: pylint, W1619 #(old-division) division w/o __future__ statement
2165
02a2b5dee5e3 Merged GPL + LGPL v2 or later EtherCAT extension. Fixed headers and copyright notice.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2162
diff changeset
     1
/*
02a2b5dee5e3 Merged GPL + LGPL v2 or later EtherCAT extension. Fixed headers and copyright notice.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2162
diff changeset
     2
02a2b5dee5e3 Merged GPL + LGPL v2 or later EtherCAT extension. Fixed headers and copyright notice.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2162
diff changeset
     3
Stylesheet used to list EtherCat dictionnary entries.
02a2b5dee5e3 Merged GPL + LGPL v2 or later EtherCAT extension. Fixed headers and copyright notice.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2162
diff changeset
     4
02a2b5dee5e3 Merged GPL + LGPL v2 or later EtherCAT extension. Fixed headers and copyright notice.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2162
diff changeset
     5
Copyright (C) 2011-2014: Laurent BESSARD
02a2b5dee5e3 Merged GPL + LGPL v2 or later EtherCAT extension. Fixed headers and copyright notice.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2162
diff changeset
     6
02a2b5dee5e3 Merged GPL + LGPL v2 or later EtherCAT extension. Fixed headers and copyright notice.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2162
diff changeset
     7
Distributed under the terms of the GNU Lesser General Public License as
02a2b5dee5e3 Merged GPL + LGPL v2 or later EtherCAT extension. Fixed headers and copyright notice.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2162
diff changeset
     8
published by the Free Software Foundation; either version 2 of the License, or
02a2b5dee5e3 Merged GPL + LGPL v2 or later EtherCAT extension. Fixed headers and copyright notice.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2162
diff changeset
     9
(at your option) any later version.
02a2b5dee5e3 Merged GPL + LGPL v2 or later EtherCAT extension. Fixed headers and copyright notice.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2162
diff changeset
    10
02a2b5dee5e3 Merged GPL + LGPL v2 or later EtherCAT extension. Fixed headers and copyright notice.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2162
diff changeset
    11
See COPYING file for copyrights details.
02a2b5dee5e3 Merged GPL + LGPL v2 or later EtherCAT extension. Fixed headers and copyright notice.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2162
diff changeset
    12
02a2b5dee5e3 Merged GPL + LGPL v2 or later EtherCAT extension. Fixed headers and copyright notice.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2162
diff changeset
    13
*/
02a2b5dee5e3 Merged GPL + LGPL v2 or later EtherCAT extension. Fixed headers and copyright notice.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2162
diff changeset
    14
2162
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    15
include yslt.yml2
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    16
estylesheet xmlns:ns="entries_list_ns" 
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    17
            extension-element-prefixes="ns" 
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    18
            exclude-result-prefixes="ns" {
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    19
    
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    20
    param "min_index";
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    21
    param "max_index";
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    22
    
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    23
    template "text()";
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    24
    
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    25
    template "Device" {
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    26
        apply "Profile/Dictionary/Objects/Object";
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    27
        foreach "RxPdo" {
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    28
            call "pdo_entries" with "direction", "'Receive'";
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    29
        }
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    30
        foreach "TxPdo" {
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    31
            call "pdo_entries" with "direction", "'Transmit'";
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    32
        }
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    33
    }
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    34
    
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    35
    template "Object" {
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    36
        variable "index" > «ns:HexDecValue(Index/text())»
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    37
        variable "entry_name" > «ns:EntryName(Name)»
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    38
        choose {
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    39
            when "$index >= $min_index and $index <= $max_index" {
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    40
                variable "datatype_name" > «Type/text()»
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    41
                choose {
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    42
                    when "ancestor::Dictionary/child::DataTypes/DataType[Name/text()=$datatype_name][SubItem]" {
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    43
                        apply "ancestor::Dictionary/child::DataTypes/DataType[Name/text()=$datatype_name][SubItem]" {
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    44
                            with "index" > «$index»
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    45
                            with "entry_name" > «$entry_name»
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    46
                        }
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    47
                    }
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    48
                    otherwise {
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    49
                        variable "subindex" > 0
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    50
                        variable "entry" {
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    51
                            > «ns:AddEntry($index, $subindex, $entry_name, $datatype_name, BitSize/text(), Flags/Access/text(), Flags/PdoMapping/text())»
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    52
                        }
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    53
                    }
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    54
                }
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    55
            }
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    56
        }
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    57
    }
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    58
    
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    59
    template "DataType" {
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    60
        param "index";
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    61
        param "entry_name";
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    62
        foreach "SubItem" {
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    63
            variable "subindex" > «ns:HexDecValue(SubIdx/text())»
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    64
            variable "subentry_name" > «$entry_name» - «ns:EntryName(DisplayName, Name/text())»
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    65
            variable "entry" {
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    66
                > «ns:AddEntry($index, $subindex, $subentry_name, Type/text(), BitSize/text(), Flags/Access/text(), Flags/PdoMapping/text())»
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    67
            }
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    68
        }
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    69
    }
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    70
    
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    71
    function "pdo_entries" {
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    72
        param "direction";
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    73
        variable "pdo_index" > «ns:HexDecValue(Index/text())»
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    74
        variable "pdo_name" > «ns:EntryName(Name)»
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    75
        foreach "Entry" {
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    76
            variable "index" > «ns:HexDecValue(Index/text())»
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    77
            choose {
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    78
                when "$index >= $min_index and $index <= $max_index" {
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    79
                    variable "subindex" > «ns:HexDecValue(SubIndex/text())»
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    80
                    variable "subentry_name" > «ns:EntryName(Name)»
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    81
                    variable "access" {
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    82
                        choose {
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    83
                            when "$direction='Transmit'" > ro
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    84
                            otherwise > wo
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    85
                        }
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    86
                    }
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    87
                    variable "pdo_mapping" {
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    88
                        choose {
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    89
                            when "$direction='Transmit'" > T
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    90
                            otherwise > R
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    91
                        }
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    92
                    }
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    93
                    variable "entry" {
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    94
                        > «ns:AddEntry($index, $subindex, $subentry_name, DataType/text(), BitLen/text(), $access, $pdo_mapping, $pdo_index, $pdo_name, $direction)»
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    95
                    }
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    96
                }
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    97
            }
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    98
        }
43ab74687f45 Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
diff changeset
    99
    }
2165
02a2b5dee5e3 Merged GPL + LGPL v2 or later EtherCAT extension. Fixed headers and copyright notice.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2162
diff changeset
   100
}