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

RE: GUI layout mechanism in XSLT

Subject: RE: GUI layout mechanism in XSLT
From: cknell@xxxxxxxxxx
Date: Wed, 05 Jan 2005 10:13:17 -0500
xml gui layout
Production Rules:
The problem here isn't writing the XSL tranformation, but in correctly defining the rules for producing the output from the input.

These are the production rules that I infer from your source and output samples. Please look them over and confirm, correct, or elaborate on them. I have not been able to determine your rule for producing a new "tr" element. Please explain how you determine when to produce a new row.

1) The "hgroup" that is the immediate child of the document root should produce a "table" element that will be the root element of the output document.

2) A "vgroup" child of an "hgroup" element indicates a column that will extend over one or more rows of the output table, the number being equal to the number of "item" children of the "vgroup" element.

3) "item" elements that are children of "vgroup" elements should be transformed into the first "td" element in as many succeeding rows in the output table as there are "item" elements.

4) "hgroup" elements that are children of "vgroup" elements should be transformed into "td" elements with an attribute of "colspan" whose value is the integer equal to the number of child "item" elements the "hgroup" element has, and the value of the element should be equal to the value of the first "item" child of the "hgroup" element. Subsequent "item" children of the "hgroup" element are to be transformed similarly, but into successive "tr" elements.

-- 
Charles Knell
cknell@xxxxxxxxxx - email



-----Original Message-----
From:     Ilya Boyandin <ilyabo@xxxxxxxxx>
Sent:     Wed, 5 Jan 2005 11:49:39 +0100
To:       xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject:   GUI layout mechanism in XSLT

Hello All!

I'm trying to implement a simple GUI layout mechanism with XSLT
without much success for now. The problem is that the task requires to
produce an output tree, which structure differs significantly from the
original tree, and in which the elements are likely to be presented in
a different order.

Here's the problem description:

The input is a GUI elements tree. Elements are contained in horizontal
or vertical groups. Naturally, groups can contain other groups. For
instance:

<hgroup>
<vgroup>
  <item>A1</item>
  <item>A2</item>
</vgroup>
<vgroup>
  <item>B1</item>
  <item>B2</item>
  <hgroup>
    <item>B3</item>
    <item>C3</item>
  </hgroup>
</vgroup>
</hgroup>

The output must be one plain table (without nested tables!) in which
the elements are layed out the same as in the input tree. So for the
input tree above the output should be something like this:

<table>
<tr>
  <td>A1</td>
  <td colspan="2">B1</td>
</tr>
<tr>
  <td>A2</td>
  <td colspan="2">B2</td>
</tr>
<tr>
  <td> </td>
  <td>B3</td>
  <td>C3</td>
</tr>
</table>

As I am a newbie, I don't see an obvious solution. I'd be very
thankful if somebody could give me a hint or in the worst case make it
clear that the problem cannot be solved with XSLT alone.

Thank you!
Ilya

Current Thread

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.