pretext icon indicating copy to clipboard operation
pretext copied to clipboard

FITB: Automatic solution is not sanitized

Open dbrianwalton opened this issue 7 months ago • 1 comments

When a fill-in-the-blank exercise is authored with a statement containing labeled/xml:id'd children, the automatically generated solution for that exercise duplicates the entire statement resulting in duplicate xml:id errors.

See this conversation: https://groups.google.com/g/pretext-support/c/34E4PpRSlhA/m/EHGQ1rFLAAAJ

The error was first identified when images were included in a problem.

I believe that the fault occurs in xsl/pretext-runestone-static.xsl lines 1040-1060. This block of code duplicates the original statement replacing all of the fillin elements with their correct answers. It was implemented with a recursive copy of the statement xml hierarchy, and only the fillin is overridden with a change.

To preserve the original intent of the automatic solution, what is the best alternative?

  • Copy only text-based elements (e.g., p and ul and ol) and skip any other children
  • Copy only paragraphs that contain fill-in-blanks that require substitution, skipping all other elements (including paragraphs) that involve no substitution

dbrianwalton avatar May 19 '25 13:05 dbrianwalton

Actual duplication occurs lines 986-1012 in this match block:

<xsl:template match="statement" mode="fillin-solution">

dbrianwalton avatar May 19 '25 13:05 dbrianwalton