Embedding interactives for portable html builds

11 views
Skip to first unread message

Oscar Levin

unread,
Jun 4, 2026, 12:06:17 AMJun 4
to PreTeXt development
I would like to take the portable html builds to the next level by removing the requirement that various interactives (including Doenet, surprise surprise)  continue to be loaded in an iframe via an @src to an external html file.  Instead, we can take that html in the external file and put it directly in the @srcdoc attribute on the iframe.  The only trick is that all double quotes need to be replaced with `"`.  Doing this manually works beautifully.

I went down a rabbit hole today thinking that this would be easy, and got it almost working.  The problem is the xml serialization.  I played around with the xml-to-text modal templates, even added a parameter to stop prematurely escaping xml characters that were text (children of script apparently).  But it looks like a lot more gets stripped out, including the doctype declaration at the top of the file and at least some other things.  

It seem very reasonable to put the contents of srcdoc in via xsl, but perhaps this is too tricky.  Maybe I need to write the *-if.html files and then post-process them to insert their (slightly escaped) content into the srcdoc.  I can certainly do that.

But now I'm curious if there is a nicer way to do this in xsl.  Any suggestions from xsl gurus welcome.

Rob Beezer

unread,
Jun 4, 2026, 8:26:07 PMJun 4
to prete...@googlegroups.com
Are you reading the files within the XSL via "exsl:document()"? Then you have
XML on your hands. (Hoefully Doenet has well-formed (X)HTML.

Now it goes into an attribute? @srcdoc? You've got less-than symbols to worry
about? In addition to double-quotes. I've seen XSL do "the right thing" with
quotes and use a *single* quote to delimit the attribute value. But your goal
is text with no dangerous XML characters? The "xml-to-text" templates don't do
that?

There is disable-ouput-escaping="yes" which is always a read flag and should be
voided. So for get I said that.

I don't think I'm helping much, but maybe I don't quite have teh full picture.

Rob

On 6/3/26 21:06, Oscar Levin wrote:
> I would like to take the /portable/ html builds to the next level by removing
> --
> 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+uns...@googlegroups.com>.
> To view this discussion visit https://groups.google.com/d/msgid/pretext-
> dev/7ceb1f99-357f-463f-a703-8cc95e7bf9bdn%40googlegroups.com <https://
> groups.google.com/d/msgid/pretext-dev/7ceb1f99-357f-463f-
> a703-8cc95e7bf9bdn%40googlegroups.com?utm_medium=email&utm_source=footer>.

Reply all
Reply to author
Forward
0 new messages