1

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.

3 Answers 3

4

Tell XSLT to output HTML using the output method element.

<xsl:output method="html"/>
Sign up to request clarification or add additional context in comments.

Comments

1

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.

Comments

0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.