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

Re: Changing table output from horizontal to vertical

Subject: Re: Changing table output from horizontal to vertical
From: "Mark" <mark@xxxxxxxxxxxx>
Date: Sun, 18 Sep 2011 10:09:14 -0700
Re:  Changing table output from horizontal to vertical
I modified the template to be language specific,
<xsl:template match="Item[(position()-1) mod 3 = 0 and @lang eq 'en'] ">
but this does not create a table with a 'lang' attribute. I do not know how to modify my calling code to achieve the desired effect:


<table class="motif">
            <xsl:apply-templates/>
           </table>

And, of course, it still outputs horizontally.
Mark
-----Original Message----- From: Mark
Sent: Sunday, September 18, 2011 9:50 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Changing table output from horizontal to vertical


Hi,
I am using an XSLT template to produce an XHTML table. Currently, the
stylesheet fills the table in a horizontal direction; I would like to fill
the table in a vertical direction. The data is in two languages, but my
XHTML exposes only one language at a time. Because I currently have 27
<Item> elements in each language, each list of <Items> by language currently
consists of three columns of nine <Items>. However, the number of <Items>
could change. My current template, with its input and output, is shown
below.

Also, it would be very helpful to put the English in one table and the Czech
in another (move the 'lang' attribute from the <h4> to the <table>).

Suggestions on how to do this would be greatly appreciated.
Thanks,
Mark

My Template:
<xsl:template match="Item[(position()-1) mod 3 = 0]">
   <tr>
     <td>
       <xsl:element name="h4">
         <xsl:attribute name="lang" select="@lang"/>
         <xsl:element name="a">
           <xsl:attribute name="href" select="@file"/>
           <xsl:value-of select="@concept"/>
         </xsl:element>
       </xsl:element>
     </td>

     <xsl:for-each select="following-sibling::node()[position() &lt; 3]">
       <td>
         <xsl:element name="h4">
           <xsl:attribute name="lang" select="@lang"/>
           <xsl:element name="a">
             <xsl:attribute name="href" select="@file"/>
             <xsl:value-of select="@concept"/>
           </xsl:element>
         </xsl:element>
       </td>
     </xsl:for-each>
   </tr>
My XML input.
<List>
<!-- Czech -->
 <Item concept="DalE!C- tC)ma" lang="cz" file="other-themes.htm"/>
 <Item concept="DomC!ci zvC-Eata" lang="cz" file="pets.htm"/>
 <Item concept="DDtem" lang="cz" file="for-children.htm"/>
 <Item concept="FilatelistickC) vC=stavy" lang="cz"
file="philatelic-exhibitions.htm"/>
 <Item concept="HistorickC=ch vozidel" lang="cz"
file="historic-vehicles.htm"/>
 <Item concept="Humor" lang="cz" file="humor.htm"/>
 <Item concept="KrC!lovskC) rodiny" lang="cz" file="royalty.htm"/>
 <Item concept="KulturnC- poklady" lang="cz" file="national-treasures.htm"/>
 <Item concept="MezinC!rodnC- oslavy" lang="cz"
file="international-celebrations.htm"/>
 <Item concept="NC!boE>enskC) pEedmDty" lang="cz"
file="religious-subjects.htm"/>
 <Item concept="Ochrana pEC-rody" lang="cz" file="conservation.htm"/>
 <Item concept="Organizace" lang="cz" file="organizations.htm"/>
 <Item concept="PolitickC) udC!losti" lang="cz" file="political-events.htm"/>
 <Item concept="Pozdravy a blahopEC!nC-" lang="cz"
file="greetings-and-congratulations.htm"/>
 <Item concept="SbDratelstvC-" lang="cz" file="collecting.htm"/>
 <Item concept="SlavnC- lidC)" lang="cz" file="personalities.htm"/>
 <Item concept="SportovnC-" lang="cz" file="sports.htm"/>
 <Item concept="StC!tnC- symboly" lang="cz" file="national-emblems.htm"/>
 <Item concept="TechnickC) pamC!tky" lang="cz"
file="technical-monuments.htm"/>
 <Item concept="TC)mata EUROPA" lang="cz" file="europa-themes.htm"/>
 <Item concept="UmDleckC! Eemesla" lang="cz" file="handicrafts.htm"/>
 <Item concept="UmDnC- na znC!mkC!ch" lang="cz" file="art-on-stamps.htm"/>
 <Item concept="Velikonce" lang="cz" file="easter.htm"/>
 <Item concept="VC!noce" lang="cz" file="christmas.htm"/>
 <Item concept="VC=platnC- znC!mky" lang="cz" file="definitive-issues.htm"/>
 <Item concept="ZnC!mky na znC!mkC!ch" lang="cz" file="stamps-on-stamps.htm"/>
 <Item concept="E=eleznice" lang="cz" file="railways.htm"/>
<!-- English -->
 <Item concept="Art on Stamps" lang="en" file="art-on-stamps.htm"/>
 <Item concept="Christmas" lang="en" file="christmas.htm"/>
 <Item concept="Collecting" lang="en" file="collecting.htm"/>
 <Item concept="Conservation" lang="en" file="conservation.htm"/>
 <Item concept="Definitive Issues" lang="en" file="definitive-issues.htm"/>
 <Item concept="EUROPA Themes" lang="en" file="europa-themes.htm"/>
 <Item concept="Easter" lang="en" file="easter.htm"/>
 <Item concept="For Children" lang="en" file="for-children.htm"/>
 <Item concept="Greetings and Congratulations" lang="en"
file="greetings-and-congratulations.htm"/>
 <Item concept="Handicrafts" lang="en" file="handicrafts.htm"/>
 <Item concept="Historic Vehicles" lang="en" file="historic-vehicles.htm"/>
 <Item concept="Humor" lang="en" file="humor.htm"/>
 <Item concept="International Celebrations" lang="en"
file="international-celebrations.htm"/>
 <Item concept="National Emblems" lang="en" file="national-emblems.htm"/>
 <Item concept="National Treasures" lang="en"
file="national-treasures.htm"/>
 <Item concept="Organizations" lang="en" file="organizations.htm"/>
 <Item concept="Other Themes" lang="en" file="other-themes.htm"/>
 <Item concept="Personalities" lang="en" file="personalities.htm"/>
 <Item concept="Pets" lang="en" file="pets.htm"/>
 <Item concept="Philatelic Exhibitions" lang="en"
file="philatelic-exhibitions.htm"/>
 <Item concept="Political Events" lang="en" file="political-events.htm"/>
 <Item concept="Railways" lang="en" file="railways.htm"/>
 <Item concept="Religious Subjects" lang="en"
file="religious-subjects.htm"/>
 <Item concept="Royalty" lang="en" file="royalty.htm"/>
 <Item concept="Sports" lang="en" file="sports.htm"/>
 <Item concept="Stamps on Stamps" lang="en" file="stamps-on-stamps.htm"/>
 <Item concept="Technical Monuments" lang="en"
file="technical-monuments.htm"/>
</List>
My Output:
<table class="motif">

              <tr>
                 <td>
                    <h4 lang="cz">
                       <a href="other-themes.htm">DalE!C- tC)ma</a>
                    </h4>
                 </td>
                 <td>
                    <h4 lang="cz">

                       <a href="pets.htm">DomC!ci zvC-Eata</a>
                    </h4>
                 </td>
                 <td>
                    <h4 lang="cz">
                       <a href="for-children.htm">DDtem</a>
                    </h4>
                 </td>

              </tr>
              <tr>
                 <td>
                    <h4 lang="cz">
                       <a href="philatelic-exhibitions.htm">FilatelistickC)
vC=stavy</a>
                    </h4>
                 </td>
                 <td>

                    <h4 lang="cz">
                       <a href="historic-vehicles.htm">HistorickC=ch
vozidel</a>
                    </h4>
                 </td>
                 <td>
                    <h4 lang="cz">
                       <a href="humor.htm">Humor</a>
                    </h4>

                 </td>
              </tr>
              <tr>
                 <td>
                    <h4 lang="cz">
                       <a href="royalty.htm">KrC!lovskC) rodiny</a>
                    </h4>
                 </td>

                 <td>
                    <h4 lang="cz">
                       <a href="national-treasures.htm">KulturnC-
poklady</a>
                    </h4>
                 </td>
                 <td>
                    <h4 lang="cz">
                       <a href="international-celebrations.htm">MezinC!rodnC-
oslavy</a>

                    </h4>
                 </td>
              </tr>
              <tr>
                 <td>
                    <h4 lang="cz">
                       <a href="religious-subjects.htm">NC!boE>enskC)
pEedmDty</a>
                    </h4>

                 </td>
                 <td>
                    <h4 lang="cz">
                       <a href="conservation.htm">Ochrana pEC-rody</a>
                    </h4>
                 </td>
                 <td>
                    <h4 lang="cz">

                       <a href="organizations.htm">Organizace</a>
                    </h4>
                 </td>
              </tr>
              <tr>
                 <td>
                    <h4 lang="cz">
                       <a href="political-events.htm">PolitickC)
udC!losti</a>

                    </h4>
                 </td>
                 <td>
                    <h4 lang="cz">
                       <a href="greetings-and-congratulations.htm">Pozdravy
a blahopEC!nC-</a>
                    </h4>
                 </td>
                 <td>

                    <h4 lang="cz">
                       <a href="collecting.htm">SbDratelstvC-</a>
                    </h4>
                 </td>
              </tr>
              <tr>
                 <td>
                    <h4 lang="cz">

                       <a href="personalities.htm">SlavnC- lidC)</a>
                    </h4>
                 </td>
                 <td>
                    <h4 lang="cz">
                       <a href="sports.htm">SportovnC-</a>
                    </h4>
                 </td>

                 <td>
                    <h4 lang="cz">
                       <a href="national-emblems.htm">StC!tnC- symboly</a>
                    </h4>
                 </td>
              </tr>
              <tr>
                 <td>

                    <h4 lang="cz">
                       <a href="technical-monuments.htm">TechnickC)
pamC!tky</a>
                    </h4>
                 </td>
                 <td>
                    <h4 lang="cz">
                       <a href="europa-themes.htm">TC)mata EUROPA</a>
                    </h4>

                 </td>
                 <td>
                    <h4 lang="cz">
                       <a href="handicrafts.htm">UmDleckC! Eemesla</a>
                    </h4>
                 </td>
              </tr>
              <tr>

                 <td>
                    <h4 lang="cz">
                       <a href="art-on-stamps.htm">UmDnC- na znC!mkC!ch</a>
                    </h4>
                 </td>
                 <td>
                    <h4 lang="cz">
                       <a href="easter.htm">Velikonce</a>

                    </h4>
                 </td>
                 <td>
                    <h4 lang="cz">
                       <a href="christmas.htm">VC!noce</a>
                    </h4>
                 </td>
              </tr>

              <tr>
                 <td>
                    <h4 lang="cz">
                       <a href="definitive-issues.htm">VC=platnC- znC!mky</a>
                    </h4>
                 </td>
                 <td>
                    <h4 lang="cz">

                       <a href="stamps-on-stamps.htm">ZnC!mky na
znC!mkC!ch</a>
                    </h4>
                 </td>
                 <td>
                    <h4 lang="cz">
                       <a href="railways.htm">E=eleznice</a>
                    </h4>
                 </td>

              </tr>
              <tr>
                 <td>
                    <h4 lang="en">
                       <a href="art-on-stamps.htm">Art on Stamps</a>
                    </h4>
                 </td>
                 <td>

                    <h4 lang="en">
                       <a href="christmas.htm">Christmas</a>
                    </h4>
                 </td>
                 <td>
                    <h4 lang="en">
                       <a href="collecting.htm">Collecting</a>
                    </h4>

                 </td>
              </tr>
              <tr>
                 <td>
                    <h4 lang="en">
                       <a href="conservation.htm">Conservation</a>
                    </h4>
                 </td>

                 <td>
                    <h4 lang="en">
                       <a href="definitive-issues.htm">Definitive
Issues</a>
                    </h4>
                 </td>
                 <td>
                    <h4 lang="en">
                       <a href="europa-themes.htm">EUROPA Themes</a>

                    </h4>
                 </td>
              </tr>
              <tr>
                 <td>
                    <h4 lang="en">
                       <a href="easter.htm">Easter</a>
                    </h4>

                 </td>
                 <td>
                    <h4 lang="en">
                       <a href="for-children.htm">For Children</a>
                    </h4>
                 </td>
                 <td>
                    <h4 lang="en">

                       <a
href="greetings-and-congratulations.htm">Greetings and Congratulations</a>
                    </h4>
                 </td>
              </tr>
              <tr>
                 <td>
                    <h4 lang="en">
                       <a href="handicrafts.htm">Handicrafts</a>

                    </h4>
                 </td>
                 <td>
                    <h4 lang="en">
                       <a href="historic-vehicles.htm">Historic
Vehicles</a>
                    </h4>
                 </td>
                 <td>

                    <h4 lang="en">
                       <a href="humor.htm">Humor</a>
                    </h4>
                 </td>
              </tr>
              <tr>
                 <td>
                    <h4 lang="en">

                       <a
href="international-celebrations.htm">International Celebrations</a>
                    </h4>
                 </td>
                 <td>
                    <h4 lang="en">
                       <a href="national-emblems.htm">National Emblems</a>
                    </h4>
                 </td>

                 <td>
                    <h4 lang="en">
                       <a href="national-treasures.htm">National
Treasures</a>
                    </h4>
                 </td>
              </tr>
              <tr>
                 <td>

                    <h4 lang="en">
                       <a href="organizations.htm">Organizations</a>
                    </h4>
                 </td>
                 <td>
                    <h4 lang="en">
                       <a href="other-themes.htm">Other Themes</a>
                    </h4>

                 </td>
                 <td>
                    <h4 lang="en">
                       <a href="personalities.htm">Personalities</a>
                    </h4>
                 </td>
              </tr>
              <tr>

                 <td>
                    <h4 lang="en">
                       <a href="pets.htm">Pets</a>
                    </h4>
                 </td>
                 <td>
                    <h4 lang="en">
                       <a href="philatelic-exhibitions.htm">Philatelic
Exhibitions</a>

                    </h4>
                 </td>
                 <td>
                    <h4 lang="en">
                       <a href="political-events.htm">Political Events</a>
                    </h4>
                 </td>
              </tr>

              <tr>
                 <td>
                    <h4 lang="en">
                       <a href="railways.htm">Railways</a>
                    </h4>
                 </td>
                 <td>
                    <h4 lang="en">

                       <a href="religious-subjects.htm">Religious
Subjects</a>
                    </h4>
                 </td>
                 <td>
                    <h4 lang="en">
                       <a href="royalty.htm">Royalty</a>
                    </h4>
                 </td>

              </tr>
              <tr>
                 <td>
                    <h4 lang="en">
                       <a href="sports.htm">Sports</a>
                    </h4>
                 </td>
                 <td>

                    <h4 lang="en">
                       <a href="stamps-on-stamps.htm">Stamps on Stamps</a>
                    </h4>
                 </td>
                 <td>
                    <h4 lang="en">
                       <a href="technical-monuments.htm">Technical
Monuments</a>
                    </h4>

                 </td>
              </tr>
           </table>

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.