XSLT extracting certain descendants to higher level outside of ancestor

Discussion in 'XML' started by rbrunn@think-cell.com, Oct 27, 2006.

  1. Guest

    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
    , Oct 27, 2006
    #1
    1. Advertising

  2. Re: XSLT extracting certain descendants to higher level outside ofancestor

    wrote:
    > 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.

    --
    Joe Kesselman / Beware the fury of a patient man. -- John Dryden
    Joseph Kesselman, Oct 27, 2006
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. pabbu
    Replies:
    8
    Views:
    720
    Marc Boyer
    Nov 7, 2005
  2. Replies:
    2
    Views:
    366
  3. Jason Lillywhite

    Class#descendants?

    Jason Lillywhite, Aug 12, 2009, in forum: Ruby
    Replies:
    17
    Views:
    189
    Duck Typist
    Sep 3, 2009
  4. Tom Ten Thij
    Replies:
    2
    Views:
    113
    Tom Ten Thij
    Feb 23, 2010
  5. Tom de Neef

    How to create descendants of Array class?

    Tom de Neef, Mar 17, 2008, in forum: Javascript
    Replies:
    7
    Views:
    140
    Richard Cornford
    Mar 24, 2008
Loading...

Share This Page