The Cadena de Origen (origin string) is a pipe-delimited text string that the SAT derives from a CFDI’s key fields using an XSLT transformation. It is the exact data over which the digital sello (seal) is computed: you hash the Cadena de Origen with SHA-256, encrypt the hash with your private key, and Base64-encode the result to produce theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/eclipxe13/CfdiUtils/llms.txt
Use this file to discover all available pages before exploring further.
Sello attribute.
Because the Cadena de Origen is generated by a deterministic transformation of specific CFDI attributes (not all of them), non-structural modifications — adding an addenda, reformatting whitespace, removing unused namespace declarations — do not invalidate the signature. This intentional design means a CFDI can be “repaired” without re-signing as long as no signed field is changed.
The SAT’s method for generating the Cadena de Origen uses XSLT (Extensible Stylesheet Language Transformations). The SAT publishes XSLT files for each version of CFDI and for each complement. CfdiUtils provides pluggable XSLT processors through XsltBuilderInterface.
XsltBuilderInterface
All XSLT processors implement the single-method interfaceCfdiUtils\CadenaOrigen\XsltBuilderInterface:
The full XML content of the document to transform (the CFDI or complement XML string).
The absolute local path or remote URL of the XSLT file to apply. Use
XmlResolver::resolveCadenaOrigenLocation() to obtain the correct local path.string.
Available Implementations
| Implementation | Class | Requirement | XSLT version | Notes |
|---|---|---|---|---|
DOMBuilder | CfdiUtils\CadenaOrigen\DOMBuilder | PHP ext-xsl (built-in) | 1.0 (processes SAT v2 files) | Default; no extra packages required |
GenkgoXslBuilder | CfdiUtils\CadenaOrigen\GenkgoXslBuilder | composer require genkgo/xsl | 2.0 (native) | Pure-PHP XSLT 2.0 implementation |
SaxonbCliBuilder | CfdiUtils\CadenaOrigen\SaxonbCliBuilder | apt-get install libsaxonb-java | 2.0 (native) | Executes Saxon-B as a shell command |
DOMBuilder
DOMBuilder is the default implementation. It uses PHP’s built-in DOMDocument and XSLTProcessor classes (provided by the ext-xsl extension) — no additional Composer packages are required.
PHP’s XSLTProcessor implements XSLT 1.0. The SAT’s XSLT files are written for XSLT 2.0, but in practice the features they use are backward-compatible and DOMBuilder produces the correct Cadena de Origen. All three implementations have been verified to produce identical output in CfdiUtils’ test suite.
If you are not sure which implementation to choose, start with
DOMBuilder. It is the default used by CfdiCreator40, CfdiCreator33, and the TFD helper, and it requires no extra dependencies beyond a standard PHP installation with ext-xsl.GenkgoXslBuilder
GenkgoXslBuilder delegates to the genkgo/xsl library, a pure-PHP XSLT 2.0 processor. Use it if you need native XSLT 2.0 support (for example, if the SAT updates its XSLT files to use XSLT 2.0-only constructs).
Install the dependency:
SaxonbCliBuilder
SaxonbCliBuilder invokes the Saxon-B XSLT Processor as an external command-line process. Saxon-B is a Java-based, fully compliant XSLT 2.0 processor.
Install Saxon-B on Debian/Ubuntu:
Using Cadena de Origen with CfdiCreator
When you build a CFDI withCfdiCreator40 or CfdiCreator33, the Cadena de Origen is generated automatically when you call addSello(). You can also generate it manually:
Cadena de Origen for Timbre Fiscal Digital
The Cadena de Origen of the Timbre Fiscal Digital (TFD) is required for the printed representation (PDF) of a CFDI. Use the dedicatedTfdCadenaDeOrigen helper:
TfdCadenaDeOrigen supports TFD versions 1.0 and 1.1. Passing any other version throws an exception.
PHP and XSLT 2.0
PHP’s built-inXSLTProcessor implements XSLT 1.0. The SAT currently writes its XSLT files in XSLT 2.0 syntax, but the features in use happen to be backward-compatible with 1.0 processors. All three implementations (DOMBuilder, GenkgoXslBuilder, SaxonbCliBuilder) produce identical Cadena de Origen strings in CfdiUtils’ test suite.
If the SAT were to start using XSLT 2.0-exclusive constructs, DOMBuilder could silently produce incorrect output. In that case, switch to GenkgoXslBuilder or SaxonbCliBuilder for fully standards-compliant XSLT 2.0 processing.