質問

I am using GanntProject, a desktop application for Gantt charts that can export in HTML using some XSL. (I am not 100% familiar with XSL/how this works)

The exported result is available here: http://pixels.studenttribe.org/3DPrinting/3rdYrProjGannt3.6-tasks.html (Note the top Hyperlink, "Gannt" which takes you to the chart )

The original XSL for the "Tasks" page is available here: http://pixels.studenttribe.org/3DPrinting/StackOverflow/ Where the "old" file is the ORIGINAL file that came with the program, and the "gannt-tasks.xsl" is the version I am using (with my edits) (FileExtension renamed from ".xsl" to ".txt" to allow in-browser viewing)

Question: Why is it that I get an error if I try to add some Javascript to this XSL file? Is there a solution to have this script included in the HTML automatically upon export? (You can see the script I manually entered by viewing page source of the first link provided above, the script is right at the top) N.B. the script enables HTML as opposed to displaying plain-text.

Thanks in advance for your help!

Jerome

役に立ちましたか?

解決

Make sure your XSLT is well formed. Any unescaped < or & in the JavaScript code will break the XML.

You can "escape" your script by wrapping its content in <![CDATA[...]]> like so:

<script type="application/javascript"><![CDATA[
  // Put your script here
]]></script>

XML is not as forgiving as HTML. It has stricter (and simpler) parsing rules.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top