tags:

views:

98

answers:

3

Hello,

I am using java code to create a html document. I have an xsl stylesheet and some xml that I want to create the html from.

I am using the TransformerFactory method to do this. My problem is that when it creates the html file, when you open it you see a blank page but the code is there. The issue is that when the html is created it uses a javascript file (which is used in the xsl code) and it doesn't add the </script> tag at the end of it but it is used in the xsl.

So in the xsl it is as follows:

<script src="URL" language = "javascript" type = "text/javascript"></script>

but when the html creates it, it does:

<script src="URL" language="javascript" type="text/javascript"/>

and it doesn't include the </script> tag. Instead it uses the / at the end to close it. For some reason the html doesn't like this and when I insert the tag in manually it works fine, but I want it to include the tag itself so it will open properly.

Any idea's on how to do this.

Your help is much appreciated.

A: 

Have you tried <xsl:text> or <xsl:copy>?

Scoregraphic
+4  A: 

Tell XSLT to output HTML using the output method element.

<xsl:output method="html"/>
Pete Kirkham
+1  A: 

Simply make sure the script tag is not empty. Put in a dummy comment, for example. This way you force the XSLT processor to close the tag explicitly, regardless of any other settings.

Tomalak