4

I have to following code in html5 and i want to embed it in my jsf 2 application but the tag simply doesn´t work:

<svg><use xlink:href="img/svgdefs.svg#icon-test"></use></svg>

Anybody an idea?

perotom
  • 851
  • 13
  • 33

1 Answers1

3

Make sure you have this xmlns:xlink="http://www.w3.org/1999/xlink" in your html tag.

Example:

<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:h="http://xmlns.jcp.org/jsf/html"
  xmlns:p="http://primefaces.org/ui"
  xmlns:jsf="http://xmlns.jcp.org/jsf"
  xmlns:ui="http://xmlns.jcp.org/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core"
  xmlns:xlink="http://www.w3.org/1999/xlink"
  lang="pt_BR">
  • i tried a lot and it didn´t worked out because the brwoser support was poor. – perotom Aug 09 '16 at 14:55
  • The above solution worked for me. Adding `xmlns:xlink="http://www.w3.org/1999/xlink"` as a property to the html tag makes `xlink:href` work :) Thanks! – MadsMadsDk Jul 16 '19 at 13:38