PPTX Conversion Pitfall: Slide Order Comes from XML Index, Not Filenames

PPTX conversion must follow the sldIdLst index in presentation.xml, never filenames.
From a real debugging incident: a converter sorted PPTX to Markdown by filename (slide1.xml, slide2.xml), causing a pitch deck's appendix to appear before the main content. Filenames only reflect creation order, not presentation order. True order lives in presentation.xml's sldIdLst, which stores relationship IDs resolved via presentation.xml.rels. The author fixed the converter and distilled a principle: container formats are databases with their own order—trust indexes, not filenames.
Title
PPTX Conversion Pitfall: Slide Order Comes from XML Index, Not Filenames
Meta Description
Sorting by filename when converting PPTX to Markdown scrambles slide order. This article dissects the sldIdLst index mechanism in presentation.xml, explains why the truth about container format order isn't in the filenames, and offers a fix.
Article Content
When converting PPTX to Markdown, the most intuitive approach is to sort by filename: slide1.xml, slide2.xml, slide3.xml... A developer ran into a classic pitfall last week because of this—after converting a pitch deck, the appendix ended up before the main content.

The Filename Sorting Trap
The problem lies in the internal structure of the .pptx package. The slide files are indeed named slide1.xml, slide2.xml, but this numbering only reflects the order at file creation time—it has nothing to do with the presentation order the author ultimately achieved by dragging and dropping in PowerPoint.
One author's self-documented debugging log reads: "In one deck, after someone dragged the 'Thank you' page to the front and then back to the end, slide7.xml became the first page, while slide1.xml ended up somewhere in the middle." The converter read files in alphabetical order, so the Markdown version handed to the AI agent started with a Q&A page and ended with the company logo—completely missing the narrative the author intended.
The Real Order Is Hidden in presentation.xml
The PPTX package is a container, and the order of slides is defined by p:presentation/sldIdLst in presentation.xml. This list stores relationship IDs (r:id), which must then be resolved to actual target files via presentation.xml.rels. It sounds like tedious XML plumbing work, but the author emphasizes that this is the difference between "a Markdown of a deck" and "a Markdown of the deck as the author intended."
The fix isn't complicated: parse sldIdLst, resolve each r:id to its real file path, then render in list order. Each slide becomes a heading, with the order fully faithful to the presentation.
OPC Packages and the Relationships Mechanism
PPTX is essentially a ZIP package following the OPC (Open Packaging Conventions) specification. OPC identifies each part by a URI, and parts are connected through relationship entries in .rels files. Each relationship has an Id (like rId3), a Type (e.g., .../slide), and a Target (relative path). The sldIdLst in presentation.xml only stores r:id references, not paths directly, so parsing requires first reading _rels/presentation.xml.rels to map r:id to the actual part. The benefit of this indirection layer is that parts can be renamed or moved freely without breaking references; the cost is that converters must perform two-step resolution. Similarly, [Content_Types].xml declares the MIME type for each extension, and is also an unavoidable step in the OPC reading process.
Containers Are Databases: The Index Is the Truth
This pitfall isn't exclusive to PPTX. The author distills it into a general lesson: containers that "look like folders" are actually "databases with their own opinions about order."
- Spreadsheets have hidden sheets; visible order doesn't equal in-file order;
- EPUB has spine entries; reading order is determined not by filenames or directory structure;
- PPTX has
sldIdLst; filenames are just noise.
In one sentence: trust the index, never trust filenames. This principle is especially important for developers building document processing tools—when you feed documents to an AI agent, wrong order means wrong semantics.
EPUB's Spine and OPF
EPUB's authoritative reading order is defined in the <spine> element of the OPF package file (typically content.opf). The spine lists <itemref idref="..."/> in order, each idref pointing to an <item>'s id in the manifest, and the manifest records the resource's href path. This is the same design philosophy as PPTX's sldIdLst + r:id: order first, then indirect addressing via IDs. Table of contents files (NCX or nav.xhtml) only describe navigation structure and may differ from spine order, so they can't be used as the source of truth for reading order. Additionally, the linear="no" attribute on a spine entry indicates that document is auxiliary content (like pop-up annotations) that can be skipped during linear reading.
The Fixed Tool
The author packaged the fixed converter into a document toolkit at x402.freeq.one/tools/pptx_to_markdown.html. In the output, each slide corresponds to a heading, arranged in true presentation order. For workflows that need to convert presentations to Markdown before handing them to an LLM, this detail determines the ceiling of output quality.
Takeaways for Developers
When writing document converters, don't assume filenames encode semantics. PPTX, EPUB, and even some archive formats may maintain an authoritative ordering index outside of filenames. When parsing container formats, first find the file that "has the final say"—usually presentation.xml, content.opf, or a similar manifest—then start converting. The debugging time you save is enough to write a few more test cases.
One-line Summary
PPTX conversion must sort by the sldIdLst index in presentation.xml, not by filenames.
Paragraph Summary
Starting from a real debugging incident: a converter turned PPTX into Markdown in filename order of slide1.xml, slide2.xml, and the appendix of a pitch deck ended up before the main content. The reason is that filenames in the .pptx package only reflect creation order, unrelated to the presentation order the author achieved by dragging in PowerPoint. The real order is defined in the p:presentation/sldIdLst list in presentation.xml, which stores relationship IDs that must be resolved to actual files via presentation.xml.rels. The author fixed the converter accordingly and distilled a general principle: container formats are essentially databases with their own opinions about order—trust the index, not filenames. Hidden sheets in spreadsheets and EPUB spines are similar examples.
Related articles

Random Pruning of the DPO Computation Graph: 1.4x Training Speedup and Lower Peak Memory
DPO training too slow and memory-hungry? This paper proposes a random pruning framework for the DPO computation graph, sampling independently across position, sequence, and branch dimensions; branch pruning achieves a 1.426x step-time speedup and cuts training time by about 30%, with in-depth attribution of memory and time gains.

Why Does JEPA Underperform MLM in Longitudinal EHR Representation Learning?
New study compares JEPA and MLM for longitudinal EHR representation learning on MIMIC-IV: three JEPA variants train stably without collapse but underperform MLM; target size, not heterogeneity, drives prediction error.

Transfer Learning + Visible Light Communication: A New Approach to Energy-Efficient Indoor Positioning
A study proposes a transfer learning-based visible light communication indoor positioning method, achieving 47% accuracy improvement on the BOSCH factory dataset, 67.5% model efficiency under high noise, and introducing the ME composite metric for energy-efficient positioning in energy-constrained industrial IoT scenarios.