Help:Templatefile format – parameter template

From semantic-mediawiki.org
< Help:Templatefile format
Templatefile formatHelp:Templatefile format – parameter template
Parameter template
This help page explains the usage of a template for the templatefile format to display the output of the query.
Keywords

This help page explains the usage of unnamed arguments (also called anonymous or numbered arguments) when using templates for the result format "templatefile"Outputs results in arbitrary file formats defined via templates. to display the output of your queries.

Often the parameter introtemplate is used together with this parameter, however this is optional.

The templates specified with these parameters get stacked when being rendered. The template specified with the introtemplate parameter is rendered above the template specified with the template parameter whereas the template specified with the outrotemplate parameter is rendered below the template specified with the template parameter which is in turn rendered as often as there are results to a query.

Templates are used when printouts require more complex handling for an output than just displaying them with result format "Table"Outputs the results in a table (default for queries with printout statements). and it's more basic display options.

Example[edit]

Syntax
{{#ask:
 [[Has GND::+]]
 |?Has GND
 |?Foaf:name
 |format=templatefile
 |introtemplate=BEACONIntro
 |template=BEACON
 |link=none
 |filename=beacon.txt
 |searchlabel=beacon export
}}
Result

beacon export

The templates used to create this example: BEACONIntro and BEACON.

Notes
  • The argument is added to the template like, e.g. {{{1}}} in the same ascending order as the result and the printout statements are queried.
  • To hide the argument if the result does not have a value for the respective printout statement use, e.g. {{{1|}}}.
  • To fill the argument if the result does not have a value for the respective printout statement use, e.g. {{{1|sometext}}}.

Tabular output[edit]

In comparison the tabular output using the result format "table"Outputs the results in a table (default for queries with printout statements). is created like this:

Syntax
{{#ask:
 [[Has GND::+]]
 |?Has GND=GND
 |?Foaf:name=Name
 |format=table
 |link=none
}}
Result
 GNDName
John Doe123456789John Doe
Max Mustermann987654321Max Mustermann

See also[edit]