Connecting Tech Pros Worldwide Forums | Help | Site Map

XSL Display a Table

Newbie
 
Join Date: Sep 2009
Posts: 18
#1: Sep 14 '09
Q) How to display all the records of a table using xsl?

Solution applied -->
Suppose a class "test" has an attribute "test1" which itself is a table. "test1"
contains some a1, a2, a3 attributes. I need to display all rows based on the value of an attribute"a1"

Expand|Select|Wrap|Line Numbers
  1. <xsl:template name="rowCounter">
  2.   <xsl:param name="N" />
  3.   <tr>
  4.     <xsl:if test="
  5.       DBE:Attribute[@name='a1']/
  6.       DBE:Object[@Class='test']/
  7.       DBE:Attribute[@name='test1']/
  8.       DBE:Table/
  9.       DBE:TableRow[ $N ]
  10.     "> 
  11.       <xsl:for-each select="
  12.         DBE:Attribute[@name='a1']/
  13.         DBE:Object[@Class='test']/
  14.         DBE:Attribute [@name='test1']/
  15.         DBE:Table
  16.       ">
  17.         <td>          
  18.           <xsl:apply-templates select="DBE:TableRow[ $N ]"/>
  19.         </td>
  20.         <xsl:text> </xsl:text>
  21.       </xsl:for-each>
  22.       <xsl:call-template name="rowCounter">
  23.         <xsl:with-param name="N" select="$N + 1"/>
  24.       </xsl:call-template>
  25.     </xsl:if>
  26.   </tr>
  27. </xsl:template>
Is the above correct? How do I display values of a1, a2 and a3 for each a1?

Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,662
#2: Sep 14 '09

re: XSL Display a Table


Quote:

Originally Posted by prao2005 View Post

Is the above correct?

does it work?

Quote:

Originally Posted by prao2005 View Post

How do I display values of a1, a2 and a3 for each a1?

by using loops.
Newbie
 
Join Date: Sep 2009
Posts: 18
#3: Sep 14 '09

re: XSL Display a Table


Not printing values at present....
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,662
#4: Sep 14 '09

re: XSL Display a Table


I’m fishing in the dark without the relevant XML/XSL.
Reply