[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: how to mix two trees

Subject: RE: how to mix two trees
From: Jarno.Elovirta@xxxxxxxxx
Date: Mon, 7 Oct 2002 15:42:47 +0300
trees mix
Hi,

> hello, I am having a headache on starting XSLT, and I have to do the 
> following:
> given a tree like:
> <result>
>     <exercise>
>         <row>
>             <exercise_id>1</exercise_id>
>             <exercise_title>XSLT Foo</exercise_title>
>             <exercise_question>
>             She sells sea sehells on the ____<question_1 />. <br />
>             Fuzzy wuzzy was a _____<question_2 />
>             </exercise_question>
>         </row>
>     </exercise>
>     <questions>
>         <row>
>             <question_id>1</question_id>
>             <question_order>1</question_order>
>             <question_options>
>                 <item>Seashore</item>
>                 <item>Pier</item>
>             </question_options>
>         </row>
>         <row>
>             <question_id>1</question_id>
>             <question_order>2</question_order>
>             <question_options>
>                 <item>anemone</item>
>                 <item>bear</item>
>                 <item>butterfly</item>
>             </question_options>
>         </row>
>     </questions>      
> </result>
> I'd have to reconstruct the result in HTML, substituting the 
> <question_ 
> /> tags in he exercise with the <row> contents belongingto  the 
> corresponding <question_order>.
> Note: the XML design can be changed(any places on where to learn good 
> XML design?), but we will always have these result sets with one 
> exercise having one or more questions in it.

Change the <question_1 /> elements to e.g. <question-ref id="2" />, then write an identity transformation, with a template that will match question-ref elements, and in that template, fetch the corresponding row element.

Cheers,

Jarno

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread
  • RE: how to mix two trees
    • Jarno . Elovirta - Mon, 7 Oct 2002 08:46:21 -0400 (EDT) <=
      • <Possible follow-ups>
      • DPawson - Mon, 7 Oct 2002 09:06:35 -0400 (EDT)

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.