aspose file tools*
The moose likes XML and Related Technologies and the fly likes how to control the html layout according to the input data within XSL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "how to control the html layout according to the input data within XSL" Watch "how to control the html layout according to the input data within XSL" New topic
Author

how to control the html layout according to the input data within XSL

Porky Liu
Greenhorn

Joined: Jan 30, 2002
Posts: 22
suppose you get the xml file as this:
<Company1>
<Section11>
...
<Section12>
<Company2>
<Section21>
...
<Section22>
...


How to transfer it into HTML, with two tables with equal section number, such as this

Company1 Company2
. Section11 . Section22
. Section12 Company3
Company2 . Section31
. Section21 . Section32

If simply go straight with xsl:if, it got the trouble with well-form

So any idea to deal with such issue?
Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
Hello Porky,
Could you please post your full xml structure using UBB tags [ code ] [/ code ], You can see UBB code buttons just below the Add reply button and post your code.

Also don't post the complete xml data, just post its structure in full form, which might help other folks to have a look and may help you.


Spritle Software Blogs
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Originally posted by Balaji Loganathan:
Also don't post the complete xml data, just post its structure in full form, which might help other folks to have a look and may help you.

Yep, it's definitely nicer to look at two sample "records" instead of browsing through hundreds of them, which are next to identical to each other anyway...


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Porky Liu
Greenhorn

Joined: Jan 30, 2002
Posts: 22
First, thanks for you guys suggestion

I would like to clear the issue here.

The xml waiting for transform is like this:



Now I want to transform a file like this to a html with a table. The table has two columns, and each one embodies the equal number's manager.

The target html page would like this:



You see, each column has a list with four managers. if possible, we are expected to split the section, and show it on two column just like the example above.

Actually, I have got a reasonable idea today.
First I would count the number of manager totally,here it's 8(So the issue coming, how to calculate it? I have tried to use position(), last(), count(), and it seems all these function is calculated based on the special context, in other way, how to calculate the node's number in golbal?)

then loop it

The xsl file I hold currently is:



Any suggest?

[ July 07, 2004: Message edited by: Porky Liu ]
[ July 07, 2004: Message edited by: Porky Liu ]
 
jQuery in Action, 2nd edition
 
subject: how to control the html layout according to the input data within XSL