xsl:copy-of works for copying elements, but they do not get displayed in SVG




12 years ago
12 years ago


(Reporter: Maciej Jaros, Unassigned)



Firefox Tracking Flags

(Not tracked)



(4 attachments)



12 years ago
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; pl; rv: Gecko/20060728 Firefox/
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; pl; rv: Gecko/20060728 Firefox/

I thought that it was a bug in XSLT, but it doesn't seem so...

What I wanted to do is to simply copy part of an XML document and display it with as an SVG image (i'll post a test case in a minute). The elements didn't got displayed, but when I viewed the generated source it was all there.

That's about it, but just to note - <xsl:copy-of...> works if the document is outputed as a HTML (just tried to copy the contents of a table).

Reproducible: Always

Steps to Reproduce:
1.View XML

Comment 1

12 years ago
Created attachment 240036 [details]
XML file to be transformed

Comment 2

12 years ago
Created attachment 240037 [details]
XSLT that should display two circles (displays one that is in XSLT, not the one that is copied)
I think you have the xmlns='http://www.w3.org/2000/svg' in the wrong place. It needs to be part of the <svg> element that you output.

Comment 4

12 years ago
I belive I tried all possible variations including
<xsl:element name="svg" namespace="...">
But I'm not 100% sure, so one might check on that.

Besides if one circle gets displayed then I belive they all should.

Comment 5

12 years ago
Created attachment 240626 [details]
kind of a workaround stylesheet for people that want to copy some contents as SVG

I've just tried to add the namespace inside svg element, but both versions give me this (viewed as a generated source):

<svg xmlns="http://www.w3.org/2000/svg" width="200px" height="200px"><circle cx="10" cy="10" r="5"/><circle cx="30" cy="10" r="5"/></svg>

Interesting thing is that this bug is also in Opera... That's why I've checked XSL recomendation and it is not really clear about that to me, but it seems that the copied circle have no namespace as it have no namespace in the original XML document...

Anyway after some experiments I've found that there is way to make it work. So I'm creating this attachment.

Comment 6

12 years ago
Created attachment 240627 [details]
Another XML that works with the XSL attached above.

Comment 7

12 years ago
OK. After an explanation from one of XSL recommendation editors I found that this is not a bug really as the first XML file must be transformed to:
<svg xmlns="http://www.w3.org/2000/svg" width="200px" height="200px">
     <circle cx="10" cy="10" r="5"/>
     <circle xmlns="" cx="30" cy="10" r="5"/>

Still when I put the namespace into the XML doucument it doesn't work as I would like, but as there is also a way to make it work, then I guess I can live with that ;).
Last Resolved: 12 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.