how to include script tag in an xsl file?

2019-03-25 13:09发布

I'm working on an old site that uses java and xsl. How can I inculde a script file in an xsl file? Top of the file:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:include href="shipmentPackageInfo.xsl"/>

<script src="/fs/scripts/shipment/shipment.js"></script>

breaks the app

-- UPDATE --

There is another file called pageHeader.xsl which has all the script tags inside of

<xsl:output method="html"/>
  <xsl:template match="PageHeaderData">

标签: xslt
7条回答
ら.Afraid
2楼-- · 2019-03-25 13:45

Oh, I do like this:

... ...
        </body>
<script language="javascript"><![CDATA[
var a_patch = function(){
    var links = document.getElementsByTagName("a");
    for (var i=0; i<links.length; i++){
        var link = links[i];
        var text = link.innerHTML;
        ... ...
    }
};
a_patch();
]]></script>
</html>
查看更多
登录 后发表回答