Changes between Version 57 and Version 196 of TaggingPresets


Ignore:
Timestamp:
(multiple changes)
Author:
(multiple changes)
Comment:
(multiple changes)

Legend:

Unmodified
Added
Removed
Modified
  • TaggingPresets

    v57 v196  
    1 [[TranslatedPages(outdated=The preset syntax has changed and the copy from XML files needs to be joined with normal description)]]
     1[[TranslatedPages]]
     2[[PageOutline(2-10,Table of Contents)]]
     3
     4''If you want to learn installation steps for presets, see [[JOSMImage(dialogs/propertiesdialog)]] [wikitr:/Help/Preferences/TaggingPresetPreference Tagging Presets] register in [[JOSMImage(preference)]] [wikitr:/Help/Action/Preferences Preferences]'' \\
     5''If you want to use presets or need complete reference of presets see [wikitr:/Presets Presets]''
     6
     7----
     8
    29= Tagging Presets =
    3 JOSM supports distributed tagging presets. This is a XML config file that describes a GUI for entering tags (or properties, annotations, sometimes called map features). The XML files can be placed anywhere in the web or at the users local file system. Presets can be added by the users at a central page [wiki:Presets].
    4 
    5 
    6 == Installing presets ==
    7 Open the [Help/Action/Preferences preferences window], click [[Image(source:trunk/images/preferences/map.png,20)]] map settings and select third tab [Help/Preferences/Map#TaggingPresets "Tagging Presets"].
    8 
    9 ----
    10 
    11 == Develop a new preset – Example ==
    12 
    13 [[Image(tagging_screenshot.png,align=right)]]
     10JOSM supports distributed tagging presets. This is a XML config file that describes a GUI for entering tags (or properties, annotations, sometimes called map features).
     11
     12The presets can be placed anywhere in the web or at the users local file system. JOSM can be configured to use custom local or remote Presets.
     13
     14== Develop a new preset ==
     15The tagging preset description is in a very simple XML format. Details see [#XML below].
     16
     17See the **[source:/trunk/resources/data/defaultpresets.xml defaultpresets.xml]** for an example covering most of the possibilities listed below.
     18
     19Example:
     20
     21[[Image(Change 1 object.png,right,link=,margin-left=15)]]
    1422
    1523{{{
    16 #!xml
     24#!preset
     25<?xml version="1.0" encoding="UTF-8"?>
    1726<presets xmlns="http://josm.openstreetmap.de/tagging-preset-1.0">
    18   <item name="Highway">
    19     <label text="Inserting a highway in UK" />
    20 
    21     <text key="name" text="Highway (e.g. M3)" />
    22     <combo key="highway" text="Type" values="major,minor" />
    23 
    24     <!-- Highways are usually oneway -->
     27  <item name="Oneway highway" type="way">
     28    <label text="Inserting a unidirectional highway" />
     29
     30    <combo key="highway" text="Type" values="trunk,motorway" />
     31    <text key="name" text="Name (e.g. Angel Road)" />
     32    <text key="ref" text="Ref (e.g. A406)" />
     33
     34    <!-- This is a oneway preset, so make oneway default -->
    2535    <check key="oneway" text="Oneway" default="on" />
    2636
    27     <!-- Always setting class=highway -->
    28     <key key="class" value="highway" />
     37    <!-- Always setting asphalt surface -->
     38    <key key="surface" value="asphalt" />
    2939  </item>
    3040</presets>
    3141}}}
    32 
    33 
    34 == Develop a new preset – Add to the list of available presets ==
    35 
    36 See [[Presets]].
    37 
    38 
    39 == Develop a new preset – XML Format description ==
    40 
    41 The tagging preset description is in a very simple XML format.
    42 
    43 See the comment section in **[source:trunk/data/defaultpresets.xml defaultpresets.xml]** for the **valid format description**.
    44 
    45 The full XSD schema is available at the namespace URI (http://josm.openstreetmap.de/tagging-preset-1.0) as well as [source:trunk/data/tagging-preset.xsd the source repository].
    46 
    47 ----
    48 
    49 == Develop a new preset – XML Format description (outdated!) ==
     42\\
     43
     44== XML Format description ==#XML
     45The full XSD schema is available at the namespace URI (https://josm.openstreetmap.de/tagging-preset-1.0) as well as [source:/trunk/resources/data/tagging-preset.xsd the source repository].
    5046
    5147=== Tags ===
    52 The document prolog:
    53  '''<presets>'''::
    54    Has to be the main tag of the file. Supports following attributes
    55    * '''xmlns="http://josm.openstreetmap.de/tagging-preset-1.0"'''
    56    * '''author''' - the name of the author
    57    * '''version''' - a version of the file
    58    * '''description''' (i18n) - description what the file contains
    59    * '''shortdescription''' (i18n) - short overview description
    60    * '''link''' (i18n) - web link to further details
    61    * '''icon''' - informational icon for the preset
    62 Comments:
    63  '''<!-- this is an example comment -->'''::
    64   The document can contain embedded comments.
    65 Menu creation:
    66  '''<group>'''::
    67    Used to group items in sub menus. ''name'' is required, ''icon'' is optional attribute.
    68  '''<item>'''::
    69    Every item is one annotation set to select from. ''name'' is required, ''icon'' is optional attribute.
    70  '''<separator/>'''::
     48==== The document prologue ====
     49 <presets>::
     50  Has to be the main tag of the file. Supports following attributes
     51  * **xmlns="http://josm.openstreetmap.de/tagging-preset-1.0"**
     52  * **author** - the name of the author of the preset
     53  * **version** - the version number of the file. For automatic version adjustment of presets managed in this wiki you have to use two internal variables: `[[revision]]` (the latest version number of the wiki page) and `[[date]]` (the date of the last edit), e.g. `version="1.[[revision]]_[[date]]"`.
     54  * **description** (i18n) - description what the file contains
     55  * **shortdescription** (i18n) - very short overview description i.e. the "name" of the preset
     56  * **link** (i18n) - web link to further details (optional)
     57  * **icon** - icon for the whole preset
     58  * **baselanguage** - when the base language is not English, specify it here (using non English preset texts will prevent automatic translation, once it is implemented (#11392))
     59
     60 (i18n) means the values may also be localized (e.g. `de.description`).
     61\\
     62
     63==== Comments ====
     64 <!-- this is an example comment -->::
     65   The document can contain embedded comments.
     66\\
     67
     68==== Preset group creation ====
     69 <group>::
     70   Used to group items in sub menus. `name=""` is required, `icon=""` is optional attribute.
     71 <item>::
     72   Every item is one annotation set to select from. `name=""` is required, `type=""` and `preset_name_label=""` are recommended, `icon=""`, `name_template=""` and `match_expression=""` are optional attributes.
     73 <separator />::
    7174   Insert a line separator into the menu.
    72 Create instructions for the user:
    73  '''<label>'''::
    74    Labels are static texts for display. ''text'' is a required attribute.
    75  '''<optional>'''::
    76    Used to group some optional elements of an item. Possibly equivalent to <label text="Optional Attributes:"/>
    77  '''<space />'''::
    78    Add some space (ie a newline) in the preset display. Possibly equivalent to <label text=" "/>
    79  '''<link>'''::
    80    Specify a web link for this feature or to anything else of use. The ''href'' attribute is required.
    81 Attribute entry and selection dialog boxes:
    82  '''<text>'''::
    83    A text edit field to enter any arbitrary string from the user. ''key'' is mandatory, ''text'', ''default'' and ''required'' is optional
    84  '''<combo>'''::
    85    Displays a multiple choice combo box. ''key'' and ''values'' are mandatory and ''text'', ''default'', ''editable'' and ''required'' is optional.
    86    If editable is true (default), combo boxes can be edited as if they were text fields (additional to the drop down menu). Non editable
    87    combo boxes can only contain one of the specified values.
    88 
    89  '''<multiselect>'''::
    90    Displays a list from which zero or more items can be chosen. ''key'' and ''values'' are mandatory, and ''text'', ''default'', ''delimiter'', and ''required'' are optional. The selected values will be concatenated with the specified delimiter (default: semicolon) and written to the tag value. If a tag value has already been set when the preset dialog is opened, the multiselect will attempt to mark the appropriate items in the list as select. If the tag value cannot be represented by a combination of choices in the list, then the list will be disabled so that the user cannot accidentally overwrite a custom value. In contrast to the "combo" element, the "multiselect" expects the list of values, descriptions etc. to use the specified delimiter, i.e. by default you will have to use a semicolon. You can specify delimiter="," but then a comma will also be used in the tag value.
    91  '''<check>'''::
    92    A checkbox which the user can only select or deselect. The ''key'' attribute is mandatory. ''text'', ''default'' and ''required'' is optional.
    93 Set a key value pair:
    94  '''<key>'''::
    95    This tag will always set a key to a specific value. ''key'' is required and if ''value'' is present, the key will be set. If ''value'' attribute is ommited, the key is removed.
     75\\
     76
     77==== Preset window layout ====
     78 <label />::
     79   Labels are static texts for display. `text=""` is a required attribute, `icon=""` and `icon_size=""` are optional.
     80 <space />::
     81   Add some space (i.e. a newline).
     82 <optional>::
     83   Used to group some optional elements of an item. The `text=""` attribute is optional. If used without `text=""` then this is equivalent to `<space /><label text="Optional Attributes:" /><space />`
     84 <item_separator />::
     85   Add a horizontal separator line between items.
     86 <link />::
     87   Specify a web link for this feature or to anything else of use. Either the `wiki=""` (referring to an OSM wiki page, e.g. `"Tag:leisure=park"`) or the `href=""` (full URL) attribute is required. When the `wiki=""` attribute is used the link points to the wiki page of the language JOSM is set to. If it doesn't exist the English page is shown. If using `wiki=""`, the OSM wiki page must not be URL encoded, e.g., it must not be `"Tag:leisure%3Dpark"` and must instead be `"Tag:leisure=park"`.
     88 <checkgroup>::
     89   To group checks. The `columns=""` attribute is required.
     90 <roles>::
     91   This is required around `<role />` and adds the heading ("Available roles role count elements") to the table which is generated by several `<role />`.
     92 <role />::
     93   To specify possible roles of members in relations. The `key=""` attribute is required, `text=""`, `requisite=""`, `count=""`, `type=""`, `member_expression=""` and `regexp=""` are optional.
     94 <preset_link />::
     95   Adds a link to an other preset with a label on top. The `preset_name=""` attribute is required, `text=""` to override the label (default is `"Edit also …"`) and `text_context=""` are optional. A sequence of `<preset_link />` without `text=""` or a identical `text=""` value are grouped below one label. \\
     96   **Watch out** for presets with identical **`name=""`** as it is not predictable to which preset the link will lead to, see #12716. \\
     97   Having the same tag in both presets does not work, see #18992. \\
     98   Using `<preset_link />` in presets opened from [wikitr:/Help/Dialog/RelationEditor relation editor] produces exceptions, see #20044.
     99\\
     100
     101==== Set a fixed key value pair ====
     102 <key />::
     103   This tag will always set a key to a specific value. `key=""` is required and if `value=""` is present, the key will be set. If `value=""` attribute is omitted, the key is removed. The `match=""` attribute is optional.
     104\\
     105
     106==== Attribute entry and selection dialog boxes ====#EntrySelectionBoxes
     107 <text />::
     108   A text edit field to enter any arbitrary string from the user. `key=""` is mandatory, `text=""`, `default=""`, `use_last_as_default=""`, `auto_increment=""`, `length=""`, `alternative_autocomplete_keys=""`, `match=""`, `icon=""` and `icon_size=""` (both since r17605) are optional.
     109 <combo />::
     110   Displays a multiple choice combo box. `key=""` and `values=""` are mandatory, `text=""`, `default=""`, `editable=""`, `delimiter=""`, `values_from=""`, `display_values=""`, `short_descriptions=""`, `use_last_as_default=""`, `values_searchable=""`, `length=""`, `values_no_i18n=""`, `values_sort=""`, `match=""`, `icon=""` and `icon_size=""` (both since r17605) are optional.\\
     111   If `editable=""` is `true` (default), combo boxes can be edited as if they were text fields (additional to the drop down menu). Non editable combo boxes can only contain one of the specified values.\\
     112   If the key is `colour` or `colour:*` or `*:colour`, a color preview and color picker is added on the right (see #8352).
     113 [=#multiselect]
     114 <multiselect />::
     115   Displays a list from which zero or more items can be chosen. `key=""` and `values=""` are mandatory, and `text=""`, `default=""`, `delimiter=""`, `values_from=""`, `rows=""`, `display_values=""`, `short_descriptions=""`, `use_last_as_default=""`, `values_searchable=""`, `values_no_i18n=""`, `values_sort=""`, `match=""`, `icon=""` and `icon_size=""` (both since r17605) are optional. The selected values will be concatenated with the specified delimiter (default: semicolon, `;`) and written to the tag value. If a tag value has already been set when the preset dialog is opened, the `<multiselect />` will attempt to mark the appropriate items in the list as select. If the tag value cannot be represented by a combination of choices in the list, then the list will be disabled so that the user cannot accidentally overwrite a custom value. In contrast to the `<combo />` element, the `<multiselect />` expects the list of values, descriptions etc. to use the specified delimiter, i.e. by default you will have to use a semicolon. You can specify `delimiter=","` but then a comma will also be used in the tag value.
     116 <list_entry />::
     117   Used in `<combo>` and `<multiselect>`. More information see `short_descriptions=""`, [#short_description below]. The attributes are `value=""`, `display_value=""`, `short_description=""`, `icon=""` and `icon_size=""`.
     118 <check />::
     119   A checkbox which the user can select, deselect or set as unset. The `key=""` attribute is mandatory. `text=""`, `default=""`, `match=""`, `value_on=""` , `value_off=""`, `disable_off=""`, `icon=""` and `icon_size=""` (both since r15437) are optional.
     120\\
     121
     122==== Templates ====
     123 <chunk>::
     124   To define a template of elements for later (repeated) use. The `id=""` attribute is mandatory.
     125 <reference>::
     126   To include an earlier defined template. The `ref=""` attribute is mandatory.
     127\\
    96128
    97129=== Attributes ===
    98130The attributes of the tags have the following meaning:
    99  '''name="a_name"'''::
     131 name="a_name"::
    100132   Specify a name for an item. This name will be used in the GUI to display the tagging preset.
    101  '''name_context="context"'''::
     133 name_context="context"::
    102134   Translation context for name attribute to separate equals words with different meaning (not required for in-file translations).
    103  '''type="data_type"'''::
    104    When specified, only objects of the given type will be changed at all by this tagging preset. Can be "node", "relation", "way", "closedway" or any comma separated combination of them.
    105  '''icon="iconname"'''::
    106    A name of an icon that is within any classpath in the subdirectory of /images/symbols. You can load plugin-jar's to provide those images as well. The image will be used as icon to display in the selection list and when adding the preset to the toolbar. The icon should be quadratic in size.
    107  '''key="some_key"'''::
    108    This specifies the property key that will be modified by the item.
    109  '''text="Any text"'''::
    110    The description, that will be displayed before (after in case of <check>) the gui element.
    111  '''text_context="context"'''::
     135 type="data_type"::
     136   When specified, only objects of the given type will work with this tagging preset. Can be `"node"`, `"way"`, `"closedway"`, `"multipolygon"`, `"relation"` or any comma separated combination of them. Note that `"multipolygon"` is not included in `"relation"`, so if the preset should apply for multipolygons and other relation types, you need to specify both: `"multipolygon,relation"`. Also used in the `<role>` tag to specify which object types are allowed for a specific relation member.
     137 icon="iconname"::
     138   A name or link to an icon. The image will be used as icon to display in the selection list and when adding the preset to the toolbar. Icons can also be used in  `<item>`, `<label />`, plus all [#EntrySelectionBoxes attribute entry and selection dialog boxes] (since r17605, before it was only `<list_entry />` and `<check />`).  It is placed in front of `<text />` The icon should be quadratic in size. See [wikitr:/Styles#Iconhandling Icon handling] how icons can be specified.
     139 icon_size="a number"::
     140   The maximal size of an icon in px. If no value is given, default is 16 for `<label />` and the default icon size for `<list_entry />` (in `<combo>` and `<multiselect>`).
     141 key="some_key"::
     142   This specifies the property key that will be modified by the item. In case of `<role>` it is the role name used in a relation.
     143 text="Any text"::
     144   The description, that will be displayed before the gui element, (in case of `<check />` after the gui element and the optional icon). Also used for `<label>` and `<optional>`.
     145 text_context="context"::
    112146   Translation context for text attribute to separate equals words with different meaning (not required for in-file translations).
    113  '''default="default_value"'''::
    114    The default value for the item. If not specified, the current value of the key is chosen as default (if applicable).
    115  '''values="entry1,entry2,entry3"'''::
    116    A list of entries (for the combo box and multiselect). The list has to be separated by commas (for the combo box) or by the specified delimiter (for the multiselect). If a value contains the delimiter, the delimiter may be escaped with a backslash. If a value contains a backslash, it must also be escaped with a backslash.
    117  '''values_context="context"'''::
    118    Translation context for name attribute to separate equals words with different meaning (not required for in-file translations).
    119  '''display_values="Entry1,Entry2,Entry3"'''::
    120    A list of entries that is displayed to the user. Must be the same number of entries as values and '''editable''' must be false or not specified. For the delimiter character and escaping, see the remarks at ''values''.
    121  '''value="foobar"'''::
    122    Specify a value to be entered in the <key> tag.
    123  '''value_on="foobar"'''::
    124    Specify the true value to be entered in the <key> tag (default is "yes").
    125  '''value_off="foobar"'''::
    126    Specify the false value to be entered in the <key> tag (default is "no").
    127  '''editable="false"'''::
    128    The combo box is readonly, which means that the user can only select an item in the list.
    129  '''use_last_as_default="true"'''::
    130    For combo boxes or text fields the last value is used as default. Using "force" enforces this behaviour also for already tagged objects.
    131  '''rows="count"'''::
    132    Specify the number of rows in multiselect entry.
    133  '''name_template="template", name_template_filter="search expression"'''::
    134    Custom name formatter for osm primitives matching this preset. See [[NameTemplate]] for details.
    135  '''match="none|key|key!|keyvalue|keyvalue!"'''::
    136     Allows to change the matching process, i.e., determining whether the tags of an OSM object fit into this preset. If a preset fits then it is linked in the [wiki:Help/Dialog/TagsMembership Tags/Membership dialog].
    137     * none: neutral, i.e., do not consider this item for matching
    138     * key: positive if key matches, neutral otherwise
    139     * key!: positive if key matches, negative otherwise
    140     * keyvalue: positive if key and value matches, neutral otherwise
    141     * keyvalue!: positive if key and value matches, negative otherwise
    142    Note that for a match, at least one positive and no negative is required. Default is "keyvalue!" for <key> and "none" for <text>, <combo>, <multiselect> and <check>.
    143 
    144 To support translations, all textual elements may be used in translated form. E.g. "de.name" would represent the name in case German language support is loaded.
    145 
    146 === Format description from XML document (needs to be joined with above texts) ===
    147 
    148 item:
    149   name: the text to display
    150   icon: the icon to display
    151   - relative to the icon path
    152   - URL's are also supported to allow remote icons (are cached locally)
    153   type: the data types - way,node,relation,closedway (separated by comma)
    154   name_template: define custom formatting for OSM primitives
    155                  see [[NameTemplate]]
    156   preset_name_label: whether to insert "[preset name]" label in dialog
    157                      (defaults to "false" for backward-compatibility on external presets)
    158 
    159 group: a group of items (same syntax as "item")
    160 
    161 link: link to the relating map features website
    162   href: the URL
    163 
    164 preset_link: a link to an other preset
    165   preset_name: the exact name of the preset to link to
    166 
    167 label: simple static text label
    168   text: the text to display
    169   icon: location of icon to display (optional)
    170   icon_size: maximal size of icon (optional). If no value is given, default is 16px
    171 
    172 space: empty line
    173 
    174 optional: optional tags, short for "space" plus "label" plus "space"
    175   text: the text to display (defaults to "Optional Attributes:")
    176 
    177 separator: separator line in menus
    178 
    179 item_separator: horizontal separator line between items (in window)
    180 
    181 key: fixed key/value pair to be set
    182   key: key to set
    183   value: value to set
    184   match: none/key/key!/keyvalue/keyvalue! (default is "keyvalue!", see below for more information)
    185 
    186 text: text box
    187   key: key to set
    188   text: fixed label to display
    189   default: default string to display (defaults to "")
    190   use_last_as_default: true/false/force (default is "false")
    191   auto_increment: may contain a comma separated list of integer increments or
    192                   decrements, e.g. "-2,-1,+1,+2"; a button will be shown next
    193                   to the text field for each value, allowing the user to select
    194                   auto-increment with the given stepping. auto-increment only
    195                   happens if the user selects it. default is no auto-increment;
    196                   mutually exclusive with use_last_as_default.
    197   match: none/key/key!/keyvalue/keyvalue! (default is "none", see below for more information)
    198   length: length of input box (number of characters allowed)
    199   alternative_autocomplete_keys: comma separated list of alternative keys to use for autocompletion
    200 
    201 combo: combo box, with multiple choices and possible to enter free form text
    202   key: key to set
    203   text: fixed label to display
    204   delimiter: character that separates values (default: comma)
    205   values: separated list of values
    206   values_from: to use instead of "values" if the list of values has to be obtained with a Java method
    207                of this form: public static String[] getValues();
    208                The value must be: "full.package.name.ClassName#methodName"
    209   display_values: comma separated list of values to be displayed instead of the
    210                   database values, order and number must be equal to values
    211   short_descriptions: comma separated list of texts to be displayed below each
    212                       display_value. (Only if it is not possible to describe
    213                       the entry in 2-3 words.) Instead of comma separated list
    214   instead using values, display_values and short_descriptions, the following form is also supported:
    215     <list_entry value="" display_value="" short_description="" icon="" icon_size="" />
    216         icon: location of icon
    217         icon_size: maximal size of icon. If tag is not setup it is taken default size of icon file
    218   default: default string to display (defaults to "")
    219   use_last_as_default: true/false/force (default is "false")
    220   editable: allow to add other values as text (default is "true")
    221   match: none/key/key!/keyvalue/keyvalue! (default is none, see below for more information)
    222   values_searchable: true/false (whether to search in combo (display_)values when searching for presets)
    223   length: length of input box (number of characters allowed)
    224 
    225 multiselect: list of values from which zero or more can be selected
    226   key: key to set
    227   text: fixed label to display
    228   delimiter: character that separates values (default: semicolon) - this
    229              will also be used to separate selected values in the tag.
    230   values: delimiter-separated list of values (delimiter can be escaped with backslash)
    231   values_from: to use instead of "values" if the list of values has to be obtained with a Java method
    232                of this form: public static String[] getValues();
    233                The value must be: "full.package.name.ClassName#methodName"
    234   rows: specify the number of rows to display (default -1)
    235   display_values: delimiter-separated list of values to be displayed instead of the
    236                   database values, order and number must be equal to values
    237   short_descriptions: delimiter-separated list of texts to be displayed below each
    238                       display_value. (Only if it is not possible to describe
    239                       the entry in 2-3 words.) Instead of a separated list
    240   instead using values, display_values and short_descriptions, the following form is also supported:
    241     <list_entry value="" display_value="' short_description="" icon="" icon_size="" />
    242         icon: location of icon
    243         icon_size: maximal size of icon. If tag is not setup it is taken default size of icon file
    244   default: default string to display (defaults to "")
    245   use_last_as_default: true/false/force (default is "false")
    246   match: none/key/key!/keyvalue/keyvalue! (default is "none", see below for more information)
    247   values_searchable: true/false (whether to search in multiselect (display_)values when searching for presets)
    248 
    249 checkgroup: group of checks
    250   columns: number of columns
    251 
    252 check: checkbox
    253   key: key to set
    254   text: fixed label to display
    255   default: ticked on/off (default is "off")
    256   value_on: the value to set when checked (default is "yes")
    257   value_off: the value to set when unchecked (default is "no")
    258   disable_off: whether the off value is disabled in the dialog, i.e., only unset or yes are provided
    259   match: none/key/key!/keyvalue/keyvalue! (default is "none", see below for more information)
    260 
    261 role: type to specify possible roles in relations
    262   key: the role name used in relation
    263   text: fixed label to display
    264   requisite: optional/required (default is "optional")
    265   count: how often can the role occur (if not given unlimited number is assumed)
    266   type: the data types - way,node,relation,closedway (separated by comma)
    267   member_expression: an expression (cf. search dialog) for objects of this role
    268 
    269 chunk: a template of elements for later (repeated) use
    270   id: the unique identifier for this chunk
    271 
    272 reference: include an earlier defined template
    273   ref: the unique identifier of the (already defined) template to include
    274 
    275  presets: For external files <presets> should have following attributes:
    276    author: the author of the preset
    277    version: a version number of some sort (e.g. creation date)
    278    description: what is your preset meant to be
    279    shortdescription: very short description
    280    link: a link to a helpful website (optional)
    281    icon: an icon for the whole presets
    282  The fields description, shortdescription and link may also be localized (e.g. de.link)
    283 
    284 The fields "name", "text", "display_values" may also be localized (e.g. de.name).
    285 When translations of equal words but different meanings may conflict, a translation
    286 context should be specified. Use "name_context", "text_context" or "values_context"
    287 for this. The context should be a meaningful short description to help translators.
    288 
    289 In JOSM internally all "name", "text" and "display_values" are translated when
    290 no specific translation has been given in XML file. When no "display_values"
    291 are supplied, then "values" will be treated as "display_values" and translated instead.
    292 
    293 The match attribute allows to change the matching process, i.e., determining whether
    294 the tags of an OSM object fit into this preset.
    295  - none: neutral, i.e., do not consider this item for matching
    296  - key: positive if key matches, neutral otherwise
    297  - key!: positive if key matches, negative otherwise
    298  - keyvalue: positive if key and value matches, neutral otherwise
    299  - keyvalue!: positive if key and value matches, negative otherwise
    300 Note that for a match, at least one positive and no negative is required.
    301 
    302 === Icon handling ===
    303 See [wiki:Styles#Iconhandling Styles].
     147 default="default_value"::
     148   An explicitly declared default value for the item. This value is ''only'' applied through a preset when the object the preset is applied to has ''zero keys''.
     149  If no value for default is specified, no value is set to the key. Used in `<check />`, `<text />`, `<combo />` and `<multiselect />`. For `<check />` only the values `"on"` and `"off"` are valid.
     150 values="entry1,entry2,entry3"::
     151   A list of entries (for the `<combo />` box and `<multiselect />`). The list has to be separated by commas (for the combo box) or by the specified delimiter (for the multiselect). If a value contains the delimiter, the delimiter may be escaped with a backslash. If a value contains a backslash, it must also be escaped with a backslash.
     152 values_from="JAVA code"::
     153   To use instead of `values=""` if the list of values has to be obtained with a Java method of this form: `public static String[] getValues()`; The value must be: "full.package.name.ClassName#methodName".
     154 values_no_i18n="true|false"::
     155   Disables internationalisation for values to avoid mistakes, see #11696. Default is `"false"`. Used in `<combo />` and `<multiselect />`. (Useful e.g. for keys `opening hours` or `brand`.) Not needed with keys with only numbers as values like `layer` or `level` which are already excluded from translation.
     156 values_sort="true|false"::
     157   Values of `<combo />` and `<multiselect />` are sorted alphabetic in every language. With this attribute you can disable the alphabetic sorting if the values should keep the given order, see #5509 and #11926. (In the JOSM internal preset this is used e.g. for the keys `tracktype`, `direction`, `network`, `smoothness`, `visibility` or `trail_visibility`.) Default is `"true"`.\\
     158  Users can globally disable sorting with the preference key `taggingpreset.sortvalues`.
     159 values_context="context"::
     160   Translation context for values attribute to separate equals words with different meaning (not required for in-file translations).
     161 display_values="Entry1,Entry2,Entry3"::
     162   A list of entries that is displayed to the user. Must be the same number and order of entries as `values=""` and `editable=""` must be `"false"` or not specified. For the delimiter character and escaping, see the remarks at `values=""`. Used in `<combo />` and `<multiselect />`.
     163 value="foobar"::
     164   Specify a value to be entered in the `<key>` tag.
     165 value_on="foobar"::
     166   Specify the true value to be entered in the `<key>` tag of a checked `<check />` (default is `"yes"`).
     167 value_off="foobar"::
     168   Specify the false value to be entered in the `<key>` tag of a unchecked `<check />` (default is `"no"`).
     169 disable_off="true"::
     170   Whether the off value of a `<check />` is disabled in the dialog, i.e., only unset or `"yes"` are provided.
     171 editable="false"::
     172   The combo box is read only, which means that the user can only select an item in the list. Default is `"true"`, which means, the user can add other values as text. (Feature was not working properly for a long time but should work again since r18221, see #6157.)
     173 use_last_as_default="true|false|force"::
     174   For `<combo />`, `<multiselect />` or `<text />` fields the last used value is used as default. Using `"force"` enforces this behavior also for already tagged objects. Default is `"false"`.
     175 rows="count"::
     176   Specify the number of rows to display in `<multiselect />` entry (if not set, it is auto determined by java or the look and feel and results in e.g. 8).
     177 name_template="template", name_template_filter="search expression"::
     178   Custom name formatter for osm primitives matching this preset. See [#name_templatedetails name template details] below.
     179 match="none|key|key!|keyvalue|keyvalue!"::
     180   Allows to change the matching process, i.e., determining whether the tags of an OSM object fit into this preset. If a preset fits then it is linked in the [wikitr:/Help/Dialog/TagsMembership Tags/Membership dialog].
     181   * `none`: neutral, i.e., do not consider this item for matching
     182   * `key`: positive if key matches, neutral otherwise
     183   * `key!`: positive if key matches, negative otherwise
     184   * `keyvalue`: positive if key and value matches, neutral otherwise
     185   * `keyvalue!`: positive if key and value matches, negative otherwise \\
     186  **Note**: For a match, at least one positive and no negative is required. Default is `"keyvalue!"` for `<key>` and `"none"` for `<text />`, `<combo />`, `<multiselect />` and `<check />`.
     187 match_expression="search expression"::
     188   additional criteria for matching primitives, specified in [wikitr:/Help/Action/Search JOSM search] syntax. ''(since r17662)'' \\
     189   Quotes (`"`) need to be written as `&quot;`. \\
     190   For instance, a preset with `match_expression="foo=bar"` requires OSM objects to have the tag `foo=bar`. You may want to use the `match_expression=""` to exclude certain OSM objects, e.g. when a more specific preset is present.
     191 id="unique_identifier"::
     192   the unique identifier for this `<chunk>`
     193 ref="unique_identifier"::
     194   the unique identifier of the (already defined) template to include
     195 columns="a number"::
     196   the number of columns of grouped `<check />`
     197 requisite="optional|required"::
     198   If a relation member is optional or required. Default is `"optional"`.
     199 count="a number"::
     200   How often can a role occur (if not given unlimited number is assumed)
     201 member_expression="search expression"::
     202   an expression, in [wikitr:/Help/Action/Search JOSM search] syntax, for objects of this role \\
     203   Quotes (`"`) need to be written as `&quot;`.
     204 regexp="true"::
     205   set to `"true"` if the key of a role is a regular expression. \\
     206   This allows variable roles e.g. `<role key="level_-?\d+" text="Building level" regexp="true" requisite="optional" type="relation" />` allows the roles `level_0`, `level_1`,...
     207 preset_name="exact_name"::
     208   The exact name of the preset to link to.
     209 preset_name_label="false|true"::
     210   Whether to insert "[preset name]" label in dialog (defaults to `"false"` for backward-compatibility on external presets).
     211 length="a number"::
     212   The length of a `<text />` or `<combo />` box (number of characters allowed).
     213 alternative_autocomplete_keys="some_key(s)"::
     214   A comma separated list of alternative keys to use for auto completion of `<text>`.
     215 auto_increment="-2,-1,+1,+2"::
     216   May contain a comma separated list of integer increments or decrements, e.g. `"-2,-1,+1,+2"`. A button will be shown next to the `<text />` field for each value, allowing the user to select auto-increment with the given stepping. Auto-increment only happens if the user selects it. There is also a button to deselect auto-increment. Default is no auto-increment. Mutually exclusive with `use_last_as_default=""`.
     217 delimiter="special character"::
     218   The character that separates values. In case of `<combo />` the default is ''comma'' (`,`). In case of `<multiselect />` the default is ''semicolon'' (`;`) and this will also be used to separate selected values in the tag. More information see `<multiselect />`, [#multiselect above].
     219 [=#short_description]
     220 short_descriptions="Entry1,Entry2,Entry3"::
     221   A delimiter-separated list of texts to be displayed below each `display_value=""`. (Only if it is not possible to describe the entry in 2-3 words.) Instead of a comma separated list  using `values=""`, `display_values=""` and `short_descriptions=""`, the following form is also supported: \\
     222   `<list_entry value="" display_value="" short_description="" icon="" icon_size="" />`
     223 values_searchable="true|false"::
     224   Whether to search in `values=""` and `display_values=""`, respectively, `value=""` and `display_value=""` of `<combo />` or `<multiselect />` searching for presets.
     225 value_template="template"::
     226   A template to generate the value automatically based on other tag values of the object. The same syntax as in `name_template=""` is used, [#NameTemplateSyntax see below]. ''(since r17639)'' \\
     227   For instance, `"Bus {ref}: {from} → {to}"` can be used to generate the name of a bus route relation. \\
     228  **Note**: There are some minor problems with this attribute, see #20851 and #20861.
     229\\
     230
     231===== name_template and value_template details ===== #name_templatedetails
     232Name templates can be used to define custom formatting for OSM primitives or GPX waypoints (for example in the Relations or Selection panels).
     233
     234{{{
     235#!xml
     236<?xml version="1.0" encoding="UTF-8"?>
     237<presets>
     238        <item name="Public transportation" type="relation"
     239                name_template="Bus({operator} {ref} ?{'{from} - {via} - {to}' | '{from} - {to}' | '{from}' | '{to}'})"
     240                name_template_filter="type=route route=bus">
     241        </item>
     242</presets>
     243}}}
     244
     245**Samples**
     246||= Template =||= Tags =||= Result =||
     247|| `House number {addr:housenumber}` || `addr:housenumber=10` || House number 10
     248|| `?{ 'House number {addr:housenumber} at {addr:street}' | 'House number {addr:housenumber}'  }` || `addr:housenumber=10` || House number 10
     249|| || `addr:housenumber=10 addr:street=Abbey road` || House number 10 at Abbey road
     250|| `?{ admin_level = 2 'NUTS 1' | admin_level = 4 'NUTS 2' | admin_level = 6 'NUTS 3' |  'Admin level {admin_level}'}` ||  `admin_level=4` || NUTS 2
     251|| || `admin_level=5` || Admin level 5
     252|| `{admin_level} - {name} !{parent() type=boundary '?{'(part of {admin_level} - {name})' | ''}'}` || `admin_level=6 name=Vysocina`, member of relation `admin_level=4 name=Jihovychod` || 6 - Vysocina (part of 4 - Jihovychod)
     253|| ||  `admin_level=2 name=Czech republic` (no parents) || 2 - Czech republic
     254\\
     255
     256====== Syntax ======#NameTemplateSyntax
     257* `{tag}` - insert the value of the tag.
     258* `?{condition1 'value1' | condition2 'value2' | 'value3'}` - use ''value1'' if ''condition1'' is satisfied, else use ''value2'' if ''condition2'' is satisfied, finally use ''value3'' if no condition is satisfied. Condition can be either explicit - in [wikitr:/Help/Action/Search JOSM search] syntax - or implicit:  The value is used when all tags referenced inside exist.
     259* `!{search_expression 'template'}` - search_expression is evaluated and first matching primitive is used as context for template. Useful for example to get tags of parent relation.
     260* `\` - use a backslash to escape special characters '{', '}', '?', '!'.  E.g. `What is this\? It is a {type}\!`.
     261\\
     262
     263====== Available values ======
     264For formatting of OSM primitives, the value of any tag can be used. Use the tag `{special:everything}` to display all available tags, eg. on your gpx waypoints.
     265
     266You can also use these virtual tags:
     267- `{special:everything}` prints all available values, available for formatting of both primitives and waypoints.
     268- `{special:id}` prints the ID of the osm primitive.
     269- `{special:localName}` prints the localized name, that is the value of `name:lang` for your language if it is available, or the value of `name` if it is not.
     270\\
     271
     272=== Deprecated Attributes ===
     273The following attributes are deprecated and no longer supported by JOSM:
     274
     275 delete_if_empty="true"::
     276   was removed in r5155. You can simply remove this attribute if still used in your preset.
     277 required="true"::
     278   replaced by `match=""` since r5155
     279\\
     280
     281== Translation ==
     282To support translations, all textual elements (`name=""`, `text=""`, `display_values=""`) can be localized. E.g. `de.name=""` would represent the name when the German language support is loaded. In the preset XML code the English term must be the first, before possible translations can be added.
     283
     284=== Internal Preset ===
     285The translation for the internal preset is done at [https://translations.launchpad.net/josm/trunk Launchpad] (and will probably change to another service in the future, since the Launchpad web interface often produces timeout errors, see #8645).
     286
     287In the [source:josm/trunk/resources/data/defaultpresets.xml internal preset], all `name=""`, `text=""` and `display_values=""` are translated via the above service, as long as no specific translation has been given within XML file. When no `display_values=""` are supplied, then `values=""` will be treated as `display_values=""` and translated instead.
     288
     289When the same English word has different translations in different contexts, the specific translation context needs to be specified. Use `name_context=""`, `text_context=""` or `values_context=""` for this purpose. The context should be a meaningful short description to help translators.
     290
     291=== External Presets ===
     292
     293The translation of external presets on this website is, so far, only possible inline within the preset XML source code, see #11392.
     294
     295However, when words are used in the external preset that already exist in the internal preset, the translation from the internal preset applies to the external as well. This is useful as long as the context is the same. When the context in the external preset is different, it needs to be distinguished by adding `name_context=""`, `text_context=""` or `values_context=""`.
     296
     297== Icon handling ==
     298See [wikitr:/Styles#Iconhandling Styles].
    304299
    305300== See also ==
    306 * [/Presets]
    307 * [wiki:Help/Preferences/Map#TaggingPresets Tagging presets preferences]
     301* [wikitr:/Help/Menu/Presets Presets menu]