[xep-support] Re: Fwd: Why is this test document failing?

From: Kevin Brown <kevin@renderx.com>
Date: Sun Apr 21 2013 - 11:58:13 PDT

In the meantime .. you may wish to implement something like this. You could
just apply this XSL to an SVG or with some modification, put into a called
template if you are using XSLT to read/reorder the SVG into an
instream-foreign-object.

This will reorder the linearGradients by selecting those first without xlink
and then those with xlink's so that the bug is overcome.

Kevin Brown
RenderX

********************************

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:dc="http://purl.org/dc/elements/1.1/"
        xmlns:cc="http://creativecommons.org/ns#"
        xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
        xmlns:svg="http://www.w3.org/2000/svg"
        xmlns="http://www.w3.org/2000/svg"
        xmlns:xlink="http://www.w3.org/1999/xlink"
        xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
        xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
>
        
        <xsl:template match="svg:defs">
                <xsl:copy>
                        <!-- Output attribs on def -->
                        <xsl:apply-templates select="@*"/>
                        <!-- Output gradients without references first -->
                        <xsl:apply-templates
select="svg:linearGradient[not(@xlink:href)]"/>
                        <!-- Output gradients with references next -->
                        <xsl:apply-templates
select="svg:linearGradient[@xlink:href]"/>
                        <!-- Output anything else not a linearGradient -->
                        <xsl:apply-templates
select="*[not(name()='linearGradient')]"/>
                </xsl:copy>
        </xsl:template>

<!-- Identity for everything else -->
<xsl:template match="node()|@*">
        <xsl:copy>
                <xsl:apply-templates select="node()|@*"/>
        </xsl:copy>
</xsl:template>

</xsl:stylesheet>

-----Original Message-----
From: xep-support-bounces@renderx.com
[mailto:xep-support-bounces@renderx.com] On Behalf Of Kevin Brown
Sent: Sunday, April 21, 2013 10:53 AM
To: 'RenderX Community Support List'
Subject: [xep-support] Re: Fwd: Why is this test document failing?

All:

This has been reported and is in our bug database to be addressed in a
future release. I will chaeck on the status and let you know. From RenderX's
Bugzilla:

Bug #25054: incorrect processing of a gradient defined using another
gradient (via xlink:href) and the "referenced" gradient is placed before the
"base" gradient.

Kevin Brown
RenderX

-----Original Message-----
From: xep-support-bounces@renderx.com
[mailto:xep-support-bounces@renderx.com] On Behalf Of Anderson, Paul
Sent: Friday, April 19, 2013 5:44 AM
To: RenderX Community Support List
Subject: [xep-support] Re: Fwd: Why is this test document failing?

Greetings,

We've had this problem for a while now with our SVG graphics created in
Inkscape and rendered in XEP. The problem is that linearGradient elements
can reference other linearGradient elements and XEP is sensitive to the
order in which they occur in the document tree.

For example, if you have a rectangle with filled with a linearGradient and
you copy and paste that rectangle in Inkscape, the pasted rectangle will
contain a new linearGradient with a unique ID, but it references the ID of
the linearGradient in the copied rectangle for its content. Inkscape happens
to write these elements with the referencing linearGradient first and the
referenced linearGradient second. XEP is sensitive to this condition and
throws the errors you report in your message. In the SVG specification,
there is no mention of a requirement that the referenced linearGradients
must be defined (that is, occur in the document tree) before those
linearGradient elements that reference them.

When the warning occurs, the result is that the drawing does not output
correctly. If, however, you manually reorder the linearGradient elements in
the SVG file such that the referenced linearGradient elements come first,
XEP does not throw a warning and renders the graphic correctly.

In the attached archive, I've provided the following:

- An SVG drawing where two rectangles were manually adjusted in Inkscape to
use the same linearGradient. The order of the elements is not an issue in
this file and the output is correct.

- An SVG drawing with a copied rectangle containing a linearGradient
element. Inkscape writes the element in an order that XEP doesn't like and
the output of the second rectangle is wrong. The warning from XEP is:
[warning] No 'linearGradient' element found with id="linearGradient2987-7";
referenced linear gradient ignored.

- An SVG drawing identical to the previous one except the order of the
referenced/referencing linearGradient elements was adjusted such that the
referenced element comes first. Now the order is not an issue and the output
is correct.

- The XSL-FO document that we passed to XEP

- The resulting PDF, demonstrating the output issues with referenced
linearGradient elements.

I must confess that I've been meaning to report this issue for a long time.
Reinier, thank you for starting this thread and boosting my motivation.

Note that this demonstration was performed with XEP 4.21 build 20121114.

Best regards,

Paul Anderson
Information Developer - Codex Administrator Compuware Corporation -
+1-313-227-2031

-----Original Message-----
From: xep-support-bounces@renderx.com
[mailto:xep-support-bounces@renderx.com] On Behalf Of Reinier Kleipool
Sent: Friday, April 19, 2013 3:52 AM
To: xep-support@renderx.com
Subject: [xep-support] Fwd: Why is this test document failing?

Hello,

  Why are there problems with LineairGradients in this test document?
Apache Batik displays it correct an so does Inkscape that was used to
produce it...
Reinier

      [warning] No 'linearGradient' element found with
id="linearGradient4024-2"; referenced linear gradient ignored.
      [warning] No 'linearGradient' element found with
id="linearGradient4024-9"; referenced linear gradient ignored.
      [warning] No 'linearGradient' element found with
id="linearGradient4024"; referenced linear gradient ignored.
      [warning] No 'linearGradient' element found with
id="linearGradient3896-9"; referenced linear gradient ignored.
      [warning] No 'linearGradient' element found with
id="linearGradient3896"; referenced linear gradient ignored.
      [warning] No 'linearGradient' element found with
id="linearGradient3720-6"; referenced linear gradient ignored.
      [warning] No 'linearGradient' element found with
id="linearGradient3720-9"; referenced linear gradient ignored.
      [warning] No 'linearGradient' element found with
id="linearGradient3720-4"; referenced linear gradient ignored.
      [warning] No 'linearGradient' element found with
id="linearGradient3720"; referenced linear gradient ignored.
      [warning] No 'linearGradient' element found with
id="linearGradient4396-0"; referenced linear gradient ignored.
      [warning] No 'linearGradient' element found with
id="linearGradient4396-4"; referenced linear gradient ignored.
      [warning] No 'linearGradient' element found with
id="linearGradient4396-5"; referenced linear gradient ignored.
      [warning] No 'linearGradient' element found with
id="linearGradient4396"; referenced linear gradient ignored.
      [warning] No 'linearGradient' element found with
id="linearGradient3896-9-1"; referenced linear gradient ignored.
      [warning] No 'linearGradient' element found with
id="linearGradient3896-9-26"; referenced linear gradient ignored.
      [warning] No 'linearGradient' element found with
id="linearGradient4024-4-8"; referenced linear gradient ignored.
      [warning] No 'linearGradient' element found with
id="linearGradient4024-4-0"; referenced linear gradient ignored.
      [warning] No 'linearGradient' element found with
id="linearGradient4024-4"; referenced linear gradient ignored

!DSPAM:87,5170f7c39852052032467!

_______________________________________________
(*) To unsubscribe, please visit
http://lists.renderx.com/mailman/options/xep-support
(*) By using the Service, you expressly agree to these Terms of Service
http://w ww.renderx.com/terms-of-service.html

_______________________________________________
(*) To unsubscribe, please visit http://lists.renderx.com/mailman/options/xep-support
(*) By using the Service, you expressly agree to these Terms of Service http://w
ww.renderx.com/terms-of-service.html
Received on Sun Apr 21 11:58:18 2013

This archive was generated by hypermail 2.1.8 : Sun Apr 21 2013 - 11:58:24 PDT