Solved

XSLT 2 column layout

Posted on 2010-09-17
4
485 Views
Last Modified: 2013-11-18
Hello,

I am new to XSL formatting. Thanks for your help in advance.

I have this XML file that I am trying to convert using xslt.

I have grouped the xml data into group by section.

The issue that I have is i am getting the results in a single column .
I would like to get in a 2 column layout.

I am attaching the xsl file that I am working on.

xml:
<Collection>
 <Content>
    <ID>100</ID>
    <Type>Content</Type>
    <Title>English test</Title>
    <QuickLink>http://google.com</QuickLink>
    <Html>
      <root>
        <issueDate>2010-08-15</issueDate>
        <BodyTitle>test</BodyTitle>
        <section>English</section>
              </root>
    </Html>
    <StartDate>1/1/2010</StartDate>

  </Content>
  <Content>
    <ID>101</ID>
    <Type>Content</Type>
    <Title>Physics Test</Title>
    <QuickLink>http://yahoo.com</QuickLink>
 
    <Html>
      <root>
        <issueDate>2010-08-31</issueDate>
        <BodyTitle>Physics In Brief</BodyTitle>
       
        <section>Physics</section>
       
      </root>
    </Html>
    <StartDate>1/1/2010</StartDate>

  </Content>
  <Content>
    <ID>102</ID>
    <Type>Content</Type>
    <Title>French</Title>
    <QuickLink>http://xml.net</QuickLink>
   
    <Html>
      <root>
        <issueDate>2010-08-31</issueDate>
        <BodyTitle>French rules</BodyTitle>
        <section>French</section>
     
      </root>
    </Html>
    <StartDate>1/1/2010</StartDate>

  </Content>
 
 
</Collection>


I am attaching the xsl file that I am working on .

testxsl.txt
0
Comment
Question by:all_experts
  • 2
  • 2
4 Comments
 
LVL 3

Expert Comment

by:VeganBen
ID: 33707557
You're outputting to HTML, so why not use the browser to sort out column widths.

Wrap everything in a DIV called twoColumns and add this to your CSS:


div#twoColumns {
      -moz-column-count: 2;
      -moz-column-gap: 20px;
      -webkit-column-count: 2;
      -webkit-column-gap: 20px;
      column-count: 2;
      column-gap: 20px;
}
0
 
LVL 1

Author Comment

by:all_experts
ID: 33713528
Hello VeganBen,

Thanks for your help.I have tried using your code but still it is not rendering the list properly.

It is a css 3 property and still not being implemented in the browsers.

Correct me if I am wrong.,
0
 
LVL 1

Accepted Solution

by:
all_experts earned 0 total points
ID: 33719256
Hello VeganBen,

Thanks for the help I was able to get that using xsl:attribute
0
 
LVL 3

Expert Comment

by:VeganBen
ID: 33741347
Glad you got it working.
It is a CSS property that is supported by Firefox, Safari and Chrome.

Oh, you mean IE? Do you count that as a web browser?
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

778 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question