Just out of curiousity and since Symphony is built so heavily around XML: Is there a way to generate SVG images / files on-the-fly with Symphony?

I just uploaded a static SVG file like this one into my images folder:

<?xml version="1.0" encoding="utf-8"?>

<?xml-stylesheet type="text/css" href="{$workspace}/css/styles.css"?>

<svg version="1.2" baseProfile="tiny" id="parts" xmlns="" xmlns:xlink=""
     x="0px" y="0px" width="503.078px" height="281.386px" viewBox="0 0 503.078 281.386" xml:space="preserve">

        <path fill-rule="evenodd" fill="#3A93CE" d="M17.735,88.432c-23.762,0-23.531-36.17,0-36.17c7.846,0,9.827,4.319,15.197,6.607

In my view I am embedding it as follows:

<object data="{$workspace}/images/image.svg" type="image/svg+xml"/>

It would be nice to define its contents in a more programmatic way through XSLT. Has this ever been done before?

Thanks for any input.

Yes it’s possible i have done it just recently!

You can create a page called for example 'svgimage' and set the Type to 'SVG'
Use this in the page template:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xsl:stylesheet version="1.0"

<xsl:output method="xml"
    indent="yes" />

<xsl:template match="/">
    <!-- svg data here -->
    <svg xmlns="" version="1.1" x="0px" y="0px" viewBox="">


You can attach a datasource and do your xslt on the svg code.

What might be even easier is to embed the svg code directly in you html.

Do you need this maybe ?

<xsl:copy-of select="document($image-path)/*" />

If you want the svg inside of the xml data you can have a reflection field to get the path of the svg (something like: {entry/svgFieldName/@path}{entry/svgFieldName/filename})

Add the reflection field as a parameter in the datasource $ds-sectionWithSvgUpload.reflectionFieldName (using the reflection field here because you cannot expose an upload field as a ds parameter)

Create a remote datasource to fetch svg data using the ds-parameter, remote datasource url could be: {$root}{$ds-sectionWithSvgUpload.reflectionFieldName}

This way your svg will be available inside the xml so you can modify it in xsl before render (as a standalone svg document or inline svg in a html page).

Note that you need to manually edit the remote datasource to add $ds-sectionWithSvgUpload.reflectionFieldName as a dependency (so remote datasource wait for this parameter before being executed).

Another way to have the svg data embed in you xml is to use the xml field where you can paste the svg (probably a bit less user friendly than the upload field for backend admin).

Hi and thanks everyone for the useful input. I was on holiday, hence the late reply. Cremol's solution works like a charm. I simply pasted my SVG code directly into my XSL file and it works!

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details