Xml Xsl转 html

wylc123 1年前 ⋅ 479 阅读

   问题1.

SVG报错error on line 39 at column 26: Namespace prefix xlink for href on script is not defined

SVG写入image标签时,发现在google和火狐上无法显示,且报错: Namespace prefix xlink for href on script is not defined

后经查询,找到了解决办法:

在命名空间上添加:

xmlns:xlink=http://www.w3.org/1999/xlink

实例:

复制代码

<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">

<svg width="100%" height="100%" version="1.1"xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" >

<circle cx="100" cy="50" r="40" stroke="black"stroke-width="2" fill="red"/>

<image xlink:href="happy-every-day.jpg" width="96" height="96" />

</svg>

复制代码


其中红色的命名空间是使google、火狐浏览器兼容SVG的,蓝色的部分是image标签适应google或火狐浏览器的。

 

更多内容请访问:IT源点

全部评论: 0

    我有话说: