This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: exit <xsl:for-each> or change <xsl:variable>


ok, 

Here is the actual problem. If the processor comes across a $next-table$
cell it should:

          <xsl:if test="(cell[1]/data)='$next-table$'">
            </table><table border="1">
          </xsl:if>

but that is not possible is it. Is there a way to do this? I would like to
end the current table and start a new one when the value '$next-table$'
shows up.
  
Matts Isuls

-------------------
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
 <xsl:template match="/">
  <html>
   <table border="1">
    <xsl:for-each select="/root/table/row">
     <xsl:if test="(cell[1]/data)='$next-table$'">
      <!-- </table><table border="1"> -->
     </xsl:if>
     <tr>
      <xsl:for-each select="cell">
       <td> 
        <xsl:value-of select="data"/>
       </td>
      </xsl:for-each>
     </tr>
    </xsl:for-each>
   </table>
  </html>    
 </xsl:template>
</xsl:stylesheet>
-------------------

-------------------
<?xml version="1.0"?>
<root>
<table>
 <row>
  <cell><data>r1c1</data></cell>
  <cell><data>r1c2</data></cell>
  <cell><data>r1c3</data></cell>
  <cell><data>r1c4</data></cell>
 </row>
 <row>
  <cell><data>r2c1</data></cell>
  <cell><data>r2c2</data></cell>
  <cell><data>r2c3</data></cell>
  <cell><data>r2c4</data></cell>
 </row>
 <row>
  <cell><data>r3c1</data></cell>
  <cell><data>r3c2</data></cell>
  <cell><data>r3c3</data></cell>
  <cell><data>r3c4</data></cell>
 </row>
 <row>
  <cell><data>$next-table$</data></cell>
  <cell><data></data></cell>
  <cell><data></data></cell>
  <cell><data></data></cell>
 </row>
 <row>
  <cell><data>r1c1</data></cell>
  <cell><data>r1c2</data></cell>
  <cell><data>r1c3</data></cell>
  <cell><data>r1c4</data></cell>
  <cell><data>r1c5</data></cell>
 </row>
 <row>
  <cell><data>r2c1</data></cell>
  <cell><data>r2c2</data></cell>
  <cell><data>r2c3</data></cell>
  <cell><data>r2c4</data></cell>
  <cell><data>r2c5</data></cell>
 </row>
</table>
</root>
-------------------

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]