As with version 3.0, AUTOSAR switched from OSEK-OIL to a XML based format in order to configure their OS. I'm looking now for an example of how this configuration can look like. The AUTOSAR specification unfortunately just covers the configuration parameters. Has anyone an idea where to get an example?
If you use the textual language for Ecuc value configuation provided by Artop, a textual configuration could look like this:
module Os = {
container OsAppMode = {
}
container OsOS: ExampleOS = {
param OsUseParameterAccess = true
param OsStackMonitoring = true
param OsStatus = .EXTENDED
param OsUseGetServiceId = true
param OsUseResScheduler = true
container OsHooks = {
param OsErrorHook = true
param OsPostTaskHook = true
param OsPreTaskHook = true
param OsShutdownHook = true
param OsStartupHook = true
}
}
container OsEvent : ev1 = {
}
container OsTask : task1 = {
ref OsTaskEventRef = os/Os/ev1
}
}
The generated .arxml would then be:
<?xml version="1.0" encoding="UTF-8"?>
<AUTOSAR xmlns="http://autosar.org/schema/r4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://autosar.org/schema/r4.0 autosar_4-2-2.xsd">
<ADMIN-DATA>
<USED-LANGUAGES>
<L-10 L="EN" xml:space="preserve">English</L-10>
</USED-LANGUAGES>
</ADMIN-DATA>
<AR-PACKAGES>
<AR-PACKAGE>
<SHORT-NAME>os</SHORT-NAME>
<ELEMENTS>
<ECUC-VALUE-COLLECTION>
<SHORT-NAME>os</SHORT-NAME>
<ECUC-VALUES>
<ECUC-MODULE-CONFIGURATION-VALUES-REF-CONDITIONAL>
<ECUC-MODULE-CONFIGURATION-VALUES-REF DEST="ECUC-MODULE-CONFIGURATION-VALUES">/os/Os</ECUC-MODULE-CONFIGURATION-VALUES-REF>
</ECUC-MODULE-CONFIGURATION-VALUES-REF-CONDITIONAL>
</ECUC-VALUES>
</ECUC-VALUE-COLLECTION>
<ECUC-MODULE-CONFIGURATION-VALUES>
<SHORT-NAME>Os</SHORT-NAME>
<ADMIN-DATA>
<SDGS>
<SDG GID="source">
<SD GID="VALUE">/osconfig/os.ecucvalues</SD>
</SDG>
</SDGS>
</ADMIN-DATA>
<DEFINITION-REF DEST="ECUC-MODULE-DEF">/AUTOSAR/EcucDefs/Os</DEFINITION-REF>
<IMPLEMENTATION-CONFIG-VARIANT>VARIANT-PRE-COMPILE</IMPLEMENTATION-CONFIG-VARIANT>
<CONTAINERS>
<ECUC-CONTAINER-VALUE>
<SHORT-NAME>OsAppMode</SHORT-NAME>
<ADMIN-DATA>
<SDGS>
<SDG GID="source">
<SD GID="VALUE">/osconfig/os.ecucvalues</SD>
</SDG>
</SDGS>
</ADMIN-DATA>
<DEFINITION-REF DEST="ECUC-PARAM-CONF-CONTAINER-DEF">/AUTOSAR/EcucDefs/Os/OsAppMode</DEFINITION-REF>
</ECUC-CONTAINER-VALUE>
<ECUC-CONTAINER-VALUE>
<SHORT-NAME>ExampleOS</SHORT-NAME>
<ADMIN-DATA>
<SDGS>
<SDG GID="source">
<SD GID="VALUE">/osconfig/os.ecucvalues</SD>
</SDG>
</SDGS>
</ADMIN-DATA>
<DEFINITION-REF DEST="ECUC-PARAM-CONF-CONTAINER-DEF">/AUTOSAR/EcucDefs/Os/OsOS</DEFINITION-REF>
<PARAMETER-VALUES>
<ECUC-NUMERICAL-PARAM-VALUE>
<DEFINITION-REF DEST="ECUC-BOOLEAN-PARAM-DEF">/AUTOSAR/EcucDefs/Os/OsOS/OsUseParameterAccess</DEFINITION-REF>
<ANNOTATIONS>
<ANNOTATION>
<LABEL>
<L-4 L="EN">source</L-4>
</LABEL>
<ANNOTATION-ORIGIN>Ecuc Values Editor</ANNOTATION-ORIGIN>
<ANNOTATION-TEXT>
<P SI="egal">
<L-1 L="EN">/osconfig/os.ecucvalues</L-1>
</P>
</ANNOTATION-TEXT>
</ANNOTATION>
</ANNOTATIONS>
<VALUE>1</VALUE>
</ECUC-NUMERICAL-PARAM-VALUE>
<ECUC-NUMERICAL-PARAM-VALUE>
<DEFINITION-REF DEST="ECUC-BOOLEAN-PARAM-DEF">/AUTOSAR/EcucDefs/Os/OsOS/OsStackMonitoring</DEFINITION-REF>
<ANNOTATIONS>
<ANNOTATION>
<LABEL>
<L-4 L="EN">source</L-4>
</LABEL>
<ANNOTATION-ORIGIN>Ecuc Values Editor</ANNOTATION-ORIGIN>
<ANNOTATION-TEXT>
<P SI="egal">
<L-1 L="EN">/osconfig/os.ecucvalues</L-1>
</P>
</ANNOTATION-TEXT>
</ANNOTATION>
</ANNOTATIONS>
<VALUE>1</VALUE>
</ECUC-NUMERICAL-PARAM-VALUE>
<ECUC-TEXTUAL-PARAM-VALUE>
<DEFINITION-REF DEST="ECUC-ENUMERATION-PARAM-DEF">/AUTOSAR/EcucDefs/Os/OsOS/OsStatus</DEFINITION-REF>
<ANNOTATIONS>
<ANNOTATION>
<LABEL>
<L-4 L="EN">source</L-4>
</LABEL>
<ANNOTATION-ORIGIN>Ecuc Values Editor</ANNOTATION-ORIGIN>
<ANNOTATION-TEXT>
<P SI="egal">
<L-1 L="EN">/osconfig/os.ecucvalues</L-1>
</P>
</ANNOTATION-TEXT>
</ANNOTATION>
</ANNOTATIONS>
<VALUE>EXTENDED</VALUE>
</ECUC-TEXTUAL-PARAM-VALUE>
<ECUC-NUMERICAL-PARAM-VALUE>
<DEFINITION-REF DEST="ECUC-BOOLEAN-PARAM-DEF">/AUTOSAR/EcucDefs/Os/OsOS/OsUseGetServiceId</DEFINITION-REF>
<ANNOTATIONS>
<ANNOTATION>
<LABEL>
<L-4 L="EN">source</L-4>
</LABEL>
<ANNOTATION-ORIGIN>Ecuc Values Editor</ANNOTATION-ORIGIN>
<ANNOTATION-TEXT>
<P SI="egal">
<L-1 L="EN">/osconfig/os.ecucvalues</L-1>
</P>
</ANNOTATION-TEXT>
</ANNOTATION>
</ANNOTATIONS>
<VALUE>1</VALUE>
</ECUC-NUMERICAL-PARAM-VALUE>
<ECUC-NUMERICAL-PARAM-VALUE>
<DEFINITION-REF DEST="ECUC-BOOLEAN-PARAM-DEF">/AUTOSAR/EcucDefs/Os/OsOS/OsUseResScheduler</DEFINITION-REF>
<ANNOTATIONS>
<ANNOTATION>
<LABEL>
<L-4 L="EN">source</L-4>
</LABEL>
<ANNOTATION-ORIGIN>Ecuc Values Editor</ANNOTATION-ORIGIN>
<ANNOTATION-TEXT>
<P SI="egal">
<L-1 L="EN">/osconfig/os.ecucvalues</L-1>
</P>
</ANNOTATION-TEXT>
</ANNOTATION>
</ANNOTATIONS>
<VALUE>1</VALUE>
</ECUC-NUMERICAL-PARAM-VALUE>
</PARAMETER-VALUES>
<SUB-CONTAINERS>
<ECUC-CONTAINER-VALUE>
<SHORT-NAME>OsHooks</SHORT-NAME>
<ADMIN-DATA>
<SDGS>
<SDG GID="source">
<SD GID="VALUE">/osconfig/os.ecucvalues</SD>
</SDG>
</SDGS>
</ADMIN-DATA>
<DEFINITION-REF DEST="ECUC-PARAM-CONF-CONTAINER-DEF">/AUTOSAR/EcucDefs/Os/OsOS/OsHooks</DEFINITION-REF>
<PARAMETER-VALUES>
<ECUC-NUMERICAL-PARAM-VALUE>
<DEFINITION-REF DEST="ECUC-BOOLEAN-PARAM-DEF">/AUTOSAR/EcucDefs/Os/OsOS/OsHooks/OsErrorHook</DEFINITION-REF>
<ANNOTATIONS>
<ANNOTATION>
<LABEL>
<L-4 L="EN">source</L-4>
</LABEL>
<ANNOTATION-ORIGIN>Ecuc Values Editor</ANNOTATION-ORIGIN>
<ANNOTATION-TEXT>
<P SI="egal">
<L-1 L="EN">/osconfig/os.ecucvalues</L-1>
</P>
</ANNOTATION-TEXT>
</ANNOTATION>
</ANNOTATIONS>
<VALUE>1</VALUE>
</ECUC-NUMERICAL-PARAM-VALUE>
<ECUC-NUMERICAL-PARAM-VALUE>
<DEFINITION-REF DEST="ECUC-BOOLEAN-PARAM-DEF">/AUTOSAR/EcucDefs/Os/OsOS/OsHooks/OsPostTaskHook</DEFINITION-REF>
<ANNOTATIONS>
<ANNOTATION>
<LABEL>
<L-4 L="EN">source</L-4>
</LABEL>
<ANNOTATION-ORIGIN>Ecuc Values Editor</ANNOTATION-ORIGIN>
<ANNOTATION-TEXT>
<P SI="egal">
<L-1 L="EN">/osconfig/os.ecucvalues</L-1>
</P>
</ANNOTATION-TEXT>
</ANNOTATION>
</ANNOTATIONS>
<VALUE>1</VALUE>
</ECUC-NUMERICAL-PARAM-VALUE>
<ECUC-NUMERICAL-PARAM-VALUE>
<DEFINITION-REF DEST="ECUC-BOOLEAN-PARAM-DEF">/AUTOSAR/EcucDefs/Os/OsOS/OsHooks/OsPreTaskHook</DEFINITION-REF>
<ANNOTATIONS>
<ANNOTATION>
<LABEL>
<L-4 L="EN">source</L-4>
</LABEL>
<ANNOTATION-ORIGIN>Ecuc Values Editor</ANNOTATION-ORIGIN>
<ANNOTATION-TEXT>
<P SI="egal">
<L-1 L="EN">/osconfig/os.ecucvalues</L-1>
</P>
</ANNOTATION-TEXT>
</ANNOTATION>
</ANNOTATIONS>
<VALUE>1</VALUE>
</ECUC-NUMERICAL-PARAM-VALUE>
<ECUC-NUMERICAL-PARAM-VALUE>
<DEFINITION-REF DEST="ECUC-BOOLEAN-PARAM-DEF">/AUTOSAR/EcucDefs/Os/OsOS/OsHooks/OsShutdownHook</DEFINITION-REF>
<ANNOTATIONS>
<ANNOTATION>
<LABEL>
<L-4 L="EN">source</L-4>
</LABEL>
<ANNOTATION-ORIGIN>Ecuc Values Editor</ANNOTATION-ORIGIN>
<ANNOTATION-TEXT>
<P SI="egal">
<L-1 L="EN">/osconfig/os.ecucvalues</L-1>
</P>
</ANNOTATION-TEXT>
</ANNOTATION>
</ANNOTATIONS>
<VALUE>1</VALUE>
</ECUC-NUMERICAL-PARAM-VALUE>
<ECUC-NUMERICAL-PARAM-VALUE>
<DEFINITION-REF DEST="ECUC-BOOLEAN-PARAM-DEF">/AUTOSAR/EcucDefs/Os/OsOS/OsHooks/OsStartupHook</DEFINITION-REF>
<ANNOTATIONS>
<ANNOTATION>
<LABEL>
<L-4 L="EN">source</L-4>
</LABEL>
<ANNOTATION-ORIGIN>Ecuc Values Editor</ANNOTATION-ORIGIN>
<ANNOTATION-TEXT>
<P SI="egal">
<L-1 L="EN">/osconfig/os.ecucvalues</L-1>
</P>
</ANNOTATION-TEXT>
</ANNOTATION>
</ANNOTATIONS>
<VALUE>1</VALUE>
</ECUC-NUMERICAL-PARAM-VALUE>
</PARAMETER-VALUES>
</ECUC-CONTAINER-VALUE>
</SUB-CONTAINERS>
</ECUC-CONTAINER-VALUE>
<ECUC-CONTAINER-VALUE>
<SHORT-NAME>ev1</SHORT-NAME>
<ADMIN-DATA>
<SDGS>
<SDG GID="source">
<SD GID="VALUE">/osconfig/os.ecucvalues</SD>
</SDG>
</SDGS>
</ADMIN-DATA>
<DEFINITION-REF DEST="ECUC-PARAM-CONF-CONTAINER-DEF">/AUTOSAR/EcucDefs/Os/OsEvent</DEFINITION-REF>
</ECUC-CONTAINER-VALUE>
<ECUC-CONTAINER-VALUE>
<SHORT-NAME>task1</SHORT-NAME>
<ADMIN-DATA>
<SDGS>
<SDG GID="source">
<SD GID="VALUE">/osconfig/os.ecucvalues</SD>
</SDG>
</SDGS>
</ADMIN-DATA>
<DEFINITION-REF DEST="ECUC-PARAM-CONF-CONTAINER-DEF">/AUTOSAR/EcucDefs/Os/OsTask</DEFINITION-REF>
<REFERENCE-VALUES>
<ECUC-REFERENCE-VALUE>
<DEFINITION-REF DEST="ECUC-REFERENCE-DEF">/AUTOSAR/EcucDefs/Os/OsTask/OsTaskEventRef</DEFINITION-REF>
<ANNOTATIONS>
<ANNOTATION>
<LABEL>
<L-4 L="EN">source</L-4>
</LABEL>
<ANNOTATION-ORIGIN>Ecuc Values Editor</ANNOTATION-ORIGIN>
<ANNOTATION-TEXT>
<P SI="egal">
<L-1 L="EN">/osconfig/os.ecucvalues</L-1>
</P>
</ANNOTATION-TEXT>
</ANNOTATION>
</ANNOTATIONS>
<VALUE-REF DEST="ECUC-CONTAINER-VALUE">/os/Os/ev1</VALUE-REF>
</ECUC-REFERENCE-VALUE>
</REFERENCE-VALUES>
</ECUC-CONTAINER-VALUE>
</CONTAINERS>
</ECUC-MODULE-CONFIGURATION-VALUES>
</ELEMENTS>
</AR-PACKAGE>
</AR-PACKAGES>
</AUTOSAR>
<?xml version="1.0" encoding="UTF-8"?>
<AUTOSAR xmlns="http://autosar.org/schema/r4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://autosar.org/schema/r4.0 AUTOSAR_4-0-3.xsd">
<AR-PACKAGES>
<AR-PACKAGE UUID="8bada0df-b371-42bf-8efb-70a5e37848d9">
<SHORT-NAME>AUTOSAR</SHORT-NAME>
<AR-PACKAGES>
<AR-PACKAGE UUID="255535ce-4bbd-431b-b824-967fa1ba7fd9">
<SHORT-NAME>ABC</SHORT-NAME>
<ELEMENTS>
<IMPLEMENTATION-DATA-TYPE UUID="e5f2e035-9407-4b4c-bce8-44831376e6f2">
<SHORT-NAME>Arr_2D</SHORT-NAME>
<CATEGORY>ARRAY</CATEGORY>
<SUB-ELEMENTS>
<IMPLEMENTATION-DATA-TYPE-ELEMENT UUID="f5bca0ab-22f2-49ab-95ea-907ae6b508e2">
<SHORT-NAME>Arr1</SHORT-NAME>
<ARRAY-SIZE>5</ARRAY-SIZE>
<SUB-ELEMENTS>
<IMPLEMENTATION-DATA-TYPE-ELEMENT UUID="25d8239a-86fb-4cba-bf8a-6d052a814af2">
<SHORT-NAME>Arr2</SHORT-NAME>
<ARRAY-SIZE>2</ARRAY-SIZE>
<ARRAY-SIZE-SEMANTICS>FIXED-SIZE</ARRAY-SIZE-SEMANTICS>
<SW-DATA-DEF-PROPS>
<SW-DATA-DEF-PROPS-VARIANTS>
<SW-DATA-DEF-PROPS-CONDITIONAL>
<BASE-TYPE-REF DEST="SW-BASE-TYPE">/AUTOSAR/KPIT/Arr2D_Base</BASE-TYPE-REF>
</SW-DATA-DEF-PROPS-CONDITIONAL>
</SW-DATA-DEF-PROPS-VARIANTS>
</SW-DATA-DEF-PROPS>
</IMPLEMENTATION-DATA-TYPE-ELEMENT>
</SUB-ELEMENTS>
</IMPLEMENTATION-DATA-TYPE-ELEMENT>
</SUB-ELEMENTS>
</IMPLEMENTATION-DATA-TYPE>
<IMPLEMENTATION-DATA-TYPE S="" UUID="41923e04-c4e4-42b0-b6de-850298a8c757">
<SHORT-NAME>SingleArray</SHORT-NAME>
<CATEGORY>ARRAY</CATEGORY>
<SUB-ELEMENTS>
<IMPLEMENTATION-DATA-TYPE-ELEMENT UUID="61fd326e-4453-45e8-bd4c-2ad3b4c70e65">
<SHORT-NAME>Uint8</SHORT-NAME>
<ARRAY-SIZE>4</ARRAY-SIZE>
<ARRAY-SIZE-SEMANTICS>FIXED-SIZE</ARRAY-SIZE-SEMANTICS>
<SW-DATA-DEF-PROPS S="SwDataDefProps_0">
<SW-DATA-DEF-PROPS-VARIANTS>
<SW-DATA-DEF-PROPS-CONDITIONAL>
<BASE-TYPE-REF DEST="SW-BASE-TYPE">/AUTOSAR/KPIT/uint8</BASE-TYPE-REF>
<SW-CALIBRATION-ACCESS>READ-ONLY</SW-CALIBRATION-ACCESS>
<SW-IMPL-POLICY>CONST</SW-IMPL-POLICY>
<SW-IS-VIRTUAL>false</SW-IS-VIRTUAL>
</SW-DATA-DEF-PROPS-CONDITIONAL>
</SW-DATA-DEF-PROPS-VARIANTS>
</SW-DATA-DEF-PROPS>
</IMPLEMENTATION-DATA-TYPE-ELEMENT>
</SUB-ELEMENTS>
<TYPE-EMITTER></TYPE-EMITTER>
</IMPLEMENTATION-DATA-TYPE>
<IMPLEMENTATION-DATA-TYPE UUID="3dd66464-e1cf-4a8e-917c-0ec540377810">
<SHORT-NAME>StructImpl1</SHORT-NAME>
<SUB-ELEMENTS>
<IMPLEMENTATION-DATA-TYPE-ELEMENT UUID="c29d3da1-f8a8-44ef-b885-3f2dce8258f1">
<SHORT-NAME>ImplData_U8_Arr</SHORT-NAME>
<ARRAY-SIZE>4</ARRAY-SIZE>
<ARRAY-SIZE-SEMANTICS>FIXED-SIZE</ARRAY-SIZE-SEMANTICS>
<SW-DATA-DEF-PROPS>
<SW-DATA-DEF-PROPS-VARIANTS>
<SW-DATA-DEF-PROPS-CONDITIONAL>
<BASE-TYPE-REF DEST="SW-BASE-TYPE">/AUTOSAR/KPIT/uint8</BASE-TYPE-REF>
<SW-CALIBRATION-ACCESS>READ-WRITE</SW-CALIBRATION-ACCESS></SW-DATA-DEF-PROPS-CONDITIONAL>
</SW-DATA-DEF-PROPS-VARIANTS></SW-DATA-DEF-PROPS>
</IMPLEMENTATION-DATA-TYPE-ELEMENT>
<IMPLEMENTATION-DATA-TYPE-ELEMENT UUID="1f82a8d3-79c8-48e5-a32f-a35dc8bb8b15">
<SHORT-NAME>ImplData_U16</SHORT-NAME>
<SW-DATA-DEF-PROPS>
<SW-DATA-DEF-PROPS-VARIANTS>
<SW-DATA-DEF-PROPS-CONDITIONAL>
<BASE-TYPE-REF DEST="SW-BASE-TYPE">/AUTOSAR/KPIT/uint16</BASE-TYPE-REF></SW-DATA-DEF-PROPS-CONDITIONAL>
</SW-DATA-DEF-PROPS-VARIANTS></SW-DATA-DEF-PROPS>
</IMPLEMENTATION-DATA-TYPE-ELEMENT>
<IMPLEMENTATION-DATA-TYPE-ELEMENT UUID="c85c16c7-bbaa-45b2-b604-6412c60869d6">
<SHORT-NAME>ImplData_U32</SHORT-NAME>
<SW-DATA-DEF-PROPS>
<SW-DATA-DEF-PROPS-VARIANTS>
<SW-DATA-DEF-PROPS-CONDITIONAL>
<BASE-TYPE-REF DEST="SW-BASE-TYPE">/AUTOSAR/KPIT/uint32</BASE-TYPE-REF></SW-DATA-DEF-PROPS-CONDITIONAL>
</SW-DATA-DEF-PROPS-VARIANTS></SW-DATA-DEF-PROPS>
</IMPLEMENTATION-DATA-TYPE-ELEMENT>
</SUB-ELEMENTS>
</IMPLEMENTATION-DATA-TYPE>
<IMPLEMENTATION-DATA-TYPE UUID="bde1cfff-5dca-46bf-8365-62037c7e0be7">
<SHORT-NAME>UInt8</SHORT-NAME>
<SW-DATA-DEF-PROPS>
<SW-DATA-DEF-PROPS-VARIANTS>
<SW-DATA-DEF-PROPS-CONDITIONAL>
<BASE-TYPE-REF DEST="SW-BASE-TYPE">/AUTOSAR/KPIT/uint8</BASE-TYPE-REF></SW-DATA-DEF-PROPS-CONDITIONAL>
</SW-DATA-DEF-PROPS-VARIANTS></SW-DATA-DEF-PROPS>
</IMPLEMENTATION-DATA-TYPE>
<IMPLEMENTATION-DATA-TYPE UUID="229441c6-c8d7-4857-8a4e-8e4528a1792e">
<SHORT-NAME>UInt16</SHORT-NAME>
<SW-DATA-DEF-PROPS>
<SW-DATA-DEF-PROPS-VARIANTS>
<SW-DATA-DEF-PROPS-CONDITIONAL>
<BASE-TYPE-REF DEST="SW-BASE-TYPE">/AUTOSAR/KPIT/uint16</BASE-TYPE-REF></SW-DATA-DEF-PROPS-CONDITIONAL>
</SW-DATA-DEF-PROPS-VARIANTS></SW-DATA-DEF-PROPS>
</IMPLEMENTATION-DATA-TYPE>
<IMPLEMENTATION-DATA-TYPE UUID="8afe59ce-5507-4e5d-a342-2f815ff7cc24">
<SHORT-NAME>UInt32</SHORT-NAME>
<SW-DATA-DEF-PROPS>
<SW-DATA-DEF-PROPS-VARIANTS>
<SW-DATA-DEF-PROPS-CONDITIONAL>
<BASE-TYPE-REF DEST="SW-BASE-TYPE">/AUTOSAR/KPIT/uint32</BASE-TYPE-REF></SW-DATA-DEF-PROPS-CONDITIONAL>
</SW-DATA-DEF-PROPS-VARIANTS></SW-DATA-DEF-PROPS>
</IMPLEMENTATION-DATA-TYPE>
<SW-BASE-TYPE UUID="e1e75893-8d85-4b9d-b8c7-6637f52a1833">
<SHORT-NAME>uint16</SHORT-NAME>
<BASE-TYPE-SIZE>16</BASE-TYPE-SIZE>
<BYTE-ORDER>MOST-SIGNIFICANT-BYTE-FIRST</BYTE-ORDER>
<NATIVE-DECLARATION>unsigned int</NATIVE-DECLARATION>
</SW-BASE-TYPE>
<SW-BASE-TYPE UUID="d45625cc-2aab-491b-ba2a-9d1618c518ab">
<SHORT-NAME>uint32</SHORT-NAME>
<BASE-TYPE-SIZE>32</BASE-TYPE-SIZE>
<BYTE-ORDER>MOST-SIGNIFICANT-BYTE-FIRST</BYTE-ORDER>
<NATIVE-DECLARATION>unsigned long</NATIVE-DECLARATION>
</SW-BASE-TYPE>
<SW-BASE-TYPE UUID="1be0e77e-1103-4c29-a8bf-d41a1bbc1a4c">
<SHORT-NAME>uint8</SHORT-NAME>
<BASE-TYPE-SIZE>8</BASE-TYPE-SIZE>
<BYTE-ORDER>MOST-SIGNIFICANT-BYTE-FIRST</BYTE-ORDER>
<NATIVE-DECLARATION>unsigned char</NATIVE-DECLARATION>
</SW-BASE-TYPE>
<SW-BASE-TYPE UUID="fb67bdbb-7d08-4344-b745-cf67b7fc2b1f">
<SHORT-NAME>Arr2D_Base</SHORT-NAME>
<BASE-TYPE-SIZE>8</BASE-TYPE-SIZE>
<BYTE-ORDER>MOST-SIGNIFICANT-BYTE-FIRST</BYTE-ORDER>
<NATIVE-DECLARATION>unsigned char</NATIVE-DECLARATION>
</SW-BASE-TYPE>
</ELEMENTS>
</AR-PACKAGE>
</AR-PACKAGES>
</AR-PACKAGE>
</AR-PACKAGES>
</AUTOSAR>
If you know the XML, then using SWS, Chapter Test configuration, in this the container of all parameters are mapped and from multiplicity to datatype of particular parameters are already mentioned.
Autosar Modules Descrption file (for each sofware module) can be developed using ARTOP topology.
e.g. Vector or EB provides BSW Module Description files for each BSW modules. which are usually of extension *.arxml's or *.xdn which which are like blank form ( empty parameter files) which then can be loaded into the bundle form into configurator tool, and values can be modified.
If you know the xml and SWS for OS you can develope Os_Ecuc.arxml with all the parameters.
Related
i want to build a new module for Magento 1.9.4 that will be shown in the Admin area (catalog).
I programmed the following code, but i dont know how to show this module in the backend (including form tags). I just get a 404 error.
Here is my code with which i started my first module:
config.xml
<?xml version="1.0"?>
<config>
<modules>
<Eron_ChangePricesPerCategory>
<version>0.1.0</version>
</Eron_ChangePricesPerCategory>
</modules>
<frontend>
<routers>
<changepricespercategory>
<use>standard</use>
<args>
<module>Eron_ChangePricesPerCategory</module>
<frontName>changepricespercategory</frontName>
</args>
</changepricespercategory>
</routers>
</frontend>
<admin>
<routers>
<changepricespercategory>
<use>admin</use>
<args>
<module>Eron_ChangePricesPerCategory</module>
<frontName>admin_changepricespercategory</frontName>
</args>
</changepricespercategory>
</routers>
</admin>
<global>
<helpers>
<changepricespercategory>
<class>Eron_ChangePricesPerCategory_Helper</class>
</changepricespercategory>
</helpers>
</global>
<adminhtml>
<layout>
<updates>
<eron_changepricespercategory>
<file>eron_changepricespercategory.xml</file>
</eron_changepricespercategory>
</updates>
</layout>
</adminhtml>
</config>
adminhtml.xml
<?xml version="1.0"?>
<config>
<acl>
<resources>
<admin>
<children>
<system>
<children>
<config>
<children>
<changepricespercategory_settings translate="title">
<title>Extra Fee Settings</title>
<sort_order>55</sort_order>
</changepricespercategory_settings>
</children>
</config>
</children>
</system>
</children>
</admin>
</resources>
</acl>
</config>
system.xml
<?xml version="1.0"?>
<config>
<sections>
<changepricespercategory translate="label" module="changepricespercategory">
<label>Artikelpreise pro Kategorie ändern</label>
<tab>catalog</tab>
<frontend_type>text</frontend_type>
<sort_order>999</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
<fields>
<active translate="label">
<label>Aktiviert</label>
<frontend_type>select</frontend_type>
<source_model>adminhtml/system_config_source_yesno</source_model>
<sort_order>10</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</active>
<title translate="label">
<label>Title</label>
<frontend_type>text</frontend_type>
<sort_order>20</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</title>
<name translate="label">
<label>Name</label>
<frontend_type>text</frontend_type>
<sort_order>30</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</name>
<showmethod translate="label">
<label>Versandart zeigen, auch wenn nicht möglich</label>
<frontend_type>select</frontend_type>
<sort_order>50</sort_order>
<source_model>adminhtml/system_config_source_yesno</source_model>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</showmethod>
<specificerrmsg translate="label">
<label>Angezeigte Fehlermeldung</label>
<frontend_type>textarea</frontend_type>
<sort_order>60</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</specificerrmsg>
<sort_order translate="label">
<label>Reihenfolge</label>
<frontend_type>text</frontend_type>
<sort_order>70</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</sort_order>
</fields>
</changepricespercategory>
</sections>
</config>
IndexController.php (in controllers/Adminhtml)
<?php
class Eron_ChangePricesPerCategory_Adminhtml_IndexController extends Mage_Adminhtml_Controller_Action {
/**
* Admin controller index action
*
* #access public
* #return void
*/
public function indexAction() {
$Block = $this->getLayout()->createBlock('changepricespercategory/Adminhtml_changepricespercategory');
$this->loadLayout()
->_addContent($Block)
->renderLayout();
}
}
The Module is shown in the backend... But i when i click on it, I get a 404. Can anybody help me? Maybe there is a good documentation - im new to magento module developement.
More Information: I want to build a module for changing all prices of a category by a percentage (e.g 2% increase).
You can get started from this toturial:
https://bsscommerce.com/confluence/3-simple-steps-to-create-admin-grid-in-magento-1/
If you want to try more features check this one:
https://www.codealist.com/magento-1-9-x-create-an-adminhtml-controller/
I have made a query extension where you can ask your query, and then get a reply from admin. And I have already managed to get the extension setting tab added as a tab in the admin configuration area, and created "Product Query" menu also.
successfully created this tab
Here are all of my files :)
app/code/local/Vlabs/Productquery/etc/config.xml
<?xml version="1.0"?>
<config>
<modules>
<Vlabs_Productquery>
<version>0.1.0</version>
</Vlabs_Productquery>
</modules>
<frontend>
<routers>
<productquery>
<use>standard</use>
<args>
<module>Vlabs_Productquery</module>
<frontName>productquery</frontName>
</args>
</productquery>
</routers>
<layout>
<updates>
<productquery module="Vlabs_Productquery">
<file>productquery.xml</file>
</productquery>
</updates>
</layout>
</frontend>
<global>
<blocks>
<productquery>
<class>Vlabs_Productquery_Block</class>
</productquery>
</blocks>
<models>
<productquery>
<class>Vlabs_Productquery_Model</class>
<resourceModel>productquery_Resource</resourceModel>
</productquery>
<productquery_Resource>
<class>Vlabs_Productquery_Model_Resource</class>
<entities>
<querybox>
<table>Vlabs_queryBox</table>
</querybox>
</entities>
</productquery_Resource>
</models>
<helpers>
<productquery>
<class>Vlabs_Productquery_Helper</class>
</productquery>
</helpers>
<resources>
<form_setup>
<setup>
<module>Vlabs_Productquery</module>
</setup>
<connection>
<use>core_setup</use>
</connection>
</form_setup>
<form_write>
<connection>
<use>core_write</use>
</connection>
</form_write>
<form_read>
<connection>
<use>core_read</use>
</connection>
</form_read>
</resources>
<template>
<email>
<vlabs_query_email_template translate="label">
<label>Recurring order email</label>
<file>vlabs_querybox_email.html</file>
<type>html</type>
</vlabs_query_email_template>
</email>
</template>
</global>
<admin>
<routers>
<adminhtml>
<use>admin</use>
<args>
<modules>
<Vlabs_Productquery before="Mage_Adminhtml">Vlabs_Productquery_Adminhtml</Vlabs_Productquery>
</modules>
<frontname>productquery</frontname>
</args>
</adminhtml>
</routers>
</admin>
<adminhtml>
<layout>
<updates>
<productquery>
<file>productquery.xml</file>
</productquery>
</updates>
</layout>
</adminhtml>
</config>
app/code/local/Vlabs/Productquery/etc/adminhtml.xml
<config>
<menu>
<productquery>
<title>Product Query</title>
<sort_order>50</sort_order>
<children>
<query>
<title>Query</title>
<sort_order>1</sort_order>
<action>adminhtml/index/</action>
</query>
<settings>
<title>Settings</title>
<sort_order>2</sort_order>
<action>adminhtml/index/settings</action>
</settings>
</children>
</productquery>
</menu>
<acl>
<resources>
<admin>
<children>
<system>
<children>
<config>
<children>
<productquery>
<title>Beckin Drop Down Shipping Extension</title>
</productquery>
</children>
</config>
</children>
</system>
</children>
</admin>
</resources>
</acl>
</config>
app/code/local/Vlabs/Productquery/etc/system.xml
<?xml version="1.0"?>
<config>
<tabs>
<productquery translate="label">
<label>Vyrazu Query Extension</label>
<sort_order>100</sort_order>
</productquery>
</tabs>
<sections>
<productquery translate="label" module="productquery">
<label>Query</label>
<tab>productquery</tab>
<frontend_type>text</frontend_type>
<sort_order>1000</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
<groups>
<settings translate="label" module="productquery">
<label>Settings</label>
<frontend_type>text</frontend_type>
<sort_order>1</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
<fields>
<enable translate="label">
<label>Enable</label>
<comment>
<![CDATA[Enable or Disable this extension.]]>
</comment>
<frontend_type>select</frontend_type>
<source_model>adminhtml/system_config_source_yesno</source_model>
<sort_order>1</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</enable>
</fields>
</settings>
</groups>
</productquery>
</sections>
</config>
Please guide me, where I should write those code,by this i can disable or enable this extension with this disable/enable dropdown.
I solved the issue.May be someone will be helpfull by this answer. That's why I update my answer.
So,at first write this anywhere to check it is working or not
$enableorDisable = Mage::getStoreConfig('productquery/settings/enable',Mage::app()->getStore());
print_r($enableorDisable); die();
if answer is 0 when your module is disable and answer is 1, when your module is enable. then it is working fine.. And you have to add following line in your block.
<action method="setTitle" translate="value" ifconfig="productquery/settings/enable"><value>Product Query</value></action>
add ifconfig="modulename/group name/field name"
Thank You..
I am trying to load the following fxml file. I simply get an exception thrown pointing to line 19. I can load this in scenebuilder just fine, via Show preview in window menu item. At first I thought one couldn't have rectangles be children of a stackpane but that is the very example Oracle uses for javadoc and StackPane. Is there a known best practice to debug failures to load and fxml file? It flags the first child under reticlefilter stackpane.
The two children in question are the light blue rectangle with the yellow reticle.
<?xml version="1.0" encoding="UTF-8"?>
<?import org.cornova.javafx.*?>
<?import javafx.scene.shape.*?>
<?import javafx.geometry.*?>
<?import javafx.scene.text.*?>
<?import javafx.scene.control.*?>
<?import java.lang.*?>
<?import javafx.scene.layout.*?>
<VBox fx:id="sliceRealEstate" alignment="TOP_CENTER" onMouseDragged="#onMouseDragged" onMousePressed="#onMousePressed" onScroll="#onScroll" onScrollStarted="#onScrollStarted" pickOnBounds="false" stylesheets="#org/cornova/javafx/xpssdr.css" xmlns="http://javafx.com/javafx/8.0.40" xmlns:fx="http://javafx.com/fxml/1" fx:controller="org.cornova.xpssdr.controllers.SliceController">
<children>
<HBox fx:id="flagPole" pickOnBounds="false">
<children>
<Pane fx:id="flagPane" pickOnBounds="false" stylesheets="#org/cornova/javafx/xpssdr.css">
<children>
<StackPane fx:id="reticleFilter" alignment="BOTTOM_LEFT" pickOnBounds="false">
<children>
***<Rectangle fx:id="filter" fill="#3670ad" height="40.0" opacity="0.38" width="30.0" StackPane.alignment="CENTER" />***
<Rectangle fx:id="reticle" fill="#e8e82f" height="40.0" width="2.0" StackPane.alignment="CENTER" />
</children>
</StackPane>
<HBox fx:id="flag">
<children>
<VBox alignment="TOP_CENTER" spacing="10.0" style="-fx-background-color: black;" HBox.hgrow="NEVER">
<children>
<Button fx:id="close" mnemonicParsing="false" onAction="#close" text="cls">
<font>
<Font size="10.0" />
</font>
</Button>
<Button fx:id="lock" layoutX="10.0" layoutY="10.0" mnemonicParsing="false" onAction="#lock" text="lck">
<font>
<Font size="10.0" />
</font>
</Button>
<Button fx:id="record" layoutX="10.0" layoutY="29.0" mnemonicParsing="false" onAction="#record" text="rec">
<font>
<Font size="10.0" />
</font>
</Button>
<Button fx:id="play" layoutX="10.0" layoutY="48.0" mnemonicParsing="false" onAction="#play" text="play">
<font>
<Font size="10.0" />
</font>
</Button>
</children>
</VBox>
<VBox alignment="CENTER" style="-fx-background-color: black;" HBox.hgrow="NEVER">
<children>
<HBox alignment="CENTER" VBox.vgrow="ALWAYS">
<children>
<VBox alignment="CENTER" HBox.hgrow="NEVER">
<children>
<HBox alignment="CENTER" VBox.vgrow="NEVER">
<children>
<VBox alignment="TOP_CENTER">
<children>
<ComboBox fx:id="rcvsrc" prefWidth="65.0" />
<ComboBox fx:id="txsrc" prefWidth="65.0" />
</children>
</VBox>
<Label fx:id="filterwidth" text="200" HBox.hgrow="NEVER" />
</children>
</HBox>
<HBox alignment="CENTER_LEFT" fillHeight="false" VBox.vgrow="NEVER">
<children>
<Label fx:id="nbon" text="nb" />
<Label fx:id="apfon" text="nr" />
<Label fx:id="nron" text="apf" />
<Label fx:id="qskon" text="qsk" />
</children>
</HBox>
</children>
</VBox>
<HBox HBox.hgrow="ALWAYS">
<children>
<Label fx:id="txindicator" alignment="CENTER" contentDisplay="CENTER" graphicTextGap="0.0" styleClass="largeindicators" text="TX" textAlignment="CENTER" textFill="RED">
<font>
<Font size="28.0" />
</font>
</Label>
<Label fx:id="sliceind" alignment="CENTER" contentDisplay="CENTER" styleClass="largeindicators" text="A" textAlignment="CENTER">
<font>
<Font size="27.0" />
</font>
</Label>
</children>
</HBox>
</children>
</HBox>
<VBox VBox.vgrow="NEVER">
<children>
<HBox alignment="CENTER" VBox.vgrow="NEVER">
<children>
<Label fx:id="signalLevel" alignment="CENTER" styleClass="mediumindicators" text="S9" HBox.hgrow="NEVER">
<opaqueInsets>
<Insets />
</opaqueInsets>
</Label>
<Label fx:id="signalplus" text="+20" />
<TextField fx:id="frequency" maxHeight="-Infinity" maxWidth="161.0" onAction="#onFrequencyChange" onMouseEntered="#scale" prefHeight="40.0" prefWidth="144.0" promptText="144.123456" styleClass="mediumindicators" />
</children>
</HBox>
</children>
</VBox>
<HBox VBox.vgrow="NEVER">
<children>
<ButtonBar buttonMinWidth="30.0" HBox.hgrow="NEVER">
<buttons>
<Button fx:id="spkr" mnemonicParsing="false" onAction="#displaySpkrSubmenu" text="spkr">
<font>
<Font size="10.0" />
</font>
</Button>
<Button fx:id="dsp" mnemonicParsing="false" onAction="#displayDSPSubmenu" text="dsp">
<font>
<Font size="10.0" />
</font>
</Button>
<Button fx:id="mode" layoutX="125.0" layoutY="17.0" mnemonicParsing="false" onAction="#displayModeSubmenu" text="rtty">
<font>
<Font size="10.0" />
</font>
</Button>
<Button layoutX="220.0" layoutY="17.0" mnemonicParsing="false" onAction="#displayXRITSubmenu" text="x/rit" fx:id="xrit">
<font>
<Font size="10.0" />
</font>
</Button>
<Button fx:id="dax" layoutX="315.0" layoutY="17.0" mnemonicParsing="false" onAction="#displayDAXSubmenu" text="dax">
<font>
<Font size="10.0" />
</font>
</Button>
</buttons>
<padding>
<Insets bottom="5.0" right="5.0" top="5.0" />
</padding>
</ButtonBar>
</children>
</HBox>
</children>
</VBox>
</children>
</HBox>
</children>
</Pane>
</children>
</HBox>
</children>
</VBox>
Additional information:
Exact text from exception
11:11:24.191 [nioEventLoopGroup-2-3] DEBUG org.cornova.xpssdr.views.SliceView - javafx.fxml.LoadException:
file:/home/walt/NetBeansProjects/XPSSDR/dist/run293699722/XPSSDR.jar!/SliceFlag.fxml:19
Code that does the load.
public VBox create() throws IOException {
VBox pane = null;
try {
pane = sliceLoader.load();
controller = sliceLoader.getController();
controller.setRadio(radio);
controller.setPan(pan);
controller = sliceLoader.getController();
controller.setPanadapter(pan);
controller.setParent(this);
controller.setSlice(slice);
wire();
Platform.runLater(() -> {
controller.wire();
});
} catch (Exception e) {
if (log.isDebugEnabled()) {
log.debug(e.getLocalizedMessage());
log.debug(e.getMessage());
log.debug(e.toString());
}
}
return pane;
}
The error was actually in the constructor to the controller. Late last night I, in an attempt to get the reticle displayed, when it was a ResizableCanvas I decided to change it to Rectangle such that it would simply take a fill(). As this was an existing app and existing controller that worked, such as it was, I didn't create it from SceneBuilder's View sample controller and had inadvertantly not changed the #FXML in the constructor of the controller. In FXMLLoader.java I was eventually able to trace it to the point it was trying to invoke something, the controller. Oddly though, it was pointing at the wrong controller, which I did verify was correct in the fxml. A puzzlement but not the current one. To you comment James about there is always a stack trace. No, many times there is not. It just strikes me perhaps I am missing some best practice on debugging these (JavaFX fxml loader issues which I've had several of these last couple of days.
Is there a way to convert following XML file to element-centric file? Perhaps using an online tool? Without requiring to use VB anything? I need to import this xml to Access, but unable to do so because Access requires element-centric xml.
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="invoices.xsl"?>
<invoices>
<invoice number="25" date="February 28, 2001">
<patient firstname="Jeff" familyname="Smith" SSN="123456789">
<phone type="home" number="123-4567890"/>
<phone number="321-76543321" type="work"/>
<address type="home" line1="123 Street" city="City" state="US" zip="12345"/>
</patient>
<insurance name="Humongous First Medical Insurance" plannumber="12345" planname="The Client Company">
<phone number="098-76543321"/>
<address type="business" line1="321 Street" city="City" state="US" zip="54321"/>
</insurance>
<procedure code="123" name="Cleaning nose" cost="50.00" insurance_estimate="50.00"/>
<procedure code="124" name="Tarot reading of illnesses" cost="150.00" insurance_estimate="120.00"/>
<procedure code="125" name="Just for fun" cost="100.00" insurance_estimate="80.00"/>
</invoice>
<invoice number="27" date="February 28, 2001">
<patient firstname="James" familyname="Smith" SSN="123456765">
<phone type="home" number="123-4562245"/>
<address type="home" line1="432 Street" city="City" state="US" zip="12343"/>
</patient>
<insurance name="Humongous Second Medical Insurance" plannumber="3455" planname="Another Client Company">
<phone number="098-76543321"/>
<address type="business" line1="344 Street" city="Some City" state="US" zip="54323"/>
</insurance>
<procedure code="123" name="Cleaning nose" cost="50.00" insurance_estimate="50.00"/>
<procedure code="124" name="Tarot reading of illnesses" cost="150.00" insurance_estimate="120.00"/>
</invoice>
<invoice number="29" date="February 28, 2001">
<patient firstname="Neil" familyname="Smith" SSN="123456345">
<phone type="home" number="125-4345890"/>
<address type="home" line1="187 Street" city="Lost City" state="US" zip="42145"/>
</patient>
<insurance name="Humongous Third Medical Insurance" plannumber="12345" planname="The Lost City Client Company">
<phone number="198-76345321"/>
<address type="business" line1="342 Street" city="Completely Lost City" state="US" zip="111111-0000"/>
</insurance>
<procedure code="123" name="Cleaning nose" cost="50.00" insurance_estimate="50.00"/>
<procedure code="125" name="Maybe they wouldn't see this line..." cost="100.00" insurance_estimate="80.00"/>
</invoice>
</invoices>
Use following as your invoices.xsl
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="node()">
<xsl:copy>
<xsl:apply-templates select="#*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="#*">
<xsl:element name="{name()}">
<xsl:value-of select="."/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
I am trying to generate a 4 column directory, grouped by the 4 disciplines in my department. One XML file contains the entire group. Each element has a department tag. The construction of the directory would be the following:
Group each entry by discipline.
For each group, cycle through each entry. If the Rank equals Supervisor, fill out the supervisor DIV, otherwise keep generating a div for each person in the group.
Once all entries in the group are exhausted, construct the next column for the next group...
Keep going until all groups are exhausted.
I'm new to XSLT and really need help. I can create a key for each group, and cycle through the entries in the group, but I'm not sure how to cycle through the different groups.
My mark up is below.
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:key name="group" match="employee" use="dept" />
<xsl:template match="/">
<div id="directory">
<div class="man">
<h1>Manager</h1>
<h2>John Doe</h2>
</div>
<div class="group">
<xsl:for-each select="key('group', 'Mechanical')">
<xsl:sort select="name" order="ascending"/>
(I need a conditional here to check if rank = supervisor)
<div class="super">
<h1>Supervisor</h1>
<h2><xsl:value-of select="name"/></h2>
</div>
<div>
<p class="name"><xsl:value-of select="name"/></p>
<p class="ID"><xsl:value-of select="id"/></p>
</div>
</xsl:for-each>
</div>
XML Directory
<?xml version="1.0" encoding="ISO-8859-1" ?>
<directory>
<employee>
<dept></dept>
<rank>Manager</rank>
<name>John Doe</name>
<id>1234</id>
</employee>
<employee>
<dept>Mechanical</dept>
<rank>Supervisor</rank>
<name>Jane Doe</name>
<id>4321</id>
</employee>
<employee>
<dept>Mechanical</dept>
<rank>General</rank>
<name>Joe Doe</name>
<id>2314</id>
</employee>
<employee>
<dept>Mechanical</dept>
<rank>General</rank>
<name>Joe Doe</name>
<id>2314</id>
</employee>
<employee>
<dept>Civil</dept>
<rank>Supervisor</rank>
<name>Jane Doe</name>
<id>4321</id>
</employee>
<employee>
<dept>Civil</dept>
<rank>General</rank>
<name>Joe Doe</name>
<id>2314</id>
</employee>
<employee>
<dept>Civil</dept>
<rank>General</rank>
<name>Joe Doe</name>
<id>2314</id>
</employee>
<employee>
<dept>Electrical</dept>
<rank>Supervisor</rank>
<name>Jane Doe</name>
<id>4321</id>
</employee>
<employee>
<dept>Electrical</dept>
<rank>General</rank>
<name>Joe Doe</name>
<id>2314</id>
</employee>
<employee>
<dept>Electrical</dept>
<rank>General</rank>
<name>Joe Doe</name>
<id>2314</id>
</employee>
</directory>
Output would look something like:
HTML should look something like:
<div id="directory">
<div class="man">
<h1>Manager</h1>
<h2>John Doe</h2>
</div>
<div class="group">
<div class="super">
<h1>Mechanical Supervisor</h1>
<h2>Supervisor Name</h2>
</div>
<div>
<p class="name">Mech employee name</p>
<p class="ID">Mech employee ID</p>
</div><!--end group A-->
<div class="group">
<div class="super">
<h1>CivilSupervisor</h1>
<h2>Supervisor Name</h2>
</div>
<div>
<p class="name">Civil employee name</p>
<p class="ID">Civil employee ID</p>
</div><!--end group B-->
<div class="group">
<div class="super">
<h1>Electrical Supervisor</h1>
<h2>Supervisor Name</h2>
</div>
<div>
<p class="name">Electrical employee name</p>
<p class="ID">Electrical employee ID</p>
</div><!--end group C-->
</div>
This XSLT 1.0 transformation:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:key name="kEmpByDeptRank" match="employee"
use="concat(dept,'+', rank)"/>
<xsl:key name="kEmpByDept" match="employee"
use="dept"/>
<xsl:template match="directory">
<div id="directory">
<xsl:apply-templates select=
"key('kEmpByDeptRank', '+Manager')"/>
<xsl:apply-templates select=
"employee[not(rank='Manager')]"/>
</div>
</xsl:template>
<xsl:template match=
"employee[generate-id()
=
generate-id(key('kEmpByDept', dept)[1])
]
">
<div class="group">
<xsl:apply-templates mode="inGroup" select=
"key('kEmpByDeptRank', concat(dept,'+Supervisor'))"/>
<xsl:apply-templates mode="inGroup" select=
"key('kEmpByDept', dept)[not(rank='Supervisor')]"/>
</div>
</xsl:template>
<xsl:template match="employee[rank='Manager']">
<div class="man">
<h1>Manager</h1>
<h2><xsl:value-of select="name"/></h2>
</div>
</xsl:template>
<xsl:template match="employee[rank='Supervisor']"
mode="inGroup">
<div class="super">
<h1>
<xsl:value-of select="concat(dept, ' Supervisor')"/>
</h1>
<h2><xsl:value-of select="name"/></h2>
</div>
</xsl:template>
<xsl:template match="employee" mode="inGroup">
<div>
<p class="name">
<xsl:value-of select="concat(dept, ' ', name)"/>
</p>
<p class="ID">
<xsl:value-of select="concat(dept, ' ', id)"/>
</p>
</div>
</xsl:template>
<xsl:template match="employee"/>
</xsl:stylesheet>
when applied on this XML document (similar to the provided one, but changed the names and Ids to be distinct):
<directory>
<employee>
<dept></dept>
<rank>Manager</rank>
<name>John Doe</name>
<id>1234</id>
</employee>
<employee>
<dept>Mechanical</dept>
<rank>Supervisor</rank>
<name>Jane Doe</name>
<id>4321</id>
</employee>
<employee>
<dept>Mechanical</dept>
<rank>General</rank>
<name>Joe Doe</name>
<id>2314</id>
</employee>
<employee>
<dept>Mechanical</dept>
<rank>General</rank>
<name>Jim Smith</name>
<id>2315</id>
</employee>
<employee>
<dept>Civil</dept>
<rank>Supervisor</rank>
<name>Ann Smith</name>
<id>4322</id>
</employee>
<employee>
<dept>Civil</dept>
<rank>General</rank>
<name>Peter Pan</name>
<id>2316</id>
</employee>
<employee>
<dept>Civil</dept>
<rank>General</rank>
<name>Mike Sims</name>
<id>2317</id>
</employee>
<employee>
<dept>Electrical</dept>
<rank>Supervisor</rank>
<name>Amy Dull</name>
<id>4323</id>
</employee>
<employee>
<dept>Electrical</dept>
<rank>General</rank>
<name>Dan Brown</name>
<id>2318</id>
</employee>
<employee>
<dept>Electrical</dept>
<rank>General</rank>
<name>John Kerry</name>
<id>2319</id>
</employee>
</directory>
produces the wanted, correct result:
<div id="directory">
<div class="man">
<h1>Manager</h1>
<h2>John Doe</h2>
</div>
<div class="group">
<div class="super">
<h1>Mechanical Supervisor</h1>
<h2>Jane Doe</h2>
</div>
<div>
<p class="name">Mechanical Joe Doe</p>
<p class="ID">Mechanical 2314</p>
</div>
<div>
<p class="name">Mechanical Jim Smith</p>
<p class="ID">Mechanical 2315</p>
</div>
</div>
<div class="group">
<div class="super">
<h1>Civil Supervisor</h1>
<h2>Ann Smith</h2>
</div>
<div>
<p class="name">Civil Peter Pan</p>
<p class="ID">Civil 2316</p>
</div>
<div>
<p class="name">Civil Mike Sims</p>
<p class="ID">Civil 2317</p>
</div>
</div>
<div class="group">
<div class="super">
<h1>Electrical Supervisor</h1>
<h2>Amy Dull</h2>
</div>
<div>
<p class="name">Electrical Dan Brown</p>
<p class="ID">Electrical 2318</p>
</div>
<div>
<p class="name">Electrical John Kerry</p>
<p class="ID">Electrical 2319</p>
</div>
</div>
</div>
and it displays in the browser as:
Manager
John Doe
Mechanical Supervisor
Jane Doe
Mechanical Joe Doe
Mechanical 2314
Mechanical Jim Smith
Mechanical 2315
Civil Supervisor
Ann Smith
Civil Peter Pan
Civil 2316
Civil Mike Sims
Civil 2317
Electrical Supervisor
Amy Dull
Electrical Dan Brown
Electrical 2318
Electrical John Kerry
Electrical 2319
Explanation: Muenchian method for grouping, and locating an employee (Manager or Supervisor) using a composite key (rank, department).