You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by bu...@apache.org on 2010/04/06 19:04:01 UTC
DO NOT REPLY [Bug 49055] setting svg attributes with xsl only works
if intermediate fo is created
https://issues.apache.org/bugzilla/show_bug.cgi?id=49055
Andreas L. Delmelle <ad...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |INVALID
--- Comment #1 from Andreas L. Delmelle <ad...@apache.org> 2010-04-06 17:04:01 UTC ---
(In reply to comment #0)
>
> When trying to set svg path attributes via a stylesheet, the resulting shape is
> only displayed when the pdf is created from the intermediate fo file.
> If I skip the fo part and create the pdf directly the shape is not displayed.
> Same goes for the internal (-awt) viewer.
This is not a FOP issue.
The cause is that you are creating the attribute in no-namespace. If the
intermediate FO is serialized and parsed again, that attribute is interpreted
to be in the namespace of the parent element.
However, if the SAX events are triggered directly onto the target
ContentHandler you get the effect as if the input were:
<svg xmlns="http://www.w3.org/2000/svg" width="1.5cm" height="1.5cm">
<polygon style="fill: #cccccc;" nn:points="..." xmlns:nn=""></polygon>
</svg>
Notice that the points attribute is in a different namespace than the polygon
element, since the XSLT processor is not aware of the changed mapping for the
default namespace in the literal result tree fragment.
IIC, the recommended solution to get the result you desire, is to change your
XSLT to look like:
<xsl:stylesheet ... xmlns:svg="http://www.w3.org/2000/svg">
...
<svg:svg width="1.5cm" height="1.5cm">
<svg:polygon style="fill: #cccccc;">
<xsl:attribute name="svg:points"><xsl:value-of
select="points"/></xsl:attribute>
</svg:polygon>
</svg:svg>
Alternatively, if you really do not want to declare the SVG namespace on the
xsl:stylesheet element, the following would also work:
<svg xmlns="http://www.w3.org/2000/svg" width="1.5cm" height="1.5cm">
<polygon style="fill: #cccccc;">
<xsl:attribute name="points" namespace="http://www.w3.org/2000/svg">
<xsl:value-of select="points"/>
</xsl:attribute>
</polygon>
</svg>
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.