I have a similar “problem”.
I have created different .svg-files and i want to embed them also according to a itemvalue.
i already achieved that by using:
img src but I lose the ability to format the svg’s in my code by doing it this way.
I’d love to use xlink:href but somehow i can’t get it to work.
I appended .svg at the end and my link now looks like this:
that ‘picking one icon, out of a set from only one svg file’-part, is one of the parts in openhab that i don’t understand and i don’t find examples howto (make one svg file with many svg files in, address the icons, show them) maybe i don’t use the right spelling while i search…
but if i where able to address this i would try:
where commandToPickIcon is the Syntax i don’t know and in this possible solution i would fill another item (mySVGFile) with the string of the SVG-File to select from…
lol, the # is the commandToPickIcon (thanks a lot)
Sure i start read this, but i don’t want to install python (i am a typical win user) , that’s why i don’t complete reading till the end
then this should work: <use xlink:href="{{ '/static/Icons/' + itemValue('mySVGFile') + '.svg#' + itemValue( 'Condition')}}"></use>
or if you use only one SVG-File: <use xlink:href="{{ '/static/Icons/mySVGFile.svg#' + itemValue( 'Condition' )}}"></use>