Same xml:id in different components causes duplicate ID error in HTML

28 views
Skip to first unread message

Sean Fitzpatrick

unread,
Jul 15, 2024, 7:44:59 PM (8 days ago) Jul 15
to PreTeXt development
Two versions of a book might use different statements of a theorem, or some other element that you want to reference.

So in source, you have something like

<theorem xml:id="theorem-important" component="basic">

and later

<theorem xml:id="theorem-important" component="advanced">

where you use the same ID because it gets xref-ed in the common component of the book.

Building LaTeX goes through without incident, and behaves as expected.
But building HTML fails with a critical error due to the xml:id "theorem-important" being already defined.

I had assumed that components would be processed before ids, but this seems to not be the case for HTML.

If something is only referenced once or twice, I can use different ids and duplicate the <p>s where the xrefs are. But this isn't ideal for something with many xrefs to it.

Rob Beezer

unread,
Jul 15, 2024, 10:22:10 PM (8 days ago) Jul 15
to prete...@googlegroups.com
I think the actual XSL processing is seeing two @xml:id in the same file, and we
can't control that discovery before the pre-processor constructs the version.

But it is still a mystery why the error does not arise when building LaTeX/PDF.
> --
> You received this message because you are subscribed to the Google Groups
> "PreTeXt development" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to pretext-dev...@googlegroups.com
> <mailto:pretext-dev...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pretext-dev/4f1a5784-b466-44a4-af12-c219ddb2a6d6n%40googlegroups.com <https://groups.google.com/d/msgid/pretext-dev/4f1a5784-b466-44a4-af12-c219ddb2a6d6n%40googlegroups.com?utm_medium=email&utm_source=footer>.

Sean Fitzpatrick

unread,
Jul 15, 2024, 10:46:28 PM (8 days ago) Jul 15
to PreTeXt development
If I build the html using the pretext/pretext/pretext script instead of the CLI, everything builds fine, with no errors or warnings.

So something is happening with the CLI that I don't understand.

Jeremy Sylvestre

unread,
Jul 18, 2024, 2:14:44 PM (6 days ago) Jul 18
to prete...@googlegroups.com
Hi Sean, I would do something like

<theorem xml:id="theorem-important">

  <statement component="basic">...</statement>
  <proof component="basic">...</proof>

  <statement component="advanced">...</statement>
  <proof component="advanced">...</proof>

</theorem>

if that makes sense in your case

--
You received this message because you are subscribed to the Google Groups "PreTeXt development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pretext-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pretext-dev/4f1a5784-b466-44a4-af12-c219ddb2a6d6n%40googlegroups.com.

Sean Fitzpatrick

unread,
Jul 18, 2024, 3:56:26 PM (5 days ago) Jul 18
to prete...@googlegroups.com

Hi Jeremy,

This turned out to be a CLI bug: the error was caused by codechat trying to parse the file for that section.

Oscar was able to change things in 2.5.2 so that this becomes a warning, rather than a critical error.


Rob Beezer

unread,
Jul 18, 2024, 8:13:21 PM (5 days ago) Jul 18
to prete...@googlegroups.com
Dear Jeremy,

I like that approach to avoiding the duplicate xml:id. Presuming that a version
is *always* being chosen. (Don't want two statements abd two proofs in one
theorem (usually).)

The Guide has lots of advice on using versions. Maybe this example might help
authors think of (more) creative ways to use them. Wanna make a contribution?

Thanks,
Rob
> <mailto:pretext-dev...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pretext-dev/4f1a5784-b466-44a4-af12-c219ddb2a6d6n%40googlegroups.com <https://groups.google.com/d/msgid/pretext-dev/4f1a5784-b466-44a4-af12-c219ddb2a6d6n%40googlegroups.com?utm_medium=email&utm_source=footer>.
>
> --
> You received this message because you are subscribed to the Google Groups
> "PreTeXt development" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to pretext-dev...@googlegroups.com
> <mailto:pretext-dev...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pretext-dev/CALMYOndu0OiKo_ttx30G085NubzLVw6PCdVR%2BurXNfmpsLDwug%40mail.gmail.com <https://groups.google.com/d/msgid/pretext-dev/CALMYOndu0OiKo_ttx30G085NubzLVw6PCdVR%2BurXNfmpsLDwug%40mail.gmail.com?utm_medium=email&utm_source=footer>.
Reply all
Reply to author
Forward
0 new messages