XhBtRmL HTML Templates

From XBRLWiki
Jump to: navigation, search

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>

All available variables

This is the list of all available variables and a short description for each one of them. The rest of the documentation will indicate when the variable values will be updated:

  • XBRL_Node; this represents an XML node, updated every cycle over an iterator of type Select. The variable $XBRL_Node can be used in further XPath expressions and the value will be the XML node in the sequence of nodes.
  • XBRL_CurrentDateStep; this is the value of the particular column updated during every cycle of the iterator of type Dates and during every cycle of the iterator of type Facts. Example values are 2009 if the value of the dateStep attribute is "Years".
  • XBRL_TreeRootNode; This variable holds the label of the root node in a Link iterator.
  • XBRL_TreeParentNode; This variable holds the label of the parent node in a Link iterator and is updated during a Children iterator.
  • XBRL_TreeCurrentNode; This variable holds the label of the current node in a Link iterator and is updated during a Children iterator.
  • XBRL_DepthLevel; This variable holds a numeric value indicating the number of ancestors in the hierarchy tree up to the root node. It is updated during the iteration of Children iterators.
  • XBRL_ChildNumber; This variable holds a numeric value indicating the child number of the XBRL_TreeCurentNode in the total number of children elements having the same XBRL_TreeParentNode. It is updated during the Children iterator.
  • XBRL_FactValue; This variable holds the converted fact value that can be represented in the template. It is updated every iteration on the Facts cycle.
  • XBRL_TreeCurrentDimNode; This variable is updated with the XBRL label of the dimension member of the current member during a DimMember iterator.
  • XBRL_NoteNumber; This variable holds a number indicating the number of the footnote. It is updated every cycle of the Facts iterator.
  • XBRL_NoteContent; This variable holds the text of the footnote. It is updated every cycle of the Footnotes iterator.
  • XBRL_HasNext; This is a boolean variable updated on every step in an iterator cycle. The value is true() if there is another value in the sequence after the current value.
  • XBRL_TreeCurrentNode_IsAbstract; This is a boolean value that indicated if the concept definition indicated in XBRL_TreeCurrentNode is abstract or not.
  • XBRL_HasDimensions; This is a boolean value that indicates if the concept definition indicated in XBRL_TreeCurrentNode is a dimensional concept definition or not.
  • XBRL_FactQName; This variable holds the QName of the current fact value. It is updated for every iteration of the Facts iterator.
  • XBRL_NumberOfYears; This variable holds the number of year columns in the report. It is updated once per report.
  • XBRL_NumberOfHalves; This variable holds the number of semester columns in the report. It is updated once per report.
  • XBRL_NumberOfQuarters; This variable holds the number of quarter columns in the report. It is updated once per report.
  • XBRL_NumberOfMonths; This variable holds the number of month columns in the report. It is updated once per report.
  • XBRL_NumberOfWeeks; This variable holds the number of week columns in the report. It is updated once per report.
  • XBRL_NumberOfDays; This variable holds the number of day columns in the report. It is updated once per report.
  • XBRL_NumberOfHours; This variable holds the number of hour columns in the report. It is updated once per report.
  • XBRL_NumberOfMinutes; This variable holds the number of minute columns in the report. It is updated once per report.
  • XBRL_NumberOfSeconds; This variable holds the number of second columns in the report. It is updated once per report.

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"> ... <td valign="middle">

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

</td> ... </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 may have a combination of the following attributes:

The template attribute

This attribute is always 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 from the sequence of nodes in the XPath expression. That variable name can be used in other XPath expressions or text nodes in nested templates and the value will be automatically substituted by the processor. Other variables updated XBRL_HasNext.
  • 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 cycle will update the value of the XBRL_CurrentDateStep variable so templates using that variable on XPath expressions or texts nodes can use the variable value for presentation purposes. Other variables updated XBRL_HasNext.
  • 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. This iterator is used to traverse trees in the presentation linkbase but can be used to traverse any tree on any linkbase type. The Link iterator updates the following variables: XBRL_TreeRootNode, XBRL_TreeParentNode, XBRL_TreeCurrentNode, XBRL_TreeCurrentNode_IsAbstract, XBRL_HasDimensions, XBRL_HasNext.
  • Children; Indicates that the iterator will iterate through the nodes that are children of the current node. This iterator can only exist inside a Link iterator. The Children iterator updates the following variables: XBRL_DepthLevel, XBRL_TreeParentNode, XBRL_TreeCurrentNode, XBRL_ChildNumber, XBRL_TreeCurrentNode_IsAbstract, XBRL_HasDimensions, XBRL_HasNext.
  • 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. A Facts iterator requires the existence of an XBRL_TreeCurrentNode so it can only exist inside a Children or a Link iterator. A Facts iterator updates the following variables: XBRL_CurrentDateStep, XBRL_FactValue, XBRL_NoteNumber, XBRL_FactQName, XBRL_HasNext.
  • DimMembers; Indicates that the iterator will iterate through dimension members of the current node. This iterator updates the variable called XBRL_TreeCurrentDimNode that contains the label of the dimension member.
  • Footnotes; Indicates that the iterator will iterate through footnotes in the report. Updates the variables XBRL_NoteNumber and XBRL_NoteContent.

The role attribute

Is used to indicate the link role where relationships will be taken on Link iterators. The value must be an URI that corresponds to the role of the extended link. Normally this is the role on the presentationLink element from which presentationArc elements will be used in order to represent the presentation hierarchy. The user can use different hierarchies as XhBtRmL is not limited to presentation trees.

The expression attribute

Is used to indicate an XPath expression that will be used in Select iterators and the evaluation of XBRLIf expressions or XBRLEval statement.

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 optional and can be 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 XBRLIf statement can be used to drive execution flow and select the content to be represented according to an evaluated criteria. The evaluated criteria is an XPath expression. The evaluation is subject to the existence of a contextNode attribute.

The following piece of code is part of a template that shows the fact value: <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>

 <td>$XBRL_FactValue<XBRLIf expression="$XBRL_NoteNumber > 0">
   <XBRLThen>
     
       $XBRL_NoteNumber
     
   </XBRLThen>
   </XBRLIf>
 </td>

</template> </syntaxhighlight>

The output of that template is something like 1.0001 in a table with 1 being the number of a footnote (the value of the XBRL_NoteNumber variable, and 1.000 being the value of the XBRL_FactValue variable.

XBRLIf statements must have an XPath expression in the expression attribute that evaluates to a boolean value. If the result is true() the execution continues including the content of the XBRLThen statement. If the result is false() then tha execution continues including the content of the XBRLElse statement or nothing if the XBRLElse statement is missing.

This example contains an XBRLElse statement: <syntaxhighlight lang="html4strict">

 <XBRLIf expression="$XBRL_HasDimensions">
   <XBRLThen>
     <tr>
       <td class="category">$XBRL_TreeCurrentNode</td>
       <td class="label" colspan="$XBRL_NumberOfYears"> </td>
     </tr>
     <XBRLTemplate template="google-fact-data-dim.xhtml" 
                 iterator="DimMembers" 
                 dimensionFilterScenario="tx:BasicDilutedDimension"
                 xmlns:tx="http ://www.reportingstandard.com/samples/transformerTaxonomy" />
   </XBRLThen>
   <XBRLElse>
     <tr>
       <td class="category">$XBRL_TreeCurrentNode</td>
       <XBRLTemplate template="google-fact-data.xhtml"
                 iterator="Facts"
                 dateStep="Years"/>
     </tr>
   </XBRLElse>
 </XBRLIf>

</syntaxhighlight>

The XBRLEval element

The XBRLEval statement can be used to evaluate a dynamically generated XPath expression. It can be used when the output of an XPath expression includes XBRL variable names that requires substitution by the processor.

Navigation

Main Page | XhBtRmL