In my last post I talked about a jQuery error that I had come across. Maybe I should have posted this solution first. The Q&A page I talked about is being backed by an XML file, I'm then using an XSLT file to generate XHTML from it. Maybe not the best option for what I want to do but it will work for now and I can learn some new things and put into practice other things I have some knowledge of.

So I was including jQuery, I setup a test XHTML page to prove the idea and that worked fine. But then I tried adding the java script into the XSLT, the page was generated but it seemed that jQuery was not being included. It turned out to be an issue with the XSLT generating the XHTML.

so from having this script:

<script type="text/javascript" src="libs/jquery-1.6.1.min.js" ></script>

I had to change it to this:

<script type="text/javascript" src="libs/jquery-1.6.1.min.js" >
<![CDATA[ //Fake content to keep the end script tag ]]>
</script>

The XSLT was always taking the fully closed end tag and creating the short form, but that was not valid for the script tag in XHTML. So I used this hack. Maybe not the best way but it works for now. I might eventually look at another way to store the data, but this should let me get the working solution done soon.

Tags: Javascript | Solved