p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

xslt thread: RE: Another xsl:sort question


Message #1 by wiwaniec@n... on Sun, 1 Sep 2002 05:39:32
Hi,

  I have this problem.  I m displaying a report using xsl. Its working fine
just one problem. I want to display my report something like this :

Countrywide Independent Advisers
[Network]       [AR Firm Name]       [AR Firm Status]        [Complaince
Consultant ]        [Investment Adviser]
   CIA                Dickeson Ty..             Live
karthik1                                  johnny
   CIA                Dickeson Ty..             Live
karthik1                                  richard


Kestel

[Network]       [AR Firm Name]       [AR Firm Status]        [Complaince
Consultant ]        [Investment Adviser]
   KES                ARFirm12                    Live
karthik1                                  IA124

But if you run the below code it doesnt it repleat the Column Names which is
not what i want.  I want the column name to be repeated only based on the
type of Network, i.e CIA or KES.

  Any solution, suggestions, improvement in the code are welcome.

  Have a great day.

karthikeyan.

XML source file : karthik.xml
~~~~~~~~~~~~~~~~~~~~~~~~

<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="karthik2.xsl"?>
<Recordset>
 <row>
  <Network>CIA</Network>
  <ARFirmName>Dickeson Taylor Financial Services Ltd</ARFirmName>
  <ARFirmStatus>Live</ARFirmStatus>
  <NetworkSupervisor>karthik1</NetworkSupervisor>
  <InvestmentAdviser>johnny</InvestmentAdviser>
  <InvestmentAdviserStatus>Applicant Active</InvestmentAdviserStatus>
  <Role>CF21</Role>
  <FromDate>1/1/1990</FromDate>
  <ToDate>1/1/2000</ToDate>
 </row>
 <row>
  <Network>CIA</Network>
  <ARFirmName>Dickeson Taylor Financial Services Ltd</ARFirmName>
  <ARFirmStatus>Live</ARFirmStatus>
  <NetworkSupervisor>karthik1</NetworkSupervisor>
  <InvestmentAdviser>richard</InvestmentAdviser>
  <InvestmentAdviserStatus>Initial Lead Active</InvestmentAdviserStatus>
  <Role>CF21</Role>
  <FromDate>1/1/1990</FromDate>
  <ToDate>1/1/2000</ToDate>
 </row>
 <row>
  <Network>KES</Network>
  <ARFirmName>ARFirm12</ARFirmName>
  <ARFirmStatus>Live</ARFirmStatus>
  <NetworkSupervisor>karthik1</NetworkSupervisor>
  <InvestmentAdviser>IA124</InvestmentAdviser>
  <InvestmentAdviserStatus>Initial Lead Active</InvestmentAdviserStatus>
  <Role>CF21</Role>
  <FromDate>1/1/1990</FromDate>
  <ToDate>1/1/2000</ToDate>
 </row>
</Recordset>

=============================================

XSL source file : karthik.xsl
~~~~~~~~~~~~~~~~~~~~~~

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet[
<!ENTITY nbsp "&#160;">
]>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:param name="mynetwork1">Kestel</xsl:param>
<xsl:param name="mynetwork2">Countrywide Independent Advisers</xsl:param>
  <xsl:template match="/">
    <html>
     <head>
      <title></title>
     </head>
     <body>
     <table border="1">
      <tbody>
                                        <!-- <xsl:apply-templates
select="Recordset"/>-->
                                        <xsl:call-template name="RowsValue">
                                          <xsl:with-param name="mynetwork1"
select="$mynetwork1" />
                                          <xsl:with-param name="mynetwork2"
select="$mynetwork2" />
                                        </xsl:call-template>
      </tbody>
     </table>
     </body>
    </html>
  </xsl:template>

<!--  <xsl:template match="Recordset">-->
<xsl:template name="RowsValue">
<xsl:param name="mynetwork1" />
<xsl:param name="mynetwork2" />
         <xsl:for-each select="/Recordset/row">
              <xsl:choose>
                       <xsl:when test="Network = 'CIA' ">
       <tr>
        <th colspan="8" align="LEFT"><xsl:value-of
select="$mynetwork2"/></th>
       </tr>
              <tr>
        <th>Network</th>
        <th>AR Firm Name</th>
        <th>AR Firm Status</th>
        <th>Compliance Consultant</th>
        <th>Investment Adviser</th>
        <th>Investment Adviser Status</th>
        <th>Role</th>
        <th>Number of Advisers</th>
       </tr>

                       </xsl:when>
                       <xsl:otherwise>
       <tr>
        <th colspan="8" align="LEFT"><xsl:value-of
select="$mynetwork1"/></th>
       </tr>
       <tr>
        <th>Network</th>
        <th>AR Firm Name</th>
        <th>AR Firm Status</th>
        <th>Compliance Consultant</th>
        <th>Investment Adviser</th>
        <th>Investment Adviser Status</th>
        <th>Role</th>
        <th>Number of Advisers</th>
       </tr>

                       </xsl:otherwise>
       </xsl:choose>


       <tr>
                 <td bgcolor="CYAN"> <xsl:value-of select="Network"/></td>
          <td><xsl:value-of select="ARFirmName"/></td>
          <td><xsl:value-of select="ARFirmStatus"/></td>
          <td><xsl:value-of select="NetworkSupervisor"/></td>
          <td><xsl:value-of select="InvestmentAdviser"/></td>
          <td><xsl:value-of select="InvestmentAdviserStatus"/></td>
          <td><xsl:value-of select="Role"/></td>
          <td>&nbsp;</td>
       </tr>
                                          </xsl:for-each>

  </xsl:template>
</xsl:stylesheet>

=====================================================



  Return to Index