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

Re: two column table with alternating row colors using

Subject: Re: two column table with alternating row colors using xsl xml and css
From: nicholse@xxxxxxxxxxxxxxxx
Date: Sat, 9 Aug 2003 00:47:35 -0700 (PDT)
xsl two columns
The most progress yet. Still some problems.
I cant get the following-sibling to display individual elements only the *
works. I suspect my understanding of xpath is the problem. I want the
second two columns to format like the first two. Also if there is no data
for phone number I want to prevent the () from displaying. For this I
tried when test phone-number but this still outputs the (). Why?
Eric
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fmp="http://www.filemaker.com/fmpdsoresult"
exclude-result-prefixes="fmp">
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes" />
<xsl:template match="fmp:FMPDSORESULT">
<STYLE>
<!-- this is just an example, you can change this to whatever you like -->
.r0 { background-color: silver; color: black; width: 50%;}
.r1 { color: gray; width: 50%;}
</STYLE>
<TABLE>
  <xsl:for-each select="fmp:ROW[position() &lt;= ceiling(count(../fmp:ROW)
div 2)]">
   <xsl:sort select="fmp:Co" />
    <TR class="r{position() mod 2}">
      <TD class="r{position() mod 2}">
	<B><xsl:value-of select="fmp:Co" /></B><BR />
	<xsl:value-of select="fmp:Address1" /><BR />
	<xsl:value-of select="fmp:City1" />, <xsl:value-of select="fmp:State1" />
<xsl:value-of select="fmp:Zip1" />
	<BR />
	</TD>
        <xsl:choose>
          <xsl:when test="fmp:Phone1_Number">
            <TD class="r{position() mod 2}">
              (<xsl:value-of select="fmp:Phone1_Area_Code" />)
              <xsl:value-of select="fmp:Phone1_Number" />
              <BR />
            </TD>
          </xsl:when>
          <xsl:otherwise>
            <TD class="r{position() mod 2}"></TD>
          </xsl:otherwise>
        </xsl:choose>
      <TD class="r{position() mod 2}">
        <xsl:choose>
          <xsl:when test="following-sibling::fmp:ROW">
            <xsl:value-of
select="following-sibling::*[ceiling(count(../fmp:ROW) div
2)]"/>
          </xsl:when>
          <xsl:otherwise>&#160;</xsl:otherwise>
        </xsl:choose>
      </TD>
      <TD class="r{position() mod 2}">
      </TD>
    </TR>
  </xsl:for-each>
</TABLE>
</xsl:template>
</xsl:stylesheet>

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.