Module Expr Str ImportFrom alias alias ImportFrom alias alias ImportFrom alias alias ImportFrom alias alias alias ImportFrom alias ImportFrom alias Expr Str FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body If UnaryOpNot CompareLtELtE Num Call NameLoad NameLoad Num body Raise Call AttributeLoad NameLoad attr Assign NameStore Call NameLoad NameLoad NameLoad NameLoad Num Str keyword NameLoad Assign NameStore IfExp Call NameLoad SubscriptLoad NameLoad Index Num TupleLoad NameLoad NameLoad SubscriptLoad NameLoad Index Num TupleLoad SubscriptLoad NameLoad Index Num If NameLoad body If BoolOpOr BinOpBitAnd Call NameLoad NameLoad Num Call NameLoad GeneratorExp UnaryOpNot Call NameLoad SubscriptLoad NameLoad Index NameLoad TupleLoad NameLoad NameLoad comprehension NameStore Call NameLoad Num Call NameLoad NameLoad Num body Raise Call AttributeLoad NameLoad attr Num Str keyword Str orelse Assign NameStore ListComp TupleLoad SubscriptLoad NameLoad Index NameLoad SubscriptLoad NameLoad Index BinOpAdd NameLoad Num comprehension NameStore Call NameLoad Num Call NameLoad NameLoad Num orelse Assign NameStore NameLoad Assign NameStore Call NameLoad NameLoad NameLoad NameLoad Num Str keyword Str If UnaryOpNot NameLoad body Assign NameStore NameLoad If CompareLt Call NameLoad NameLoad Num body Assign NameStore NameLoad orelse Assign NameStore Call AttributeLoad NameLoad attr SubscriptLoad NameLoad Index Num Assign NameStore Str If CompareIn NameLoad AttributeLoad AttributeLoad NameLoad attr attr body Assign NameStore SubscriptLoad AttributeLoad AttributeLoad NameLoad attr attr Index NameLoad orelse ImportFrom alias Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad AttributeLoad NameLoad attr attr NameLoad keyword Str Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad keyword NameLoad keyword NameLoad If NameLoad body For NameStore NameLoad body If Call NameLoad NameLoad AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad Return NameLoad decorator_list FunctionDef arguments args defaults body Return Dict Call NameLoad Str NameLoad decorator_list Assign NameStore Dict Str Str Str Str Str Str Str Str Str Str Str Str Str NameLoad
N/A N/A 
Sample custom functions plugin for formula XML Element, Attribute creation functions

>>> note that this function has been renamed xfi:create-element and moved to FunctionXfi.py <<<

(c) Copyright 2012 Mark V Systems Limited, All rights reserved.
 arelle XPathContext XbrlUtil arelle.ModelValue qname QName arelle.ModelInstanceObject ModelDimensionValue XmlUtil arelle.FunctionUtil qnameArg nodeArg atomicArg arelle XmlValidate lxml etree N/A 
Create an XML element in a "scratchpad" in-memory XML document, to behave like the results
of an fn:doc() that would provide XML elements which can be consumed by formula typed
dimension and OCC constructs.

The element may be created with attributes and descendant elements, as needed.

xfxc:element(
    qname,  // qname of element
    (name-value pairs for creating attributes if any),
    value, if any, otherwise () or ''
    optional nested elements (e.g., xfc:element( ) ... of child nodes)
    )
    
Attributes may be pairs of string name, value, or pairs of QName, value when attribute
name is qualified.

A function definition is required in the formula linkbase:
<variable:function name="xfxc:element" output="element()" xlink:type="resource" xlink:label="cust-fn-xfxc-create">
  <variable:input type="xs:QName" />  <!-- qname of element to create -->
  <variable:input type="xs:anyAtomicType*" /> <!-- sequence of name, value pairs for creating attributes (name can be string or QName) -->
  <variable:input type="xs:anyAtomicType" /> <!-- optional value, () or '' if none -->
  <variable:input type="element()*" /> <!-- optional sequence of child elements, this parameter can be omitted if no child elements -->
</variable:function>
 xfxc_element N/A N/A xc p contextItem args N/A N/A N/A N/A N/A 2 N/A len args 4 N/A N/A N/A N/A XPathContext FunctionNumArgs N/A qn N/A qnameArg xc p args 0 QName emptyFallback None N/A attrArg N/A N/A isinstance N/A args N/A 1 N/A list tuple N/A args N/A 1 N/A N/A args N/A 1 N/A attrArg N/A N/A N/A N/A N/A len attrArg 1 N/A any N/A N/A N/A isinstance N/A attrArg N/A i N/A QName _STR_BASE N/A i N/A range 0 N/A len attrArg 2 N/A N/A N/A N/A XPathContext FunctionArgType 1 ((xs:qname|xs:string),xs:anyAtomicValue) errCode xfxce:AttributesNotNameValuePairs N/A N/A attrParam N/A N/A N/A attrArg N/A i N/A attrArg N/A N/A i 1 N/A i N/A range 0 N/A len attrArg 2 N/A N/A attrParam None N/A value N/A atomicArg xc p args 2 xs:anyAtomicType emptyFallback N/A N/A value N/A N/A value None N/A N/A N/A len args 4 N/A N/A childElements None N/A N/A childElements N/A N/A xc flattenSequence N/A args N/A 3 N/A scratchpadXmlDocUrl http://www.xbrl.org/2012/function/creation/xml_scratchpad.xml N/A N/A scratchpadXmlDocUrl N/A N/A xc modelXbrl urlDocs N/A N/A modelDocument N/A N/A N/A xc modelXbrl urlDocs N/A scratchpadXmlDocUrl N/A arelle ModelDocument N/A modelDocument N/A N/A ModelDocument create N/A xc modelXbrl N/A N/A ModelDocument Type UnknownXML scratchpadXmlDocUrl initialXml <xfc:dummy xmlns:xfc='http://www.xbrl.org/2012/function/creation'/> N/A newElement N/A N/A XmlUtil addChild N/A modelDocument xmlRootElement qn attributes attrParam text value N/A childElements N/A N/A element childElements N/A N/A N/A isinstance element N/A etree ElementBase N/A N/A N/A N/A newElement append element N/A N/A N/A XmlValidate validate N/A xc modelXbrl newElement N/A newElement N/A xfxcFunctions N/A N/A N/A N/A N/A N/A N/A qname {http://www.xbrl.org/2012/function/xml-creation}xfxc:element xfxc_element N/A N/A __pluginInfo__ N/A name version description license author copyright Formula.CustomFunctions Formula Xml Creation Functions 1.0 This plug-in adds a custom function to create xml elements, such as for typed dimensions, implemented by a plug-in.   Apache-2 Mark V Systems Limited (c) Copyright 2012 Mark V Systems Limited, All rights reserved. xfxcFunctions