XSLT extracting certain descendants to higher level outside of ancestor

R

rbrunn

Hi all,

I'm trying to write a XSL-transformation which converts AI-exported
SVG-Files to be more compatible with firefox. Namely I want to extract
gradients which are declared inside of symbol tags to a higher level.
(https://bugzilla.mozilla.org/show_bug.cgi?id=353575)

i.e.

....
<svg...>
....
<symbol>
...
<...>
...
<linearGradient...>
...
</linearGradient>
...
</...>
...
</symbol>
....
</svg>
....



shall be converted to:

....
<svg...>
....
<linearGradient...>
...
</linearGradient>
<symbol>
...
<...>
...
</...>
...
</symbol>
....
</svg>
....

Is this possible? Even if the descendant I want to extract is no direct
child of symbol?

Thanks,
Ronnie
 
J

Joseph Kesselman

Is this possible? Even if the descendant I want to extract is no direct
child of symbol?

Sure. The template for symbol needs to first find and process
//linearGradient, then process all the other descendants but discard the
linearGradient elements. This presumes that you won't have <svg> inside
<svg>; that would make things slightly more complicated. Depending on
what you're doing, the template which does the match-and-discard may
need to be under control of a mode, but that may not be true for the
simple case you've described.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,006
Messages
2,570,265
Members
46,861
Latest member
SanoraS48

Latest Threads

Top