我创建了一个小的xslt文件来创建一个名为weather.xsl的html输出,其代码如下:
<!-- DWXMLSource="http://weather.yahooapis.com/forecastrss?w=38325&u=c" -->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
exclude-result-prefixes="yweather"
xmlns:yweather="http://xml.weather.yahoo.com/ns/rss/1.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<img src="{/*/*/item/yweather:condition/@text}.jpg"/>
</xsl:template>
</xsl:stylesheet>
Run Code Online (Sandbox Code Playgroud)
我想将html输出加载到html文件中的div中,我正在尝试使用jQuery,如下所示:
<div id="result">
<script type="text/javascript">
$('#result').load('weather.xsl');
</script>
</div>
Run Code Online (Sandbox Code Playgroud)
但是我收到以下错误:Access-Control-Allow-Origin不允许使用Origin null.
我已经阅读过有关向xslt添加标题的内容,但我不知道该怎么做,所以任何帮助都会受到赞赏,如果在html输出中加载不能这样做,那么建议如何这样做会很棒.
我是ES6的新手(ECMAScript 6),我想在浏览器中使用它的模块系统.我读过ES6受Firefox和Chrome支持,但我收到以下错误export
Uncaught SyntaxError: Unexpected token import
我有一个test.html文件
<html>
<script src="test.js"></script>
<body>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
和一个test.js文件
'use strict';
class Test {
static hello() {
console.log("hello world");
}
}
export Test;
Run Code Online (Sandbox Code Playgroud)
为什么?