--- title: xpath-cond - X4 schema type summary: xpath-cond: X4 attribute schema type: base types, constraints and value alternatives. section: reference kind: guide status: reference updated: 2026-10-27 tags: ["XSD","schema","types"] sources: ["https://wiki.egosoft.com/X4%20Foundations%20Wiki/Modding%20Support/","https://www.w3.org/TR/xmlschema11-2/"] --- ## Meaning xpath-cond: X4 attribute schema type: base types, constraints and value alternatives. An XSD type constrains XML, rather than declaring a Lua return or the payload type of event.param. A valid schema value does not prove a successful game effect. ## Schema structure `libraries/diff.xsd` | Property | Value | | --- | --- | | Construction | `restriction` | | Base type | [`xs:string`](wiki:schema-xs-string-d5652e9b) | | Constraint | Value | | --- | --- | | `pattern` | `((/\|//)?((id\(('\i\c*')?\)\|id\(("\i\c*")?\))(((/\|//)((\i\c*:)?\i\c*\|\*)(\[@(\i\c*:)?\i\c*='(.)*'\]\|\[@(\i\c*:)?\i\c*="(.)*"\]\|\[((\i\c*:)?\i\c*\|\.)='(.)*'\]\|\[((\i\c*:)?\i\c*\|\.)="(.)*"\]\|\[\d+\])*)*((/\|//)((text\(\)(\[\d+\])?)\|(comment\(\)(\[\d+\])?)\|((processing-instruction\(('\i\c*')?\)\|processing-instruction\(("\i\c*")\))(\[\d+\])?)\|(((\i\c*:)?\i\c*\|\*)(\[@(\i\c*:)?\i\c*='(.)*'\]\|\[@(\i\c*:)?\i\c*="(.)*"\]\|\[((\i\c*:)?\i\c*\|\.)='(.)*'\]\|\[((\i\c*:)?\i\c*\|\.)="(.)*"\]\|\[\d+\])*(\[(not\((\i\c*:)?\i\c*\)\|boolean\((\i\c*:)?\i\c*\)\|true\(\)\|false\(\)\|name\(\)\|root\(((\i\c*:)?\i\c*)?\)\|position\(\)\|last\(\))\])?))))?\|(((\i\c*:)?\i\c*\|\*)(\[@(\i\c*:)?\i\c*='(.)*'\]\|\[@(\i\c*:)?\i\c*="(.)*"\]\|\[((\i\c*:)?\i\c*\|\.)='(.)*'\]\|\[((\i\c*:)?\i\c*\|\.)="(.)*"\]\|\[\d+\])*(/\|//))*(((text\(\)(\[\d+\])?)\|(comment\(\)(\[\d+\])?)\|((processing-instruction\(('\i\c*')?\)\|processing-instruction\(("\i\c*")\))(\[\d+\])?)\|(((\i\c*:)?\i\c*\|\*)(\[@(\i\c*:)?\i\c*='(.)*'\]\|\[@(\i\c*:)?\i\c*="(.)*"\]\|\[((\i\c*:)?\i\c*\|\.)='(.)*'\]\|\[((\i\c*:)?\i\c*\|\.)="(.)*"\]\|\[\d+\])*(\[(not\((\i\c*:)?\i\c*\)\|boolean\((\i\c*:)?\i\c*\)\|true\(\)\|false\(\)\|name\(\)\|root\(((\i\c*:)?\i\c*)?\)\|position\(\)\|last\(\))\])?))))\|not\((/\|//)?((id\(('\i\c*')?\)\|id\(("\i\c*")?\))(((/\|//)((\i\c*:)?\i\c*\|\*)(\[@(\i\c*:)?\i\c*='(.)*'\]\|\[@(\i\c*:)?\i\c*="(.)*"\]\|\[((\i\c*:)?\i\c*\|\.)='(.)*'\]\|\[((\i\c*:)?\i\c*\|\.)="(.)*"\]\|\[\d+\])*)*((/\|//)((text\(\)(\[\d+\])?)\|(comment\(\)(\[\d+\])?)\|((processing-instruction\(('\i\c*')?\)\|processing-instruction\(("\i\c*")\))(\[\d+\])?)\|(((\i\c*:)?\i\c*\|\*)(\[@(\i\c*:)?\i\c*='(.)*'\]\|\[@(\i\c*:)?\i\c*="(.)*"\]\|\[((\i\c*:)?\i\c*\|\.)='(.)*'\]\|\[((\i\c*:)?\i\c*\|\.)="(.)*"\]\|\[\d+\])*(\[(not\((\i\c*:)?\i\c*\)\|boolean\((\i\c*:)?\i\c*\)\|true\(\)\|false\(\)\|name\(\)\|root\(((\i\c*:)?\i\c*)?\)\|position\(\)\|last\(\))\])?))))?\|(((\i\c*:)?\i\c*\|\*)(\[@(\i\c*:)?\i\c*='(.)*'\]\|\[@(\i\c*:)?\i\c*="(.)*"\]\|\[((\i\c*:)?\i\c*\|\.)='(.)*'\]\|\[((\i\c*:)?\i\c*\|\.)="(.)*"\]\|\[\d+\])*(/\|//))*(((text\(\)(\[\d+\])?)\|(comment\(\)(\[\d+\])?)\|((processing-instruction\(('\i\c*')?\)\|processing-instruction\(("\i\c*")\))(\[\d+\])?)\|(((\i\c*:)?\i\c*\|\*)(\[@(\i\c*:)?\i\c*='(.)*'\]\|\[@(\i\c*:)?\i\c*="(.)*"\]\|\[((\i\c*:)?\i\c*\|\.)='(.)*'\]\|\[((\i\c*:)?\i\c*\|\.)="(.)*"\]\|\[\d+\])*(\[(not\((\i\c*:)?\i\c*\)\|boolean\((\i\c*:)?\i\c*\)\|true\(\)\|false\(\)\|name\(\)\|root\(((\i\c*:)?\i\c*)?\)\|position\(\)\|last\(\))\])?))))\)\|(not\((\i\c*:)?\i\c*\)\|boolean\((\i\c*:)?\i\c*\)\|true\(\)\|false\(\)\|name\(\)\|root\(((\i\c*:)?\i\c*)?\)\|position\(\)\|last\(\)))` | restriction narrows a base type; union accepts one of its branches; list describes whitespace-separated items. Enumeration values in one restriction are alternatives. Pattern syntax is XML Schema regex, not Lua patterns or JavaScript RegExp. Constraints inherited from the base type still apply. ## Example and result Use the attribute pages below for contextual examples. A generic executable example is not inferred from a type name alone. ## Used by This type is referenced through other schema types. [All schema types](wiki:schema-types) ยท [Lua / MD value types](wiki:types)