Including a Doenet activity

20 views
Skip to first unread message

jfir...@linfield.edu

unread,
Jul 21, 2025, 10:20:10 PM7/21/25
to PreTeXt support
I am trying to include a Doenet activity in a textbook. I have the activity as a separate file and am using xi:include as follows:

<interactive label="doenetminimaxgraph" platform="doenetml" width="100%" aspect="40:43">
          <slate surface="doenetml">
           
            <xi:include parse="text" href="doenet/minimaxgraph.xml"/>
           
          </slate>
  </interactive>

It seems that the xi:include is the main issue as I am getting a warning:
warning: Failed to map codechat path to xml id; codechat will not work.

When I comment out the interactive (or just the xi:include statement ) I do not get this warning. I tried a minimal amount of text in the minimaxgraph.xml file and I still get this error.

Oscar Levin

unread,
Jul 21, 2025, 11:31:17 PM7/21/25
to pretext...@googlegroups.com
Other than this warning, does your document build and display things correctly?  Codechat is a way to preview files side by side, and isn't strictly necessary for pretext.

--
You received this message because you are subscribed to the Google Groups "PreTeXt support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pretext-suppo...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/pretext-support/6dc40157-66b5-46d8-884a-962df8a2741bn%40googlegroups.com.

Rob Beezer

unread,
Jul 21, 2025, 11:37:15 PM7/21/25
to pretext...@googlegroups.com
Dear Jen,

I was waiting to hear from Oscar.

Shot in the dark - try putting an @xml:id on the #interactive and the #slate, just to see what happens.

Rob
>> <https://groups.google.com/d/msgid/pretext-support/6dc40157-66b5-46d8-884a-962df8a2741bn%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

Andrew Scholer

unread,
Jul 22, 2025, 10:10:24 AM7/22/25
to pretext...@googlegroups.com
I *think* this might be related to a missing "xmlns:xi="http://www.w3.org/2001/XInclude""

I get the mysterious codechat error if the toplevel element on a page is missing that namespace declaration. e.g.
<chapter xml:id="ch-chapter-title">
instead of 
<chapter xml:id="ch-chapter-title" xmlns:xi="http://www.w3.org/2001/XInclude">

Jen:
Do you see an error like this on your xi:include?
image.png

And can you try this in the terminal:
pretext -v DEBUG build

See if that shows an error like:
lxml.etree.XMLSyntaxError: Namespace prefix xi on include is not defined...

Message has been deleted
Message has been deleted

Rob Beezer

unread,
Jul 22, 2025, 1:44:39 PM7/22/25
to pretext...@googlegroups.com
Likely a missing namespace decleration in Jen's source, but she would never know
since the error reporting (from the XSL processor, not PreTeXt) was a bit wonky.

Andrew S has devised a fix, which was just merged, and will roll out in the
usual progression. Nice work on Andrew's part.

https://github.com/PreTeXtBook/pretext/pull/2623

Thanks very much, Jen, for providing a report. You've saved a lot of
head-scratching for a lot of folks down the road.

Rob

On 7/22/25 07:09, Andrew Scholer wrote:
> I *think* this might be related to a missing "xmlns:xi="http://www.w3.org/2001/
> XInclude <http://www.w3.org/2001/XInclude>""
>
> I get the mysterious codechat error if the toplevel element on a page is missing
> that namespace declaration. e.g.
> <chapter xml:id="ch-chapter-title">
> instead of
> <chapter xml:id="ch-chapter-title" xmlns:xi="http://www.w3.org/2001/XInclude
> <http://www.w3.org/2001/XInclude>">
>
> Jen:
> Do you see an error like this on your xi:include?
> image.png
>
> And can you try this in the terminal:
> *pretext -v DEBUG build*
>
> See if that shows an error like:
> lxml.etree.XMLSyntaxError: Namespace prefix xi on include is not defined...
>
> On Mon, Jul 21, 2025 at 8:37 PM 'Rob Beezer' via PreTeXt support <pretext-
> sup...@googlegroups.com <mailto:pretext...@googlegroups.com>> wrote:
>
> Dear Jen,
>
> I was waiting to hear from Oscar.
>
> Shot in the dark - try putting an @xml:id on the #interactive and the
> #slate, just to see what happens.
>
> Rob
>
> On July 21, 2025 8:31:03 PM PDT, Oscar Levin <oscar...@gmail.com
> <mailto:oscar...@gmail.com>> wrote:
> >Other than this warning, does your document build and display things
> >correctly?  Codechat is a way to preview files side by side, and isn't
> >strictly necessary for pretext.
> >
> >On Mon, Jul 21, 2025, 7:20 PM 'jfir...@linfield.edu
> <mailto:jfir...@linfield.edu>' via PreTeXt support <
> >pretext...@googlegroups.com <mailto:pretext-
> sup...@googlegroups.com>> wrote:
> >
> >> I am trying to include a Doenet activity in a textbook. I have the
> >> activity as a separate file and am using xi:include as follows:
> >>
> >> <interactive label="doenetminimaxgraph" platform="doenetml" width="100%"
> >> aspect="40:43">
> >>           <slate surface="doenetml">
> >>
> >>             <xi:include parse="text" href="doenet/minimaxgraph.xml"/>
> >>
> >>           </slate>
> >>   </interactive>
> >>
> >> It seems that the xi:include is the main issue as I am getting a warning:
> >> warning: Failed to map codechat path to xml id; codechat will not work.
> >>
> >> When I comment out the interactive (or just the xi:include statement ) I
> >> do not get this warning. I tried a minimal amount of text in the
> >> minimaxgraph.xml file and I still get this error.
> >>
> >> --
> >> You received this message because you are subscribed to the Google Groups
> >> "PreTeXt support" group.
> >> To unsubscribe from this group and stop receiving emails from it, send an
> >> email to pretext-suppo...@googlegroups.com <mailto:pretext-
> support%2Bunsu...@googlegroups.com>.
> >> To view this discussion visit
> >> https://groups.google.com/d/msgid/pretext-
> support/6dc40157-66b5-46d8-884a-962df8a2741bn%40googlegroups.com <https://
> groups.google.com/d/msgid/pretext-
> support/6dc40157-66b5-46d8-884a-962df8a2741bn%40googlegroups.com>
> >> <https://groups.google.com/d/msgid/pretext-
> support/6dc40157-66b5-46d8-884a-962df8a2741bn%40googlegroups.com?
> utm_medium=email&utm_source=footer <https://groups.google.com/d/msgid/
> pretext-support/6dc40157-66b5-46d8-884a-962df8a2741bn%40googlegroups.com?
> utm_medium=email&utm_source=footer>>
> >> .
> >>
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "PreTeXt support" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to pretext-suppo...@googlegroups.com <mailto:pretext-
> support%2Bunsu...@googlegroups.com>.
> To view this discussion visit https://groups.google.com/d/msgid/pretext-
> support/MTAwMDAwNC5iZWV6ZXI.1753155432%40pnsh <https://groups.google.com/d/
> msgid/pretext-support/MTAwMDAwNC5iZWV6ZXI.1753155432%40pnsh>.
>
> --
> You received this message because you are subscribed to the Google Groups
> "PreTeXt support" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to pretext-suppo...@googlegroups.com <mailto:pretext-
> support+u...@googlegroups.com>.
> CACm44N_K31MkgUsGYdwPRkyR5n51gWi7V%2BVuMt-Q_3RFJyTXOQ%40mail.gmail.com <https://
> groups.google.com/d/msgid/pretext-support/
> CACm44N_K31MkgUsGYdwPRkyR5n51gWi7V%2BVuMt-Q_3RFJyTXOQ%40mail.gmail.com?
> utm_medium=email&utm_source=footer>.

jfir...@linfield.edu

unread,
Jul 25, 2025, 10:21:09 AM7/25/25
to PreTeXt support
Thanks everyone! It was Andrew who caught the error. I needed the xmlns:xi statement on the page. It will now include a simple version of the activity (text  and math only). However, I get errors for <mathinput> and the "simplify" attribute on the html output. Maybe someone has experience putting interactive Doenet activities in PreTeXt books. As a fall back, I can include the link to the Doenet Activity (I works fine on their site): https://doenet.org/portfolioeditor/_iR2WJvOBDdOFkCkep7LgL/_Z6T9avWGsLhNuP9QitQVK
I can include a screenshot of the errors on the html, if that would be helpful, but I was having trouble adding screenshots here.

jfir...@linfield.edu

unread,
Jul 25, 2025, 10:21:09 AM7/25/25
to PreTeXt support
Thanks everyone! It was the missing <chapter xml:id="ch-chapter-title" xmlns:xi="http://www.w3.org/2001/XInclude"> on the section page that Andrew caught. It now includes the activity, but there are issues as it gives me a bunch of errors.  In particular, I get errors in the output for <mathinput> and "simplify" attributes. It includes the activity without errors if I just have text. I don't know if there are people who have put complicated Doenet activities in their books and have found ways to fix these errors, or if these types of activities are not yet compatible. I have attached a screenshot of what the html looks like, just in case anyone has ideas of how to fix them. The Doenet activity runs well on the Doenet site: https://doenet.org/portfolioeditor/_iR2WJvOBDdOFkCkep7LgL/_Z6T9avWGsLhNuP9QitQVK
As a temporary fix, I can certainly just include the link to the activity in the book.

On Tuesday, July 22, 2025 at 7:10:24 AM UTC-7 asch...@chemeketa.edu wrote:
doeneterror.pdf

Andrew Scholer

unread,
Jul 28, 2025, 12:15:07 AM7/28/25
to pretext...@googlegroups.com
Jen -

It looks like doenet expects <mathInput> not <mathinput>. 

For some reason the portfolio accepts either one, but the javascript library used to load doenet activities is more picky.

jfir...@linfield.edu

unread,
Jul 30, 2025, 5:49:29 PM7/30/25
to PreTeXt support
Thanks Andrew,

Yes, <mathInput> fixed the error. The "simplify" error was also that I needed <math> tags, not <m> tags when there was an attribute.

Jennifer
Reply all
Reply to author
Forward
0 new messages