Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Recursive xslt expansion

Reply
Thread Tools

Recursive xslt expansion

 
 
Hallvard B Furuseth
Guest
Posts: n/a
 
      01-04-2007
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
 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      01-04-2007
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/
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Recursive functions Vs Non-recursive functions - performance aspect vamsi C Programming 21 03-09-2009 10:53 PM
Two recursive calls inside of a recursive function n00m C++ 12 03-13-2008 03:18 PM
XSLT Recursive Reversal of Ancestry alex.maddern@gmail.com XML 4 10-18-2007 08:21 PM
XSLT : hierarchy recursive problem...help poofpoof XML 2 08-13-2004 11:31 AM
Recursive XSLT processing yurick XML 0 12-02-2003 10:23 PM



Advertisments