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

help for number-rows-spanned

Subject: help for number-rows-spanned
From: ying xing <xingyin@xxxxxxxxx>
Date: Mon, 23 Jan 2006 13:36:10 -0800 (PST)
number rows spanned
I have a problem generating an table with the
number-rows-spanned attribute, what I want to see is
the following:

C1       |c2       |c3       |c4       |c5       |c6
-------- |-------- |-------- |-------- |--------
|---------
Key      |data2    |data3    |data4    |data5   
|data6
         |-------- |-------- |-------- |--------
|---------
         |subject:           |data4    |data5   
|data6
         |subject test to be |-------- |--------
|---------
         |wrapped here when  |data4    |data5   
|data6
         |too long           |-------- |--------
|---------
         |                   |data4    |data5   
|data6
-------- |-------- |-------- |-------- |--------
|---------

So I used number-rows-spanned to do this, the problem
is that both key field and subject field are trucated
to show only one line, the rests are not showing, does
anybody have any idea how this happends?

Here is my code:

xml:
    <record>
      <key>Key</key>
      <subject>Subject to be wrapped</subject>
      <data2>data2</data2>
      <data3>data3</data3>
      <data4>data4.1</data4>
      <data5>data5.1</data5>
      <data6>data6.1</data6>
      <data_count>3</data_count>

      <data4_1>data4.2</data4_1>
      <data5_1>data5.2</data5_1>
      <data6_1>data6.2</data6_1>
      <more_data>
        <data_set>
          <data4>data4.3</data4>
          <data5>data5.3</data5>
          <data6>data6.3</data6>        
        </data_set>
        <data_set>
          <data4>data4.4</data4>
          <data5>data5.4</data5>
          <data6>data6.4</data6>        
        </data_set>
      </more_data>
    </record>

xsl:
  <xsl:template match="record">
  
    <xsl:variable name="data_count">
      <xsl:value-of select="data_count"/>
    </xsl:variable>
        
    <xsl:variable name="subject_colspan">
      <xsl:choose>
        <xsl:when test="$data_count = 0">
           <xsl:value-of select="5"/>
        </xsl:when>
        <xsl:otherwise>
           <xsl:value-of select="2"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>    

    <xsl:variable name="subject_rowspan">
      <xsl:choose>
        <xsl:when test="$data_count &lt; 2">
           <xsl:value-of select="1"/>
        </xsl:when>
        <xsl:otherwise>
           <xsl:value-of select="$data_count"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>

    <fo:table-row background-color="#F0F0FF"
border="0.5pt solid black">
      <fo:table-cell
number-rows-spanned="{($subject_rowspan)+1}"
text-align="left"  border-width=".1mm"
border-style="solid" border-color="black"
padding="2pt" padding-left="2pt" padding-right="2pt"> 
    
        <fo:block font-size="9pt" line-height="1.2"
overflow="visible" hyphenate="true" language="en">
          <xsl:value-of select="key"/>
        </fo:block>
      </fo:table-cell>
      
      <fo:table-cell text-align="left" 
border-width=".1mm" border-style="solid"
border-color="black" padding="2pt" padding-left="2pt"
padding-right="2pt">
        <fo:block font-size="9pt" line-height="1.2"
overflow="visible" hyphenate="true" language="en">
          <xsl:value-of select="data2"/>
        </fo:block>
      </fo:table-cell>
      
      <fo:table-cell text-align="left" 
border-width=".1mm" border-style="solid"
border-color="black" padding="2pt" padding-left="2pt"
padding-right="2pt">
        <fo:block font-size="9pt" line-height="1.2"
overflow="visible"  hyphenate="true" language="en">
          <xsl:value-of select="data3"/>
        </fo:block>
      </fo:table-cell>
      
      <fo:table-cell text-align="left" 
border-width=".1mm" border-style="solid"
border-color="black" padding="2pt" padding-left="2pt"
padding-right="2pt">
        <fo:block font-size="9pt" line-height="1.2"
overflow="visible"  hyphenate="true" language="en">
          <xsl:value-of select="data4"/>
        </fo:block>
      </fo:table-cell>

      <fo:table-cell text-align="left" 
border-width=".1mm" border-style="solid"
border-color="black" padding="2pt" padding-left="2pt"
padding-right="2pt">
        <fo:block font-size="9pt" line-height="1.2"
overflow="visible"  hyphenate="true" language="en">
          <xsl:value-of select="data5"/>
        </fo:block>
      </fo:table-cell>

      <fo:table-cell text-align="left" 
border-width=".1mm" border-style="solid"
border-color="black" padding="2pt" padding-left="2pt"
padding-right="2pt">
        <fo:block font-size="9pt" line-height="1.2"
overflow="visible"  hyphenate="true" language="en">
          <xsl:value-of select="data6"/>
        </fo:block>
      </fo:table-cell>   
    </fo:table-row>
    
    <fo:table-row background-color="#F0F0FF">
      <fo:table-cell text-align="left"
border-collapse="separate"
number-columns-spanned="{$subject_colspan}"
number-rows-spanned="{$subject_rowspan}" 
border-width=".1mm" border-style="solid"
border-color="black" padding="2pt" padding-left="2pt"
padding-right="2pt">
        <fo:block font-size="9pt" font-weight="bold"
line-height="1.2" overflow="visible"  hyphenate="true"
language="en">Subject: </fo:block>
        <fo:block font-size="9pt" line-height="1.2"
overflow="visible"  hyphenate="true" language="en">
          <xsl:value-of select="subject"/>
        </fo:block>
      </fo:table-cell>
      
      <xsl:if test="$data_count &gt; 0">
      <fo:table-cell text-align="left" 
border-width=".1mm" border-style="solid"
border-color="black" padding="2pt" padding-left="2pt"
padding-right="2pt">
        <fo:block font-size="9pt" line-height="1.2"
overflow="visible"  hyphenate="true" language="en">
          <xsl:value-of select="data4_1"/> 
        </fo:block>
      </fo:table-cell>

      <fo:table-cell text-align="left" 
border-width=".1mm" border-style="solid"
border-color="black" padding="2pt" padding-left="2pt"
padding-right="2pt">
        <fo:block font-size="9pt" line-height="1.2"
overflow="visible"  hyphenate="true" language="en">
          <xsl:value-of select="data5_1"/>
        </fo:block>
      </fo:table-cell>

      <fo:table-cell text-align="left" 
border-width=".1mm" border-style="solid"
border-color="black" padding="2pt" padding-left="2pt"
padding-right="2pt">
        <fo:block font-size="9pt" line-height="1.2"
overflow="visible"  hyphenate="true" language="en">
          <xsl:value-of select="data6_1"/>
        </fo:block>
      </fo:table-cell>    
      </xsl:if>
    </fo:table-row>
    
      <xsl:apply-templates select="more_data"/>
    
  </xsl:template>
  
  <xsl:template match="more_data">
  <xsl:apply-templates/>
  </xsl:template>
  
  <xsl:template match="data_set">
    <fo:table-row background-color="#F0F0FF">
      <fo:table-cell starts-row="false"
text-align="left"  border-width=".1mm"
border-style="solid" border-color="black"
padding="2pt" padding-left="2pt" padding-right="2pt">
        <fo:block font-size="9pt" line-height="1.2"
overflow="visible"  hyphenate="true" language="en">
          <xsl:value-of select="data4"/> 
        </fo:block>
      </fo:table-cell>

      <fo:table-cell text-align="left" 
border-width=".1mm" border-style="solid"
border-color="black" padding="2pt" padding-left="2pt"
padding-right="2pt">
        <fo:block font-size="9pt" line-height="1.2"
overflow="visible"  hyphenate="true" language="en">
          <xsl:value-of select="data5"/>
        </fo:block>
      </fo:table-cell>

      <fo:table-cell text-align="left" 
border-width=".1mm" border-style="solid"
border-color="black" padding="2pt" padding-left="2pt"
padding-right="2pt">
        <fo:block font-size="9pt" line-height="1.2"
overflow="visible"  hyphenate="true" language="en">
          <xsl:value-of select="data6"/>
        </fo:block>
      </fo:table-cell>    
    </fo:table-row>
  </xsl:template>



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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.