including verbatim XML

11 views
Skip to first unread message

David Austin

unread,
Jun 28, 2024, 12:27:22 PMJun 28
to pretext...@googlegroups.com
I'm writing a PTX document and would like to include small XML files so that they are not interpreted by PTX but rather just included verbatim.  I can do this if I change left brackets to &lt; but I just want to check in case there's an easier way I'm not seeing in the documentation (it says XML markup can't go inside a <code> element).  The option for automated line numbering would be great too.

Thanks for any help.

David

D. Brian Walton

unread,
Jun 28, 2024, 12:51:38 PMJun 28
to pretext...@googlegroups.com
David,

Would the following work? (This is a variant of something I was trying that is related but not quite what you said, so I'm guessing on whether it will work quite how you want.

Brian

<listing>
<program line-numbers="yes"><xi:include href="myxmlcode.xml" parse="text" /></program>
<caption>Example listing of <c>myxmlcode.xml</c></caption>
</listing>

--
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 on the web visit https://groups.google.com/d/msgid/pretext-support/CANXmVMAWYeUny3ki6ZYumHkXu-v0F8c-8f1mjFCq-UMYct3imA%40mail.gmail.com.

David Austin

unread,
Jun 28, 2024, 1:10:44 PMJun 28
to pretext...@googlegroups.com
Thanks, Brian.  That looks like what I want.  In the output, however, I see that listing and its caption, but not the XML.

D. Brian Walton

unread,
Jun 28, 2024, 1:33:05 PMJun 28
to pretext...@googlegroups.com
Change #program to #pre and remove the @line-numbers option, and you at least get the inclusion. I was hoping #program could deal with it and add the line numbers.

I wonder if it is possible to get program to support this?

Brian

David Austin

unread,
Jun 28, 2024, 1:41:18 PMJun 28
to pretext...@googlegroups.com
OK, that works.  Thanks!  I originally had just a <pre> so it helped to wrap it in a <listing>.

+1 to have <program> support for XML source.

Rob Beezer

unread,
Jun 28, 2024, 2:04:57 PMJun 28
to pretext...@googlegroups.com
Nothing new to support here, methinks. "Character data" is character data.
That's what parse="text" is creating. Sorta like the dreaded "CDATA"
thing-a-ma-jig.

A "program" needs an "input" elenent inside it?

Rob
> <mailto:pretext-suppo...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pretext-support/CANXmVMAWYeUny3ki6ZYumHkXu-v0F8c-8f1mjFCq-UMYct3imA%40mail.gmail.com <https://groups.google.com/d/msgid/pretext-support/CANXmVMAWYeUny3ki6ZYumHkXu-v0F8c-8f1mjFCq-UMYct3imA%40mail.gmail.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-suppo...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pretext-support/CAH7VRo%2BTtCS1dEcm81dA3%3Dj_j7Yt-TBW4i%2BVW8wOUr_MSwFeZA%40mail.gmail.com <https://groups.google.com/d/msgid/pretext-support/CAH7VRo%2BTtCS1dEcm81dA3%3Dj_j7Yt-TBW4i%2BVW8wOUr_MSwFeZA%40mail.gmail.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-suppo...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pretext-support/CANXmVMCgXWyh0hwAGttMA56Udug7fh1x8QORC-Cd31bGRPzKxA%40mail.gmail.com <https://groups.google.com/d/msgid/pretext-support/CANXmVMCgXWyh0hwAGttMA56Udug7fh1x8QORC-Cd31bGRPzKxA%40mail.gmail.com?utm_medium=email&utm_source=footer>.

David Austin

unread,
Jun 28, 2024, 2:42:36 PMJun 28
to pretext...@googlegroups.com
Yes, you're quite right.  Including an input did the trick.  Thank you!

To unsubscribe from this group and stop receiving emails from it, send an email to pretext-suppo...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pretext-support/MTAwMDAxNS5iZWV6ZXI.1719597894%40quikprotect.

Rob Beezer

unread,
Jun 28, 2024, 3:07:40 PMJun 28
to pretext...@googlegroups.com
I make that mistake *all the time*.

Note to self: have the preprocessor supply the #input when #program is not structured.

Rob Beezer

unread,
Jul 1, 2024, 12:27:24 PMJul 1
to pretext...@googlegroups.com
On 6/28/24 12:07, 'Rob Beezer' via PreTeXt support wrote:
> Note to self: have the preprocessor supply the #input when #program is not structured.

Turns out this was a note for Andrew S.

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

(Thanks, Andrew!)

David Austin

unread,
Jul 1, 2024, 6:02:50 PMJul 1
to pretext...@googlegroups.com
Great!  Thanks to both of you. 

David

--
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.
Reply all
Reply to author
Forward
0 new messages