xsl-list
[Top] [All Lists]

RE: XSL formatting

2005-12-23 04:15:26
Hi,

What if there are more than two columns, does the below mentioned xsl will
work. 

<xsl:transform version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
   <xsl:template match="/imgBook">
     <html>
       <head>
         <title>Sample</title>
       </head>
       <body>
         <table border="1">
           <tr>
             <td>missing</td>
             <td>redundant</td>

                 <td>c_match</td>
               <td>sv</td>
             <td>pn</td>
           </tr>
           <xsl:for-each select="missing/img">
             <xsl:variable name="pos" select="position()"/>
             <tr>
               <td>
                 <xsl:value-of select="@name"/>
               </td>
               <td>
                 <xsl:value-of select="../../redundant/img[$pos]/@name"/>
               </td>

               <td>
                 <xsl:value-of select="../../c_match/img[$pos]/@name"/>
               </td>
               <td>
                 <xsl:value-of select="../../sv/img[$pos]/@name"/>
               </td>
               <td>
                 <xsl:value-of select="../../pn/img[$pos]/@name"/>
               </td>
             </tr>
           </xsl:for-each>
           <xsl:variable name="mc" select="count(missing/img)"/>
                What needs to be count for missing?

                
                For other columns below will work just change the column
name and add <td/>, is this right?

           <xsl:for-each select="redundant/img[position()>$mc]">
             <tr>
               <td/>
               <td>
                 <xsl:value-of select="@name"/>
               </td>
             </tr>
           </xsl:for-each>




         </table>
       </body>
     </html>
   </xsl:template>
</xsl:transform>














-----Original Message-----
From: George Cristian Bina [mailto:george(_at_)oxygenxml(_dot_)com] 
Sent: Friday, December 23, 2005 3:15 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] XSL formatting

Hi,

Adding an additional for-each that will iterate on the img elements from 
the redundant element that do not have a corresponding img in missing 
should do it:

<xsl:transform version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
   <xsl:template match="/imgBook">
     <html>
       <head>
         <title>Sample</title>
       </head>
       <body>
         <table border="1">
           <tr>
             <td>missing</td>
             <td>redundant</td>
           </tr>
           <xsl:for-each select="missing/img">
             <xsl:variable name="pos" select="position()"/>
             <tr>
               <td>
                 <xsl:value-of select="@name"/>
               </td>
               <td>
                 <xsl:value-of select="../../redundant/img[$pos]/@name"/>
               </td>
             </tr>
           </xsl:for-each>
           <xsl:variable name="mc" select="count(missing/img)"/>
           <xsl:for-each select="redundant/img[position()>$mc]">
             <tr>
               <td/>
               <td>
                 <xsl:value-of select="@name"/>
               </td>
             </tr>
           </xsl:for-each>
         </table>
       </body>
     </html>
   </xsl:template>
</xsl:transform>

---------------------------------------------------------------------
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com


Shailesh Shinde wrote:
Hi,

Same number of images are not there in both missing and redundant.

Thanks,
Shailesh


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--





--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>