From 57786b70ae39b28415c17b9c057fd17cb056f6c8 Mon Sep 17 00:00:00 2001 From: Oscar Levin Date: Sat, 8 Aug 2026 18:56:31 -0400 Subject: [PATCH] Use pi namespace for assembly id --- pretext/project/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pretext/project/__init__.py b/pretext/project/__init__.py index a46d5f21..efedd916 100644 --- a/pretext/project/__init__.py +++ b/pretext/project/__init__.py @@ -695,8 +695,11 @@ def ensure_webwork_reps(self, clean_tmp_dirs: bool = True) -> None: if self.source_element().xpath(".//webwork[@copy|@source|*|text()]"): log.debug("Source contains webwork problems") # Get list of all assembly-ids for webwork (this will be the assembly-id of the parent of the webwork element). + # NB: assembly stamps the id in the "pi" (PreTeXt internal) namespace, so the xpath must be namespace-aware. + pi_ns = {"pi": "http://pretextbook.org/2020/pretext/internal"} webwork_assembly_ids = self.source_element_with_ids().xpath( - ".//webwork[@copy|@source|*|text()]/parent::*/@assembly-id" + ".//webwork[@copy|@source|*|text()]/parent::*/@pi:assembly-id", + namespaces=pi_ns, ) assert isinstance(webwork_assembly_ids, list) for id in webwork_assembly_ids: