Some problems with SVG

I have a SVG I need to modify. I have two problems. Here is a sample code: (5.1 KB)

Problem 1:
I’m not able to change/set X and Y position of my text element (see //textElement.X = textX; in the sample code)

Problem 2:
This textElement has defined transform like this:


as you can see there are 2 transforms: rotate and translate. Unfortunatelly Aspose shows empty list in Transform property for this text element. I guess that the problem is that these 2 transforms are not split with a space but still webbrowser can read and apply these transforms correctly.

If you need more info, please let me know


We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): SVGNET-183

You can obtain Paid Support services if you need support on a priority basis, along with the direct access to our Paid Support management team.


Problem 1:

You are trying to change the X and Y positions of a text element, but the SVG specification states that the X and Y properties of text elements are read-only properties and cannot be set directly. Instead, you can use the SetAttribute method to set the X and Y properties of the text element. The X and Y properties are of type SVGAnimatedLengthList, which represents a list of length values that can be animated. You can set the X and Y properties using the SetAttribute method like this:

textElement.SetAttribute("x", textX.ToString(CultureInfo.InvariantCulture));
textElement.SetAttribute("y", textY.ToString(CultureInfo.InvariantCulture));

Problem 2:

You have defined a transform attribute for a text element that contains two transforms - rotate and translate. However, there is no space between the two transforms in your code. According to the old SVG specification, the transform attribute must be a list of transform definitions separated by whitespace. The issue is that your attribute is not a valid list of transform definitions, which is why Aspose.SVG for .NET is unable to read it.

The behavior of the transform attribute in the SVG specification has been modified in the new CSS Transforms specification. According to the CSS Transforms specification, the transform attribute should be a comma-separated or space-separated list of transform definitions, with an optional comma or whitespace character after each transform. The syntax for the transform attribute is:

| transform comma-wsp? transforms

We have updated the code to correctly parse the transform attribute with the new behavior specified in the updated specification. This fix will be included in the upcoming release 23.2.0, which will allow your transform attribute to be properly interpreted by Aspose.SVG for .NET.