I put a javascript function in my xsl file. This function must be called whenever onclick event is fired.
<script type= "text/javascript">
<xsl:text>
function embeddedPreview(source) {
if($("#embed").length > 0) {
//set the source to the location asked for
$("#embed").attr("src", source);
} else {
//Create the embed iframe
$("#preview-embed").append("<iframe id='embed' src='"+source+"' width='100%' height='342px' style='border:none;'/>"); //requires jQuery
}
}
</xsl:text>
</script>
When I run this, an error below occurs pointing to Line 9.
javax.xml.transform.TransformerException: iframe is not allowed in this position in the stylesheet!
Below is a part of my xsl file where iframe must be appended, particularly in div with an id of "preview-embed".
What does it mean? Does div is not allowed to be appended with an iframe? Please help me.