Recursive xslt expansion

Discussion in 'XML' started by Hallvard B Furuseth, Jan 4, 2007.

  1. Can I have one XSLT style sheet which expands some brief XML to a longer
    "normalized" form, which one of several other XSLT style sheets expands
    further (or one of several parts of one sheet)? Finally, I'll render it
    with a CSS style sheet. Or is there some other way one normally does
    that?

    E.g. in this xml:

    <library>
    <author a_id="me" name="Myself"/>
    <series s_id="mine" name="My series">
    <by a_ref="me"/>
    <omnibus name="Foobar">
    <with>You</with>
    <novel name="Foobar #1"/>
    <novel name="Foobar #3"> <by name="Her"/> </novel>
    <novel name="Foobar #2"> <with name="Him"/> </novel>
    </omnibus>
    </series>
    </library>

    outer <by>s are inherited if there is no other <by> to use at a level,
    while <with> adds a new <by> to the currently active <by>s. Also, not
    sure if I'll implement this but here author names not directly inside
    <library> are dragged out to <library> and given an a_id. So the above
    expands to (maybe with numbered new a_ids rather than those shown here):

    <library>
    <author a_id="me" name="Myself"/>
    <!-- Author IDs generated from authors without IDs: -->
    <author a_id="id_You" name="You"/>
    <author a_id="id_Her" name="Her"/>
    <author a_id="id_Him" name="Him"/>
    <series s_id="mine" name="My series">
    <by a_ref="me"/>
    <omnibus name="Foobar">
    <by a_ref="me"/>
    <by a_ref="id_You"/>
    <novel name="Foobar #1">
    <by a_ref="me"/>
    <by a_ref="id_You"/>
    </novel>
    <novel name="Foobar #3">
    <by a_ref="id_Her"/>
    </novel>
    <novel name="Foobar #2">
    <by a_ref="me"/>
    <by a_ref="id_You"/>
    <by a_ref="id_Him"/>
    </novel>
    </omnibus>
    </series>
    </library>

    which is then expanded further by some other sheet.

    --
    Hallvard
    Hallvard B Furuseth, Jan 4, 2007
    #1
    1. Advertising

  2. Hallvard B Furuseth wrote:
    > Can I have one XSLT style sheet which expands some brief XML to a longer
    > "normalized" form, which one of several other XSLT style sheets expands
    > further (or one of several parts of one sheet)? Finally, I'll render it
    > with a CSS style sheet. Or is there some other way one normally does
    > that?


    You can chain XSLT transformations as long as the stylesheets transform
    to XML respectively don't depend on stuff like disable-output-escaping.
    The last stylesheet in the chain can then transform to HTML.

    Using one stylesheet to do several transformation passes is also
    possible with XSLT 1.0 but only if the XSLT processsor supports an
    extension function like exsl:node-set to transform a result tree
    fragment to a node set so that each pass creates a result tree fragment,
    the extension functions then creates a temporary node set on which the
    next pass works.



    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
    Martin Honnen, Jan 4, 2007
    #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. yurick

    Recursive XSLT processing

    yurick, Dec 2, 2003, in forum: XML
    Replies:
    0
    Views:
    362
    yurick
    Dec 2, 2003
  2. poofpoof
    Replies:
    2
    Views:
    597
    poofpoof
    Aug 13, 2004
  3. Replies:
    4
    Views:
    514
  4. n00m
    Replies:
    12
    Views:
    1,101
  5. vamsi
    Replies:
    21
    Views:
    2,046
    Keith Thompson
    Mar 9, 2009
Loading...

Share This Page