XhBtRmL HTML Templates: Difference between revisions

From XBRLWiki
Jump to navigationJump to search
No edit summary
Line 70: Line 70:
In the following code example, an XPath expression is using the values of several variables
In the following code example, an XPath expression is using the values of several variables
<syntaxhighlight lang="html4strict">
<syntaxhighlight lang="html4strict">
...
  ...
<XBRLIf expression="$XBRL_TreeCurrentNode_IsAbstract and $XBRL_DepthLevel = 1 and $XBRL_ChildNumber > 0">
<XBRLIf expression="$XBRL_TreeCurrentNode_IsAbstract and $XBRL_DepthLevel = 1 and $XBRL_ChildNumber > 0">
<XBRLThen>
<XBRLThen>

Revision as of 18:58, 23 August 2009

XhBtRmL templates are used to generate the final HTML report from the content of XBRL files.

An XhBtRmL template is an xhtml file augmented with some specific elements that are understandable to the processor.

An XhBtRmL template is validated against a DTD (Document Type Definition) that is an extension of the official XHTML DTD. This means that all elements that exist in XHTML documents and the structure of XHTML documents are part of XhBtRmL templates as well.

Sample template

<syntaxhighlight lang="html4strict"> <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE template PUBLIC

 "-//Reporting Estandar S.L.//DTD XHTML 1.0 Transitional + XBRL Transformation Tags//EN"
 "http://www.reportingstandard.com/taxonomies/transform/HTMLTransformation.dtd">

<template> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Reportingstandard Investor Relations - Demo of Transformation tool</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link href="http://investor.google.com/google_ir.css" rel="stylesheet" type="text/css" media="screen" /> <style type="text/css"> ... </style> </head> <body>

 

<XBRLTemplate template="google-body.xhtml"/>

</body> </html> </template> </syntaxhighlight>

Document type

The document type of a template is: -//Reporting Estandar S.L.//DTD XHTML 1.0 Transitional + XBRL Transformation Tags//EN

System ID

The DTD for the document type is defined at: http://www.reportingstandard.com/taxonomies/transform/HTMLTransformation.dtd

Document content

The root element

The root element for a template is always a <tempalte> element. The template element is the container of elements defined in the xhtml namespace including the root xhtml element or any other sub element.

Other elements used for template definition

The set of elements specifically defined for creating XhBtRmL templates are:

  • the XBRLTemplate element; used for sub templates combined with iterators
  • the XBRLIf element; used in combination with XPath expressions in order to drive template content
  • the XBRLEval element; used in combination with XPath expressions in order to include calculated or evaluated content

The rest of the document content are just XML nodes that will be copied to the resulting output with some exceptions in order to allow calculated content and variables to be substituted with the right values.

Variable substitution

During the execution of the templates some variables will be created and the variable values will be updated. The user can refer to the variable values within XPath expressions and in text nodes inside the template content.

In the following code example, a template is defined to put in bold the content of the XBRL_CurrentDateStep variable. <syntaxhighlight lang="html4strict"> <template> $XBRL_CurrentDateStep </template> </syntaxhighlight>

In the following code example, an XPath expression is using the values of several variables <syntaxhighlight lang="html4strict">

 ...

<XBRLIf expression="$XBRL_TreeCurrentNode_IsAbstract and $XBRL_DepthLevel = 1 and $XBRL_ChildNumber > 0"> <XBRLThen>

 ...

</XBRLThen> </XBRLIf> </syntaxhighlight>

The XBRLTemplate element

The XBRLTemplate element is used in order to call another template one time or many times according to an iterator.

In the previous example, a call to a template one time without any iterator was defined here: <syntaxhighlight lang="html4strict"> ...

   <XBRLTemplate template="google-body.xhtml"/>

... </syntaxhighlight> Other examples of calls to templates are: Iterator through years in the report <syntaxhighlight lang="html4strict"> ... <XBRLTemplate template="google-year.xhtml" iterator="Dates" dateStep="Years" /> ... </syntaxhighlight> Iterator through facts in the report according to current concept and ordered according to the content of dateStep <syntaxhighlight lang="html4strict"> ... <XBRLTemplate template="google-fact-data.xhtml" iterator="Facts" dateStep="Years"/> ... </syntaxhighlight> Iterators are normally nested one inside another; in the most common case there will be one Link iterator that will contain nested Children iterators and nested Facts iterators. An XBRLTemplate element has the following attributes:

The template attribute

This attribute is required and contains the absolute or relative URL or a file that contains the template content.

The iterator attribute

This attribute is optional, if it exist the value can be one of the following:

  • Select; Indicates that the iterator will iterate through the nodes returned by the XPath expression indicated in the expression attribute. If the value of the iterator is Select then a value on the expression attribute is required. For each loop iteration the variable XBRL_Node will be updated to contain the returned node in the XPath expression. that variable name can be used in other XPath expressions or text nodes inside the template and the value will be automatically substituted by the processor.
  • Dates; Indicates that the iterator will iterate through the values of the instance document by columns (a column may contain more than one XBRL context). The column length will be indicated by the value of the dateStep attribute. If the value of the iterator is Dates then a value on the dateStep attribute is required. Each iteration will update the value of the XBRL_CurrentDateStep variable so templates using that variable on XPath expressions or texts nodes can use the iterator value for presentation purposes.
  • Link; Indicates that the iterator will iterate through the nodes in a hierarchy defined by relationships in the DTS. If the value of the iterator is Link then a value on the linkType attribute and a value on the role attribute are required.
  • Children; Indicates that the iterator will iterate through the nodes that are children of the current node.
  • Facts; Indicates that the iterator will iterate through the fact items in the instance that corresponds to the current concept. If the value of the iterator is Facts then a value on the dateStep attribute is required in order to return the facts in the right order.
  • DimMembers; Indicates that the iterator will iterate through dimension members of the current node.
  • Footnotes; Indicates that the iterator will iterate through footnotes in the report.

The role attribute

Is used to indicate the link role where relationships will be taken on Link iterators.

The expression attribute

Is used to indicate an XPath expression that will be used in Select iterators. During the evaluation of the XPath expression a context node can be configured according to the content of the contextNode attribute.

The contextNode attribute

Is used to indicate the XPath context node for evaluation of the XPath expression that can be indicated in the expression attribute. Possible values of this attribute are:

  • Instance; The context node will be set to the instance document.
  • Fact; The context node will be set to the current Fact.
  • This; The context node will be set to the node on the template.

The dateStep attribute

Is used to indicate the period length for column widths. The value is one of the following constants:

  • Years
  • Semesters
  • Quarters
  • Months
  • Weeks
  • Days
  • Hours
  • Minutes
  • Seconds

The depth attribute

Is used during the execution of Link iterators in order to set a maximum depth limit while traversing a hierarchy

The skipEmptyLines attribute

Is used on Link and Children iterators in order to avoid representation of lines that contains no fact items in the instance document. The attribute is optional, the default value is false. The possible values for this attribute are true or false.

The linkType attribute

This attribute is used for Link iterators. The value is a QName representing the container element for relationships. Possible values are, for example: link:presentationLink, link:calculationLink, link:genericLink, or a QName of your own custom extended link type.

The startingNode attribute

This attribute is used on Link iterators in order to define the node from which the navigation will start. All previous nodes in the hierarchy will be ignored.

The dimensionFilterScenario attribute

This attribute is used on DimMembers iterators in order to set the dimension name whose members will be iterated if the dimension is found in the scenario container.

The dimensionFilterSegment attribute

This attribute is used on DimMembers iterators in order to set the dimension name whose members will be iterated if the dimension is found in the segment container.

The XBRLIf element

The XBRLEval element