Re: [xsl] rowspan and colspan

Subject: Re: [xsl] rowspan and colspan
From: omprakash.v@xxxxxxxxxxxxx
Date: Tue, 2 Aug 2005 10:56:41 +0530
Hi,
       Your xslt shows a template matching "lhp:index" but there is no such
element in your xml. I suppose you meant for that to be the outermost
element in your input xml.

Anyways, rowspan and colspan are attributes applied to table columns. But
you have the rowspan attribute on the lhp:Row element. Which columns should
the rowspan be applied to. When I ran your stylesheet on your xml, I could
see columns 1,2 and 3 ( check, when and owner) as needing rowspan. If your
xml doesn't change and you know how many rows and cols you have then this
should be mentioned in your xml somewhere.

Cheers,
prakash











                                                                                                                                       
                      cookie king                                                                                                      
                      <cookieking@comc         To:      xsl-list@xxxxxxxxxxxxxxxxxxxxxx                                                
                      ast.net>                 cc:      (bcc: omprakash.v/Polaris)                                                     
                                               Subject: [xsl] rowspan and colspan                                                      
                      08/02/2005 06:59                                                                                                 
                      AM                                                                                                               
                      Please respond                                                                                                   
                      to xsl-list                                                                                                      
                                                                                                                                       
                                                                                                                                       




Hello fellow developers. I am turing to the group again in hope to
resolve another issue. I am finding it difficult, maybe impossible to
merge cells. thru xml and xsl i an taking data and outputing it into a
table layout. sometimes i need to do a rowspan or colspan. i have tried
to create a template to handle this but no luck. sample files below. the
node  <lhp:Row rowspan="6"> is the one at this time i am trying to span.
but i just cant figure this out. thanks to all the masters that post to
this site

cookie

merge.xsl

<!-- ***************************** -->

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; xmlns:lhp="hhscors">
<xsl:output method="html"/>
<!-- *** -->

<!-- INCLUDE FILE -->
<!--  <xsl:include href="/_borders/bottom.htm"/> -->
<!-- *** -->
<!-- *** -->
<xsl:template match="lhp:index">
 <html xmlns:mso="urn:schemas-microsoft-com:office:office"
xmlns:msdt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882">
  <head>
   <meta http-equiv="Content-Type" content="text/html; "/>
   <meta name="author" content="Larry Pfaff"/>
   <title>Due Diligence - DADS</title>
<!-- *** -->
<!-- *** -->
   <style>
            table.table td {
   border: 1px solid #595F91; }
   </style>
   <!-- START RELATIVE LINKS -->
   <link rel="stylesheet" type="text/css" href="/css/styles.css"/>
   <script language="JavaScript" src="/JavaScript/functions.js"/>
   <script language="JavaScript" src="/JavaScript/trail.js"/>
   <!-- END RELATIVE LINKS -->
<!-- *** -->
<!-- *** -->
  </head>
<!-- *** -->
<!-- *** -->
  <body class="mapblock" topmargin="0">
   <!--  START BACK-TO-TOP LINK SCRIPT REFERENCE -->
   <script src="/JavaScript/TrueDriftBottom.js"/>
   <!--  END BACK-TO-TOP LINK SCRIPT REFERENCE -->
   <!--  START TRAIL SCRIPT REFERENCE -->
   <!--  END TRAIL SCRIPT REFERENCE -->
   <div id="trailMenu" style="position:absolute; left:0px; top:2px">
    <script language="JavaScript" type="text/javascript">
document.write(makeTrailMenu());
</script>
   </div>
   <!--  END TRAIL SCRIPT REFERENCE -->
   <p class="description">Acronyms Listings
      </p>
   <p class="updated">Updated:
<script type="text/javascript">writeDateModified (true);</script>
   </p>
       <table class="table">
     <!-- *** -->
     <!-- *** -->
     <col/>
     <col/>
     <tr>
      <th width="15%">Check</th>
      <th width="15%">When</th>
      <th width="15%">Owner</th>
      <th width="15%">Who</th>
      <th width="15%">Vendor</th>

     </tr>
     <!-- *** -->
     <!-- *** -->
     <xsl:apply-templates/>
    </table>
   <!-- INCLUDE FILE -->
   <!--      <xsl:call-template name="Content"/> -->
   <!--  -->
  </body>
 </html>
</xsl:template>
<xsl:template match="lhp:entry">
 <xsl:apply-templates select="document(concat(.,'.xml'))"/>
</xsl:template>
<xsl:template match="lhp:Root/lhp:Row">

   <xsl:for-each select="title">
    <tr><th colspan="5"
style="text-align:center"><xsl:apply-templates/></th></tr>
   </xsl:for-each>
   <tr>
  <xsl:attribute name="class"><xsl:choose><xsl:when test="position() mod
2 = 1">tablerowon</xsl:when><xsl:when test="position() mod 2 =
0">tablerowoff</xsl:when></xsl:choose></xsl:attribute>
  <td class="class">
  <xsl:apply-templates select="check" />

  </td>
  <td class="class">
  <xsl:apply-templates select="when" />

  </td>
  <td class="class">
  <xsl:apply-templates select="owner" />

  </td>
  <td class="class">
  <xsl:apply-templates select="who" />

  </td>
  <td class="class">
   <xsl:apply-templates select="vendor" />     </td>

 </tr>
</xsl:template>
<xsl:template match="p">
 <p>
  <xsl:apply-templates/>
 </p>
</xsl:template>
<xsl:template match="br">

  <xsl:apply-templates/>
 <br />
</xsl:template>
<xsl:template match="bullist">
 <ul>
  <xsl:apply-templates/>
 </ul>
</xsl:template>
<xsl:template match="numlist">
 <ol>
  <xsl:apply-templates/>
 </ol>
</xsl:template>
<xsl:template match="item">
 <li>
  <xsl:for-each select="p">
   <xsl:apply-templates/>
  </xsl:for-each>
  <xsl:for-each select="bullist">
   <ul>
    <xsl:apply-templates/>
   </ul>
  </xsl:for-each>
  <xsl:for-each select="numlist">
   <ol>
    <xsl:apply-templates/>
   </ol>
  </xsl:for-each>
 </li>
</xsl:template>

<xsl:template match="emph">
 <xsl:choose>
 <xsl:when test="@type[.='red']">
   <font color="#ff0000">
    <xsl:apply-templates/>
   </font>
  </xsl:when>
  <xsl:when test="@type[.='blue']">
   <font color="#0000cc">
    <xsl:apply-templates/>
   </font>
  </xsl:when>
  <xsl:when test="@type[.='b']">
   <b>
    <xsl:apply-templates/>
   </b>
  </xsl:when>
  <xsl:when test="@type[.='i']">
   <i>
    <xsl:apply-templates/>
   </i>
  </xsl:when>
  <xsl:when test="@type[.='bi']">
   <b>
    <i>
     <xsl:apply-templates/>
    </i>
   </b>
  </xsl:when>
  <xsl:when test="@type[.='bu']">
   <b>
    <u>
     <xsl:apply-templates/>
    </u>
   </b>
  </xsl:when>
  <xsl:when test="@type[.='iu']">
   <i>
    <u>
     <xsl:apply-templates/>
    </u>
   </i>
  </xsl:when>
  <xsl:when test="@type[.='biu']">
   <b>
    <i>
     <u>
      <xsl:apply-templates/>
     </u>
    </i>
   </b>
  </xsl:when>
  <xsl:when test="@type[.='u']">
   <u>
    <xsl:apply-templates/>
   </u>
  </xsl:when>
 </xsl:choose>
</xsl:template>
<!--  <xsl:template match="Row">
 <td>
    <xsl:if test="@rowspan[.!='']">
<xsl:attribute name="rowspan"><xsl:value-of
select="@rowspan"/></xsl:attribute>
    </xsl:if>
    <xsl:apply-templates/>
</td>
</xsl:template>
-->
<xsl:template match="url">

 <a>
     <xsl:attribute name="href"><xsl:value-of
select="@link"/></xsl:attribute>
  <xsl:attribute name="title"><xsl:value-of
select="@link"/></xsl:attribute>
  <xsl:attribute name="target"><xsl:value-of
select="@target"/></xsl:attribute>
  <xsl:value-of select="."/>
 </a>
  </xsl:template>

</xsl:stylesheet>
<!-- END xsl -->

sample.xml

<!-- ***************************** -->

<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSPY v2004 rel. 4 U (http://www.xmlspy.com) by kookie
(karat) -->
<lhp:Root xmlns:lhp="hhscors">
<lhp:Row>
 <title>Due Diligence - DADS</title>
</lhp:Row>
<lhp:Row>
 <check>ABLE - Level 2 </check>
 <when>Pre-Screen </when>
 <owner>
  <emph type="i">access</emph>HR R&amp;S Specialist </owner>
 <who>On entry-level direct care job classes:  <bullist>
   <item>
    <p>MHMR Services Asst. I, II, III</p>
   </item>
   <item>
    <p>MHMR Supervisor</p>
   </item>
   <item>
    <p>Medical Aide I, II, III</p>
   </item>
   <item>
    <p>Therapist Technician I - V</p>
   </item>
  </bullist>
 </who>
 <vendor>
  <emph type="i">pan</emph>
  <p>
   <url link="https://etestingnetwork.com/hhsc/admin.asp";
target="_blank">etestingnetwork.com</url>
  </p>
 </vendor>
</lhp:Row>
<lhp:Row>
 <check>
  <url>Felony Check</url> if indicated in Application </check>
 <when>Pre-Screen </when>
 <owner>
  <emph type="i">access</emph>HR R&amp;S Specialist </owner>
 <who>All job classes located at state schools/ MR facilities </who>
 <vendor>Visual review of application and compare to <url>Absolute Bars
to Employment</url> Job Aid </vendor>
</lhp:Row>
<lhp:Row>
 <check>Abuse Check </check>
 <when>Prior to interview </when>
 <owner>HR </owner>
 <who>All job classes located at state schools/ MR facilities </who>
 <vendor>CANRS  <p>
   <url protocal="/Systems/Recruitmax/MP/EditDueDiligence.htm"
target="_blank">Edit Due Diligence</url>
  </p> in the Applicant Profile </vendor>
</lhp:Row>
<lhp:Row>
 <check>Background Check of Qualifications of Physician Applicants </check>
 <when>Prior to interview </when>
 <owner>Hiring Manager </owner>
 <who>Each applicant for positions </who>
 <vendor>HR0105 <p>
   <url protocal="/Systems/Recruitmax/MP/EditDueDiligence.htm"
target="_blank">Edit Due Diligence</url>
  </p> in the Applicant Profile </vendor>
</lhp:Row>
<lhp:Row>
 <check>
  <emph type="red">Criminal Background Check</emph>
 </check>
 <when>After Conditional Job Offer </when>
 <owner>
  <emph type="i">access</emph>HR R&amp;S Specialist initiates request
HHSC HR </owner>
 <who>All job classes located at state schools/ MR facilities </who>
 <vendor>
  <p>Initiate criminal background check using the Criminal Background
Check template</p>
  <p>Request is submitted to DPS and results are forwarded to the Hiring
Manager</p>
  <p>Hiring Manager will edit due diligence</p>
 </vendor>
</lhp:Row>
<lhp:Row>
 <check>Driver License Verification </check>
 <when>After Conditional Job Offer </when>
 <owner>Hiring Manager </owner>
 <who>All selected applicants who are applying for a position that
requires state vehicle as stated on the job description or job posting
request     <p>
   <emph type="b"> Includes CDL</emph>
  </p>    All selected CDL driver applicants as stated on the job
description or job posting request          </who>
 <vendor>Hiring Manager verifies applicants have valid Drivers License /
CDL License
 <p>
   <url protocal="/Systems/Recruitmax/MP/EditDueDiligence.htm"
target="_blank">Edit Due Diligence</url>
  </p> in the Applicant Profile</vendor>
</lhp:Row>
<lhp:Row>
 <check>Driving Record Check </check>
 <when>After Conditional Job Offer </when>
 <owner>
  <emph type="i">access</emph>HR R&amp;S Specialist advises Applicant
</owner>
 <who>Completed on all selected driver applicants </who>
 <vendor>
  <emph type="i">access</emph>HR R&amp;S will initiate by advising
applicant to go to Local Driver License office and request printout of
his/her Driving Record.
  <p>Applicant will provide to Hiring Manager, who will send to HR;
optional to include in Selection Package</p>
  <p>
   <url protocal="/Systems/Recruitmax/MP/EditDueDiligence.htm"
target="_blank">Edit Due Diligence</url>
  </p> in the Applicant Profile</vendor>
</lhp:Row>
<lhp:Row>
 <check>
  <url>Drug Test </url>
 </check>
 <when>After Conditional Job Offer </when>
 <owner>
  <emph type="i">access</emph>HR R&amp;S Specialist </owner>
 <who>All job classes located at state schools/ MR facilities </who>
 <vendor>Forward Edge
 <p>
   <emph type="i">access</emph>HR R&amp;S Specialist</p>
  <bullist>
   <item>
    <p>provides most convenient collection sites name, address,
telephone number and hours of operation to Applicant and advises him/her
to bring photo ID</p>
   </item>
   <item>
    <p>completes <url>Drug Screen Authorization Form</url> and forwards
via fax or email to collection site</p>
   </item>
  </bullist>
  <p>Results are returned to 2 designated Staffing Specialists who will
<url protocal="/Systems/Recruitmax/MP/EditDueDiligence.htm"
target="_blank">Edit Due Diligence</url>
  </p>
 </vendor>
</lhp:Row>
<lhp:Row>
 <check>
  <emph type="red">Fingerprint Test</emph>
 </check>
 <when>After Conditional Job Offer and after start date </when>
 <owner>
  <emph type="i">access</emph>HR R&amp;S Specialist initiates </owner>
 <who>All job classes located at state schools / MR facilities who have
lived out of Texas for <emph type="b">two</emph> years prior to
applying  </who>
 <vendor>
  <emph type="i">access</emph>HR R&amp;S Specialist:
  <bullist>
   <item>
    <p>contacts Applicant and advises the need for the Fingerprint
Screen</p>
   </item>
   <item>
    <p>mails the Fingerprint card with pre-addressed envelop to DPS to
the Applicant</p>
   </item>
  </bullist>
  <p>DPS forwards to FBI</p>
  <p>Results are returned to HHSC HR who edits due diligence</p>
  <p>Process can take 7-10 days</p>
 </vendor>
</lhp:Row>
<lhp:Row>
 <check>
  <url>Education and Transcript Verification </url>
 </check>
 <when>Prior to Job Offer </when>
 <owner>
  <emph type="i">access</emph>HR R&amp;S Specialist advises applicant to
request and submit transcripts </owner>
 <who>
  <p>All job classes where the selecting authority lists specific
education requirements as an initial selection criteria</p>
  <p>Must be stated on the job description or job posting request </p>
 </who>
 <vendor>
  <emph type="i">access</emph>HR R&amp;S Specialist advises Applicant to
request and submit transcripts </vendor>
</lhp:Row>
<lhp:Row>
 <check>
  <url>Employee Misconduct</url> and <emph type="red">Nurse Aide
Registry Check</emph>
 </check>
 <when>Prior to Job Offer </when>
 <owner>
  <emph type="i">access</emph>HR R&amp;S Specialist </owner>
 <who>All direct care job classes located at state schools / MR
facilities </who>
 <vendor>Employee Misconduct Registry (EMR)  <p>800-452-3934</p>
 </vendor>
</lhp:Row>
<lhp:Row>
 <check>
  <url>Employee Verification and Reference Check</url>
 </check>
 <when>Prior to Job Offer </when>
 <owner>Hiring Manager; upon request, <emph type="i">access</emph>HR
R&amp;S Specialist </owner>
 <who>All selected applicants </who>
 <vendor>Outbound Call made and data is captured on <emph
type="red">HHSE Reference Check</emph> (HR0110)
 <p>
   <url protocal="/Systems/Recruitmax/MP/EditDueDiligence.htm"
target="_blank">Edit Due Diligence</url> in the Applicant Profile will
be performed by the one who conducts the Due Diligence requirement</p>
 </vendor>
</lhp:Row>
<lhp:Row rowspan="6">
 <check>License, registration, certification verifications:
 <bullist>
   <item>
    <p>Nurse</p>
   </item>
   <item>
    <p>Doctors</p>
   </item>
   <item>
    <p>Social Workers</p>
   </item>
   <item>
    <p>Pharmacists</p>
   </item>
   <item>
    <p>Psychologists</p>
   </item>
  </bullist>
 </check>
 <when>Prior to Job Offer </when>
 <owner>
  <emph type="i">access</emph>HR R&amp;S Specialist </owner>
 <who>All job classes who are required to have a license, registration,
certification as stated on the job description or job posting request
</who>
 <vendor>Position dependant - see below: </vendor>
  </lhp:Row>
 <lhp:Row>
  <who>RN and LVN </who>
  <vendor>Texas Board of Nurse Examiners
 <p>
    <url>www.bne.state.tx.us</url>
   </p>
  </vendor>
 </lhp:Row>
 <lhp:Row>
  <who>
   <p>Medical Doctors</p>
   <p>Psychiatrists</p>
  </who>
  <vendor>Texas Board of Medical Examiners
 <p>
    <url>www.tsbme.state.tx.us</url>
   </p>
  </vendor>
 </lhp:Row>
 <lhp:Row>
  <who>Clinical Social Workers </who>
  <vendor>Texas Board of Social Work Examiners
 <p>
    <url>www.tdh.state.tx.us</url>
   </p>
  </vendor>
 </lhp:Row>
 <lhp:Row>
  <who>Pharmacists </who>
  <vendor>Texas State Board of Pharmacy
 <p>
    <url>www.tsbp.state.tx.us</url>
   </p>
  </vendor>
 </lhp:Row>
 <lhp:Row>
  <who>Psychologists </who>
  <vendor>Texas State Board of Examiners of Psychologist
 <p>512-305-7700</p>
  </vendor>
 </lhp:Row>

</lhp:Root>





This e-Mail may contain proprietary and confidential information and is sent for the intended recipient(s) only. 
If by an addressing or transmission error this mail has been misdirected to you, you are requested to delete this mail immediately.
You are also hereby notified that any use, any form of reproduction, dissemination, copying, disclosure, modification,
distribution and/or publication of this e-mail message, contents or its attachment other than by its intended recipient/s is strictly prohibited.

Visit Us at http://www.polaris.co.in

Current Thread