Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


How to convert table from column to row order?

From: "LJB" <.>
To: NULL
Date: 8/10/2006 9:38:00 AM

I have xsl to produce an html table but the table is arranged such that 
columns read top to bottom. I need assistance changing this to read in rows 
across. I'd like four columns by however many rows similar to what I already 
have. Items in the first row would be B001, B002, B003 & B004. Row two would 
contain B016, B017, B023 & B034. Even a link to a simple example doing this 
would be appreciated. What I've found so far seems very complex to me and 
I'm having difficulty modifying it for my use.

Another question would it be possible to pass just the drawing node selected 
by "following-sibling::Drawing[x * $NumRows]" to the template rather than 
individually referencing its text nodes.

thanks,
LJB

-----------xsl-------------
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

 <xsl:template match="/">

 <xsl:variable name="NumRows"
  select="ceiling(count(//Drawing) div 4)"/>

 <TABLE>
 <xsl:for-each select="//Drawing[position() &lt;= $NumRows]">
 <TR>

 <xsl:call-template name="TableCell">
 <xsl:with-param name="Number" select="Number"/>
 <xsl:with-param name="Title" select="Title"/>
 </xsl:call-template>

 <xsl:call-template name="TableCell">
 <xsl:with-param name="Number"
  select="following-sibling::Drawing[$NumRows]/Number"/>
 <xsl:with-param name="Title"
  select="following-sibling::Drawing[$NumRows]/Title"/>
 </xsl:call-template>

 <xsl:call-template name="TableCell">
 <xsl:with-param name="Number"
  select="following-sibling::Drawing[2 * $NumRows]/Number"/>
 <xsl:with-param name="Title"
  select="following-sibling::Drawing[2 * $NumRows]/Title"/>
 </xsl:call-template>

 <xsl:call-template name="TableCell">
 <xsl:with-param name="Number"
  select="following-sibling::Drawing[3 * $NumRows]/Number"/>
 <xsl:with-param name="Title"
  select="following-sibling::Drawing[3 * $NumRows]/Title"/>
 </xsl:call-template>

 </TR>
 </xsl:for-each>
 </TABLE>
 </xsl:template>

 <xsl:template name="TableCell">
  <xsl:param name="Number"/>
  <xsl:param name="Title"/>
  <!-- simple html stuff here
   <TD> more stuff </TD>
  -->
 </xsl:template>
</xsl:stylesheet>

-----------xml-------------
<?xml version="1.0"?>
<Drawings>
<Drawing>
<Number>B001</Number><Title>TYPICAL WASHER</Title>
</Drawing>
<Drawing>
<Number>B002</Number><Title>TYPICAL CLEVIS</Title>
</Drawing>
<Drawing>
<Number>B003</Number><Title>TYPICAL EYEBOLT</Title>
</Drawing>
<Drawing>
<Number>B004</Number><Title>TYP BRACING STRUT</Title>
</Drawing>
<Drawing>
<Number>B016</Number><Title>CLEVIS CONN</Title>
</Drawing>
<Drawing>
<Number>B017</Number><Title>CLEVIS CONN</Title>
</Drawing>
<Drawing>
<Number>B023</Number><Title>WINDPST TOP</Title>
</Drawing>
<Drawing>
<Number>B034</Number><Title>ROOF BRACING</Title>
</Drawing>
<Drawing>
<Number>B060</Number><Title>PRTL COL</Title>
</Drawing>
<Drawing>
<Number>B061</Number><Title>PRTL COL</Title>
</Drawing>
<Drawing>
<Number>B088</Number><Title>CLEVIS CONN</Title>
</Drawing>
<Drawing>
<Number>B099</Number><Title>LOWER CLEVIS</Title>
</Drawing>
<Drawing>
<Number>B100</Number><Title>LOER EYEBOLT</Title>
</Drawing>
<Drawing>
<Number>B101</Number><Title>UPPER CLEVIS</Title>
</Drawing>
<Drawing>
<Number>B102</Number><Title>UPPER EYEBOLT</Title>
</Drawing>
<Drawing>
<Number>B103</Number><Title>BRACE CLEVIS</Title>
</Drawing>
<Drawing>
<Number>B104</Number><Title>BRACE EYEBOLT</Title>
</Drawing>
<Drawing>
<Number>B105</Number><Title>EW BRAC CLIP</Title>
</Drawing>
<Drawing>
<Number>B106</Number><Title>EW BRAC CLIP</Title>
</Drawing>
<Drawing>
<Number>B107</Number><Title>EW BRAC CLIP</Title>
</Drawing>
</Drawings> 




transparent
Print
Mail
Digg
delicious
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent