XBRL Variables Specification 1.0
Public Working Draft, dated 2007-07-13
Copyright © 2006-7, XBRL International Inc., All Rights Reserved
This version:
Variables-PWD-2007-07-13.rtf
is NORMATIVE. All other versions and formats are non-normative.
Editors
Name	Contact	Affiliation	
Phillip Engel	phillip.engel@morganstanley.com 	Morgan Stanley	
Geoff Shuetrim	geoff@galexy.net	Galexy	
David vun Kannon	david.k.vunkannon@us.pwc.com 	PricewaterhouseCoopers LLP	
Hugh Wallis	hughwallis@xbrl.org	XBRL International	
Contributors
			
Abstract
This specification is an optional modular extension of the XBRL 2.1 Specification [XBRL]. It defines syntax for declaration of two kinds of XBRL variables, ones that only evaluate to sequences of facts in an XBRL instance and ones that can evaluate to yield a broader range of values.
XBRL variables play an important role in extracting information from an XBRL instance or an XBRL Discoverable Taxonomy Set (DTS).  They can also be used to define constants and to define transformations of other variables.
Every XBRL variable implies an XPath expression.  This XPath expression is evaluated in the context of a single XBRL instance.
Status
This is a Public Working Draft whose circulation is unrestricted. Comments should be directed to the editor and/or contributors by e-mail.  Recipients of this draft are invited to submit, with their comments, notification of any relevant patent rights of which they are aware and to provide supporting documentation.
In the final version of this document:
•	relevant schema extracts will be included in the text of the specification
•	relevant examples will be included
•	error codes will be included.
To reduce the editorial burden, these aspects of the specification have been omitted for some working drafts.
Normative status
This document is normative in the sense that any implementing processor must obey the rules described within it, in order to be considered a conformant processor.
Table of contents
1.1	Document conventions (non-normative)
1.1.1	Typographic conventions
1.1.2	Formatting conventions
1.1.3	Namespace conventions (normative)
1.2	Relationship to other work
1.3	Language independence
1.4	Terminology
1.5	XPath usage
2	Introduction
3	Syntax
3.1	Fact variables
3.1.1	The XPath expression implied by a fact variable
3.1.2	Filters for fact variables
3.1.3	Evaluation of fact variables
3.2	General variables
3.2.1	The XPath expression implied by a general variable
3.2.2	Evaluation of general variables
Appendices
A	References (non-normative)
B	Normative schema
C	Intellectual Property Status (non-normative)
D	Acknowledgements (non-normative)
E	Document History (non-normative)
F	Approval process (non-normative)

1.1	Document conventions (non-normative)
1.1.1	Typographic conventions
Comments which are informative, but not essential to the understanding of the point at hand are provided in footnotes. All footnotes are non-normative.
1.1.2	Formatting conventions
The following highlighting is used to present normative technical material in this document:
	
The following formatting is used for non-normative examples in this document:

The following formatting is used for non-normative counterexamples (examples of poor, discouraged or disallowed usage) in this document:

1.1.3	Namespace conventions (normative)
This table contains all the prefixes used within the text and the correspondent namespace URI. The prefix column in the table above is non normative. The namespace URI column is normative.
Prefix	Namespace URI	
xbrli	http://www.xbrl.org/2003/instance	
xl	http://www.xbrl.org/2003/XLink	
generic	http://xbrl.org/2007/generic	
variable	http://xbrl.org/2007/variable	
1.2	Relationship to other work
This specification depends upon XBRL 2.1 Specification Recommendation [XBRL].
In the event of any conflicts between this document and the XBRL 2.1 Specification, the XBRL 2.1 Specification prevails.
1.3	Language independence
The official language of XBRL International’s own work products is English and the preferred spelling convention is UK English.
1.4	Terminology
All terminology defined in the XBRL 2.1 Specification [XBRL] is used unchanged in this specification.
The following additional terms are used as described in the table below:
Term	Meaning (Normative)	
effective Boolean value	Effective Boolean value is defined in section 2.4.3 of the XPath 2.0 specification [XPATH].	
fact variable	A variable that only evaluates to a sequence of facts.	
filter	A test of the facts in a target instance.	
target fact	The target fact is the fact in the target instance that is being tested for binding to a variable.	
target instance	The target instance is the XBRL instance containing data that variables MAY evaluate to.	
general variable	A variable that can evaluate to any valid XPath sequence.	
variable	A general or fact variable.	
variable’s filter	A filter that is associated with a variable by a variable-filter relationship	
variable-filter relationship	A relationship from a variable to a filter, expressed by an XLink arc.	
XBRL extended link	An XBRL extended link is an XLink extended link that MAY be a part of an XBRL 2.1 DTS.	
XPath expression	Wherever an XPath expression is mentioned in this specification it refers to an XPath 2.0 expression.	

1.5	XPath usage
XPath usage is identical to that in the Formula 1.0 Specification [FORMULA].
2	Introduction
This specification is an extension of the XBRL 2.1 Specification [XBRL]. It defines syntax for declaration of two kinds of XBRL variables, ones that only evaluate to sequences of facts in an XBRL instance and ones that can evaluate to yield a broader range of values.
XBRL variables play an important role in extracting information from an XBRL instance or an XBRL Discoverable Taxonomy Set (DTS).  They can also be used to define constants and to define transformations of other variables.
Every XBRL variable implies an XPath expression.  This XPath expression is evaluated in the context of a single XBRL instance.
3	Syntax
This specification only provides a textual declaration of syntax constraints when those constraints are not expressed by the normative schema supplied with this specification.
Explanations of elements and attributes are only supplied when those explanations are not already provided in other specifications.
Syntax is defined for two types of variables: fact variables, which evaluate to sequences of facts in an XBRL instance; and general variables that are less constrained.  Both types of variables imply XPath expressions.  The XPath expressions for all variables, regardless of their type, MUST be evaluated using the xbrli:xbrl element of the target instance as the context node.
3.1	Fact variables
A fact variable is declared by a variable:factVariable element in an XBRL extended link.  Such an element is referred to as a fact variable.
The XPath expression implied by a fact variable depends on its filters.
3.1.1	The XPath expression implied by a fact variable
The XPath expression implied by a fact variable begins with:
xfi:facts-in-instance()
This term is followed by zero or more XPath expressions, each in square brackets. There is one XPath expression in square brackets for each of the fact variable's filters. The XPath expression in the square brackets for each filter is the XPath expression implied by that filter.
3.1.2	Filters for fact variables
A filter defines a selection criteria for facts in a target instance.  A fact in the target instance, that is being filtered, is referred to as a target fact.  A fact variable MUST evaluate only to those facts in the target instance that meet the selection criteria set out by all of the filters that are associated with that fact variable.
Two types of filters are defined for fact variables: explicit filters, and implicit filters.  Each filter implies its own XPath expression.  Section 3.1.2.1 defines explicit filters and section 3.1.2.2 defines implicit filters.
3.1.2.1	Explicit filters
Explicit filters express criteria that can be applied to facts in an XBRL instance.  Such criteria can be incorporated into the XPath expressions implied by variables.
Explicit filters are declared as XLink resources in XLink extended links.  Explicit filters MUST be in the substitution group for the xl:resource element.
Explicit filters MUST imply an XPath expression that can be evaluated using any fact as a context node.
Every explicit filter specification MUST include rules for constructing the XPath expression implied by that explicit filter.
Every explicit filter specification MUST define the aspect, if any, of the fact that it conditions on.  An aspect that is conditioned upon by an explicit filter is referred to as an aspect that is covered by the explicit filter.  This association between explicit filters and the aspects that they cover impacts upon the process for inferring the implicit filters to apply when evaluating a fact variable. See section 3.1.2.6 for details.
A fact does not meet the criteria specified by an explicit filter if the result of evaluating the XPath expression implied by that explicit filter is an XPath effective Boolean value of false.
The XPath expression implied by an explicit filter MAY include XPath variables.  Resolution of such XPath variables is beyond the scope of this specification.
3.1.2.1.1	variable-filter relationships
The explicit filters that define criteria to be included in the XPath expression implied by a fact variable are related to that fact variable by XLink arcs [XLink].  To declare that a fact variable has a particular explicit filter, a relationship between the fact variable and the explicit filter MUST be declared by an XLink arc element.  That XLink arc element MUST:
•	have an arcrole equal to http://xbrl.org/arcrole/2007/variable-filter;
•	have the fact variable at the source of the arc; and
•	have the filter at the target of the arc.
Such relationships are referred to as variable-filter relationships.
3.1.2.2	Implicit filters
An implicit filter only differs from an explicit filter in that it does not need to be explicitly declared to be part of a fact variable.  Thus, implicit filters also imply XPath expressions that MAY be used to test facts in an XBRL instance for conformance with their filtration conditions.
A fact variable MAY have an implicit filter for each of the following aspects of XBRL facts:
●	the concept;
●	the period;
●	the entity identifier (covering both the scheme and the value);
●	the segment (excluding content defined in the XBRL Dimensions Specification [XDT]);
●	the scenario (excluding content defined in the XBRL Dimensions Specification [XDT]);
●	the unit (for numeric facts); and
●	the location of the fact in the XBRL instance.
These aspects are referred to as coverable aspects.  An implicit filter is defined for each coverable aspect.
A fact variable MAY also have an implicit filter for any explicit or typed dimension as defined in the XBRL Dimension Specification [XDT].  Thus, any explicit or typed dimension corresponds to a coverable aspect also.
An implicit filter for a coverable aspect implies an XPath expression that tests whether that aspect, for the fact being filtered (referred to as the context fact), is equivalent to the same cover aspect for some other fact, referred to as the comparison fact.
The comparison fact is always the value of another fact variable that has been previously evaluated.  The fact variable that has evaluated to the comparison fact is referred to as the comparison fact variable.  In the definitions of the implied XPath expression for each implicit filter, the reference to the comparison fact variable will need to be substituted for the term #comparison.
The implicit filters that are to be used when evaluating a fact variable depend on the circumstances of that evaluation.  Those circumstances and their influence on implicit filtering are defined in section 3.1.2.6.
3.1.2.3	The implicit concept filter
The implicit concept filter tests whether the context fact has a concept that is identical to that of the comparison fact.
The XPath expression implied by an implicit concept filter is obtained from:
	(namespace-uri(.) = namespace-uri(#comparison)) and
	local-name(.) = local-name(#comparison)
3.1.2.4	The implicit period filter
The implicit period filter tests whether the context fact has a period that is equal to that of the comparison fact.
The XPath expression implied by an implicit period filter is obtained from:
	xfi:s-equal(xfi:period(.), xfi:period(#comparison))
3.1.2.5	The implicit entity identifier filter
The implicit entity identifier filter tests whether the context fact has an entity identifier that is equal to that of the comparison fact.
The XPath expression implied by an implicit entity identifier filter is obtained from:
	(xfi:identifier-scheme(.) = xfi:identifier-scheme(#comparison)) 
and (xfi:identifier-value(.) = xfi:identifier-value(#comparison))
3.1.2.6	Implicit dimension filters
An implicit dimension filter tests whether the context fact has a dimension that is equal to that of the comparison fact.
The XPath expression implied by an implicit dimension filter depends on whether the fact being filtered has a concept with has-hypercube relationships for the context segment, as defined in the XBRL Dimensions Specification [XDT].
xfi:s-equal2(
xfi:segment-dimension(.,#dimension),
xfi:segment-dimension(#comparison,#dimension)
)
where #dimension is to be replaced by the QName of the dimension being filtered.
The function xfi:dimension(fact,dimensionQName) takes a fact as the first parameter and the QName identifying the dimension as the second attribute.  It returns the element that reports the dimension value for the fact if that dimension is reported for the fact either explicitly or as a default dimension value.  It returns an empty sequence if the fact does not have a value for the specified dimension.
The function xfi:s-equal2(firstDimension, secondDimension) returns true if the dimension value supplied as the first parameter is equal to the dimension value supplied as the second parameter, using the notion of s-equal2 equality as defined in the XBRL Dimensions Specification [XDT].  The function returns false if either of the two parameters is an empty sequence.
3.1.2.7	The implicit segment filter
The implicit segment filter tests whether the context fact has segment content, other than content defined in the XBRL Dimensions Specification [XDT]m that matches that of the comparison fact.
The XPath expression implied by an implicit segment filter is obtained from:
xfi:s-equal-set(
xfi:segment-remainder(.),xfi:segment-remainder(#comparison)
)
The function xfi:segment-remainder(fact) returns the sequence of child elements of the segment of the fact supplied as the function argument, omitting any child elements that are dimension values as defined in the XBRL Dimensions Specification [XDT].
3.1.2.8	The implicit scenario filter
The implicit scenario filter tests whether the context fact has scenario content, other than content defined in the XBRL Dimensions Specification [XDT] that matches that of the comparison fact.
The XPath expression implied by an implicit scenario filter is obtained from:
xfi:s-equal-set(
xfi:scenario-remainder(.),xfi:scenario-remainder(#comparison)
)
The function xfi:scenario-remainder(fact) returns the sequence of child elements of the scenario of the fact supplied as the function argument, omitting any child elements that are dimension values as defined in the XBRL Dimensions Specification [XDT].
3.1.2.9	The implicit unit filter
The implicit unit filter tests whether the context fact has a unit that is equal to that of the comparison fact.
The XPath expression implied by an implicit unit filter is obtained from:
	xfi:u-equal(.,#comparison)
3.1.2.10	The implicit location filter
The implicit location filter tests whether the context fact is a sibling element of the comparison fact.
The XPath expression implied by an implicit location filter is obtained from:
	.. is #comparison/..
3.1.3	Evaluation of fact variables
A fact variable MAY be evaluated against a target XBRL instance.  Such operations are referred to as fact variable evaluations.
The result of a fact variable evaluation depends on the value of the associated bindAsSequence attribute.  If the bindAsSequence attribute has a value of true, then evaluation of the fact variable results in a sequence of facts from the target XBRL instance, each of which meets the conditions defined by all of the fact variable's explicit and implicit filters.  Otherwise, the fact variable evaluation results in any one of the facts from the target XBRL instance that meets the conditions defined by all of the fact variable's explicit and implicit filters.
The set of facts that meet the conditions defined by all of the fact variable's explicit and implicit filters are obtainable by evaluation of the XPath expression implied by the fact variable given the circumstances of its evaluation.  The circumstances of its evaluation determine the implicit filters that are to be used.
The evaluation circumstances for a fact variable are fully described by the evaluation circumstances of the comparison fact variable. The comparison fact variable MUST have been previously evaluated.  Its value will be the comparison fact that implicit filters will be matching against in the current fact variable evaluation.
If there is no comparison fact variable, then no implicit filters are applied in the evaluation of the fact variable.
If there is a comparison fact variable then an implicit filter MUST be applied for each coverable aspect except those where:
•	the comparison fact variable has an explicit filter for that aspect; or
•	the fact variable being evaluated has an explicit filter for that aspect.
3.2	General variables
A general variable is declared by a variable:generalVariable element in an XBRL extended link.  Such elements are referred to as general variables.
3.2.1	The XPath expression implied by a general variable
The XPath expression implied by a general variable is the content of the select attribute on the general variable.  The context node for evaluation of the XPath expression is the xbrli:xbrl element of the XBRL instance being processed.
3.2.2	Evaluation of general variables
A general variable MAY be evaluated against a target XBRL instance.  Such operations are referred to as general variable evaluations.
The result of a general variable evaluation depends on the value of the associated bindAsSequence attribute.  If the bindAsSequence attribute has a value of true, then the general variable evaluation results in a sequence.  Otherwise, the general variable evaluation results in any one of the members of the sequence.

Appendices
A	References (non-normative)

[FORMULA]	Phillip Engel, Geoff Shuetrim, David vun Kannon, Hugh Wallis (editors)
XBRL Formula Specification 1.0 Public Working Draft
http://www.xbrl.org/SpecPWDs/ 	
[XDT]	Ignacio Hernández-Ros, Hugh Wallis
XBRL Dimensions 1.0 Recommendation
http://www.xbrl.org/Specification/XBRL-RECOMMENDATION-2003-12-31+Corrected-Errata-2006-12-18.rtf 
	
[GENLINK]	Mark Goodhand, Ignacio Hernández-Ros, Geoff Shuetrim (editors)
XBRL Generic Links 1.0, Public Working Draft
http://www.xbrl.org/SpecPWDs/	
[XPATH]	Anders Berglund, Scott Boag, Don Chamberlin, Mary F. Fernández, Michael Kay, Johnathan Robie, Jérôme Siméon
XML Path Language (XPath) 2.0
http://www.w3.org/TR/xpath20/ 
	
[XBRL]	Phillip Engel, Walter Hamscher, Geoff Shuetrim, David vun Kannon and Hugh Wallis
Extensible Business Reporting Language 2.1 Recommendation 
http://www.xbrl.org/SpecRecommendations/ 
	
[XLink]	Steve DeRose, Eve Maler, and David Orchard
XML Linking Language (XLink) Version 1.0
http://www.w3.org/TR/xlink
	
B	Normative schema
The following is the XML schema provided as part of this specification. This is normative. Non-normative versions (which should be identical to these except for appropriate comments indicating their non-normative status) are also provided as separate files for convenience of users of the specification.
NOTE: (non-normative) Following the schema maintenance policy of XBRL International, it is the intent (but is not guaranteed) that the location of non-normative versions of these schemas on the web will be as follows:
1)	While any schema is the most current RECOMMENDED version and until it is superseded by any additional errata corrections a non-normative version will reside on the web in the directory http://www.xbrl.org/2007/ - during the drafting process for this specification this directory should contain a copy of the most recent published version of the schema at http://www.xbrl.org/2007/variable.xsd.
2)	A non-normative version of each schema as corrected by any update to the RECOMMENDATION will be archived in perpetuity on the web in a directory that will contain a unique identification indicating the date of the update. 

<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2007 XBRL International. All Rights Reserved. -->
<schema 
  xmlns="http://www.w3.org/2001/XMLSchema" 
  targetNamespace="http://xbrl.org/2007/variable" 
  xmlns:variable="http://xbrl.org/2007/variable" 
  xmlns:expression="http://xbrl.org/2007/expression" 
  xmlns:generic="http://xbrl.org/2007/generic" 
  xmlns:link="http://www.xbrl.org/2003/linkbase" 
  xmlns:xl="http://www.xbrl.org/2003/XLink"
  elementFormDefault="qualified"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="
  http://www.w3.org/2001/XMLSchema http://www.w3.org/2001/XMLSchema.xsd
  http://www.xbrl.org/2003/linkbase http://www.xbrl.org/2003/xbrl-linkbase-2003-12-31.xsd
  ">

  <import namespace="http://www.xbrl.org/2003/XLink" 
    schemaLocation="http://www.xbrl.org/2003/xl-2003-12-31.xsd"/>

  <import namespace="http://xbrl.org/2007/expression" 
    schemaLocation="expression.xsd"/>

  <element name="generalVariable" substitutionGroup="xl:resource">
    <complexType mixed="true">
      <complexContent mixed="true">
        <extension base="xl:resourceType">
          <attribute name="select" type="expression:expression" 
          use="required" />
          <anyAttribute namespace="http://www.w3.org/XML/1998/namespace" 
          processContents="lax"/>
        </extension>
      </complexContent>
    </complexType>
  </element>

  <element name="factVariable" substitutionGroup="xl:resource">
    <complexType mixed="true">
      <complexContent mixed="true">
        <extension base="xl:resourceType">
          <anyAttribute namespace="http://www.w3.org/XML/1998/namespace" 
          processContents="lax"/>
        </extension>
      </complexContent>
    </complexType>
  </element>

</schema>	
C	Intellectual Property Status (non-normative)
This document and translations of it may be copied and furnished to others, and derivative works that comment on or otherwise explain it or assist in its implementation may be prepared, copied, published and distributed, in whole or in part, without restriction of any kind, provided that the above copyright notice and this paragraph are included on all such copies and derivative works. However, this document itself may not be modified in any way, such as by removing the copyright notice or references to XBRL International or XBRL organizations, except as required to translate it into languages other than English. Members of XBRL International agree to grant certain licenses under the XBRL International Intellectual Property Policy (www.xbrl.org/legal).
This document and the information contained herein is provided on an "AS IS" basis and XBRL INTERNATIONAL DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
The attention of users of this document is directed to the possibility that compliance with or adoption of XBRL International specifications may require use of an invention covered by patent rights. XBRL International shall not be responsible for identifying patents for which a license may be required by any XBRL International specification, or for conducting legal inquiries into the legal validity or scope of those patents that are brought to its attention. XBRL International specifications are prospective and advisory only. Prospective users are responsible for protecting themselves against liability for infringement of patents. XBRL International takes no position regarding the validity or scope of any intellectual property or other rights that might be claimed to pertain to the implementation or use of the technology described in this document or the extent to which any license under such rights might or might not be available; neither does it represent that it has made any effort to identify any such rights. Members of XBRL International agree to grant certain licenses under the XBRL International Intellectual Property Policy (www.xbrl.org/legal).
D	Acknowledgements (non-normative)
This document could not have been written without the contributions of many people including the participants in the XBRL Formula Working Group.
E	Document History (non-normative)
Date	Editor	Summary	
2006-12-18	Geoff Shuetrim	First internal working draft created, drawing extensively on the previous Formula specification drafts.	
2007-04-23	Geoff Shuetrim	Added identification of the context node for evaluation of the XPath expression implied by general variables based on the feedback from Fujitsu.
Made the section on the XPath expression implied by a fact variable a sub-section of the section on fact variables.	
2007-04-24	Geoff Shuetrim	Introduced the sections on implicit filtering and distinguished the explicit filtering.  Added the section on the evaluation of fact variables to specify how implicit filters are to be introduced into the evaluation of fact variables.	
2007-04-25	Geoff Shuetrim	Added a date to the arcrole defined in the specification.	
2007-05-03	Geoff Shuetrim	Changed the implicit filtering treatment for facts that have concepts with relationships to dimension hyper-cubes as defined in the XBRL Dimensions 1.0 Recommendation [XDT].  The implicit filter now involves a component for the XDT dimensions and a component for everything else.	
2007-05-07	Geoff Shuetrim	Removed the requirement that relationships be defined in terms of the concrete arcs that express them.	
2007-05-08	Geoff Shuetrim	Added the implicit concept filter.	
2007-05-29	Geoff Shuetrim	Changed the name of the implicit sibling filter to the implicit location filter.  Refined the algorithm for determining when implicit filters are required.	
2007-06-13	Geoff Shuetrim	Simplified the algorithm for inferring the need for implicit filters.  Allowed general variables to bind as sequences or individually, analogously to fact variables, based on suggestions and motivating examples provided by Herm Fischer.	
2007-06-25	Geoff Shuetrim	Introduced implicit dimension filters and redefined the notion of coverable aspects. Refined the implicit segment and scenario filters to only deal with the content of segments and scenarios that are not reporting values for XDT dimensions.	
2007-07-24	Hugh Wallis	Editorial for publication	
F	Approval process (non-normative)
This section will be removed from the final recommendation.
This specification is being developed following the XBRL Technical Working Group Processes: http://www.xbrl.org/XSB/XBRL_Technical_Working_Group_Processes-Approved-2007-04-17.htm