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

RE: XSL formatting

Subject: RE: XSL formatting
From: "Shailesh Shinde" <shailesh@xxxxxxxxxxxx>
Date: Mon, 26 Dec 2005 18:18:40 +0530
xsl format variable
Thanks a lot! It's working fine.

-----Original Message-----
From: George Cristian Bina [mailto:george@xxxxxxxxxxxxx] 
Sent: Friday, December 23, 2005 9:48 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re:  XSL formatting

No, you need to code that in a more generic way. Something like below 
should work:

<xsl:transform version="1.0" 
   <xsl:template match="/imgBook">
         <table border="1">
           <xsl:for-each select="*">
               <xsl:value-of select="name()"/>
           <xsl:for-each select=".//img">
             <xsl:variable name="p" select="position()"/>
             <xsl:if test="/imgBook/*/img[$p]">
               <xsl:variable name="pos" select="position()"/>
                 <xsl:for-each select="/imgBook/*">
                     <xsl:value-of select="img[$pos]/@name"/>

Best Regards,
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger

Shailesh Shinde wrote:
> 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>

Current Thread


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.
First Name
Last Name
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.