xsl-list
[Top] [All Lists]

[xsl] Columns Header Problem

2010-10-03 01:16:13
Hi All,

I am facing a issue in displaying the column's header in a table. I am
able to display on one header i.e. is "Appplication" (as it is at
SALevel[(_at_)Number='1']). But for the SALevel[(_at_)Number='3'] columns
header, the logic is not working (i.e I am unable to diaplay SAPrpName
like Editbutton, Life cycle standards, etc.).
This is my desired output for the headers only:

<tr>
      <tr>
       <th width="16.66666666666667%">Application</th>
       <th width="83.3333333333333%">
        <table border="1" width="100%">
         <tr>
          <th width="20%">EditButton</th>
          <th width="20%">Life Cycle Standards</th>
          <th width="20%">Life Cycle State</th>
          <th width="20%">NewButton</th>
          <th width="20%">Functional Area</th>
         </tr>
        </table>
       </th>
      </tr>
     </tr>

 Here is the xml

<?xml version="1.0" encoding="UTF-8"?>

<

SAReport xmlns:xlink="http://www.w3.org/1999/xlink";>

<SAReportHeader Name="Application Update List" Description=""
IsSubReport="F" OutputFile_Folder="C:\Projects\B&amp;IA Project\R\"
OutputFile_Name="temphtml.htm" ReportFile_Folder="C:\Projects\B&amp;IA
Project\R\Reports" ReportFile_Name="DuPont Reports for SAXT.rpt"
StyleSheetFile="C:\Projects\B&amp;IA Project\R\Stylesheets\Lists
DuPont XT.xsl">

<SASchema>

<SASchemaLevel Number="1">

<SAPropertyType Field="Name" Name="Application" Number="1" Type="char"
MaxLength="160"/>

</SASchemaLevel>

<SASchemaLevel Number="3">

<SAPropertyType Field="DummyProperty" Name="EditButton" Number="2"
Type="char" MaxLength="2"/>

<SAPropertyType Field="Name" Name="Life Cycle Standards" Number="3"
Type="char" MaxLength="160"/>

<SAPropertyType Field="Life Cycle State" Name="Life Cycle State"
Number="4" Type="char" MaxLength="200"/>

<SAPropertyType Field="DummyProperty" Name="NewButton" Number="5"
Type="char" MaxLength="2"/>

<SAPropertyType Field="Arch Sub Domain Func Area" Name="Functional
Area" Number="6" Type="char" MaxLength="200"/>

</SASchemaLevel>

</SASchema>

</SAReportHeader>

<SALevel Number="1">

<SAItem DDID="2140" Name="060522 Raw Material Sample" Type="1107"
Class="3" TypeName="Application Update">

<SAProperty SAPrpName="Application" SAPrpValue="060522 Raw Material Sample"/>

</SAItem>

<SAItem DDID="2252" Name="Adobe Acrobat (Pro and Standard)"
Type="1107" Class="3" TypeName="Application Update">

<SAProperty SAPrpName="Application" SAPrpValue="Adobe Acrobat (Pro and
Standard)"/>

<SALevel Number="3">

<SAItem DDID="12309" Name="Mainstream / Alternate (1 Adobe Acrobat
(7.0) (Professional Edition))" Type="1109" Class="3" TypeName="TLCS
Update">

<SAProperty SAPrpName="EditButton" SAPrpValue=""/>

<SAProperty SAPrpName="Life Cycle Standards" SAPrpValue="Mainstream /
Alternate (1 Adobe Acrobat (7.0) (Professional Edition))"/>

<SAProperty SAPrpName="Life Cycle State" SAPrpValue="&quot;Mainstream
/ Alternate&quot; ">

<SARelatedItem DDID="1650" Type="474" Class="3" TypeName="Life Cycle
State">Mainstream / Alternate</SARelatedItem>

</SAProperty>

<SAProperty SAPrpName="NewButton" SAPrpValue=""/>

<SAProperty SAPrpName="Functional Area" SAPrpValue="&quot;Document
Presentation&quot; ">

<SARelatedItem DDID="11037" Type="461" Class="3" TypeName="Arch Sub
Domain Func Area">Document Presentation</SARelatedItem>

</SAProperty>

</SAItem>

<SAItem DDID="12310" Name="Mainstream / Preferred (2 Adobe Acrobat
(7.0) (Standard Edition))" Type="1109" Class="3" TypeName="TLCS
Update">

<SAProperty SAPrpName="EditButton" SAPrpValue=""/>

<SAProperty SAPrpName="Life Cycle Standards" SAPrpValue="Mainstream /
Preferred (2 Adobe Acrobat (7.0) (Standard Edition))"/>

<SAProperty SAPrpName="Life Cycle State" SAPrpValue="&quot;Mainstream
/ Preferred&quot; ">

<SARelatedItem DDID="1651" Type="474" Class="3" TypeName="Life Cycle
State">Mainstream / Preferred</SARelatedItem>

</SAProperty>

<SAProperty SAPrpName="NewButton" SAPrpValue=""/>

<SAProperty SAPrpName="Functional Area" SAPrpValue="&quot;Document
Presentation&quot; ">

<SARelatedItem DDID="11037" Type="461" Class="3" TypeName="Arch Sub
Domain Func Area">Document Presentation</SARelatedItem>

</SAProperty>

</SAItem>

<SAItem DDID="12311" Name="Research / Restricted (3 Adobe Acrobat 3D
(7.0))" Type="1109" Class="3" TypeName="TLCS Update">

<SAProperty SAPrpName="EditButton" SAPrpValue=""/>

<SAProperty SAPrpName="Life Cycle Standards" SAPrpValue="Research /
Restricted (3 Adobe Acrobat 3D (7.0))"/>

<SAProperty SAPrpName="Life Cycle State" SAPrpValue="&quot;Research /
Restricted&quot; ">

<SARelatedItem DDID="1653" Type="474" Class="3" TypeName="Life Cycle
State">Research / Restricted</SARelatedItem>

</SAProperty>

<SAProperty SAPrpName="NewButton" SAPrpValue=""/>

<SAProperty SAPrpName="Functional Area" SAPrpValue="&quot;Document
Presentation&quot; ">

<SARelatedItem DDID="11037" Type="461" Class="3" TypeName="Arch Sub
Domain Func Area">Document Presentation</SARelatedItem>

</SAProperty>

</SAItem>

<SAItem DDID="12312" Name="Mainstream / Preferred (4 Adobe Acrobat
Elements (7.0))" Type="1109" Class="3" TypeName="TLCS Update">

<SAProperty SAPrpName="EditButton" SAPrpValue=""/>

<SAProperty SAPrpName="Life Cycle Standards" SAPrpValue="Mainstream /
Preferred (4 Adobe Acrobat Elements (7.0))"/>

<SAProperty SAPrpName="Life Cycle State" SAPrpValue="&quot;Mainstream
/ Preferred&quot; ">

<SARelatedItem DDID="1651" Type="474" Class="3" TypeName="Life Cycle
State">Mainstream / Preferred</SARelatedItem>

</SAProperty>

<SAProperty SAPrpName="NewButton" SAPrpValue=""/>

<SAProperty SAPrpName="Functional Area" SAPrpValue="&quot;Document
Presentation&quot; ">

<SARelatedItem DDID="11037" Type="461" Class="3" TypeName="Arch Sub
Domain Func Area">Document Presentation</SARelatedItem>

</SAProperty>

</SAItem>

</SALevel>

</SAItem>

<SAItem DDID="2196" Name="Acquisitions Database" Type="1107" Class="3"
TypeName="Application Update">

<SAProperty SAPrpName="Application" SAPrpValue="Acquisitions Database"/>

<SALevel Number="3">

<SAItem DDID="11817" Name="Contain / Restricted (1 Acquisitions
Database (All))" Type="1109" Class="3" TypeName="TLCS Update">

<SAProperty SAPrpName="EditButton" SAPrpValue=""/>

<SAProperty SAPrpName="Life Cycle Standards" SAPrpValue="Contain /
Restricted (1 Acquisitions Database (All))"/>

<SAProperty SAPrpName="Life Cycle State" SAPrpValue="&quot;Contain /
Restricted&quot; ">

<SARelatedItem DDID="1646" Type="474" Class="3" TypeName="Life Cycle
State">Contain / Restricted</SARelatedItem>

</SAProperty>

<SAProperty SAPrpName="NewButton" SAPrpValue=""/>

<SAProperty SAPrpName="Functional Area" SAPrpValue="Reporting ">

<SARelatedItem DDID="10746" Type="461" Class="3" TypeName="Arch Sub
Domain Func Area">Reporting</SARelatedItem>

</SAProperty>

</SAItem>

</SALevel>

</SAItem>

</SALevel>

</SAReport>



Here is xsl I m using


<?xml version="1.0" encoding="UTF-8"?>

<

xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:fo="http://www.w3.org/1999/XSL/Format";>

<

xsl:template match="/">

<html>

<head>Application Update List</head>

<body>

<xsl:apply-templates select="/SAReport/SALevel"
mode="LevelItemPropsTabularWithTabularChildrenNewDuPont"/>

</body>

</html>

</xsl:template>

<xsl:template name="LevelItemPropsTabularWithTabularChildrenNewDuPont"
match="SALevel"
mode="LevelItemPropsTabularWithTabularChildrenNewDuPont">

<xsl:param name="SPANCount">-1</xsl:param>

<xsl:param name="ThisLevel"/>

<xsl:variable name="TotalNoOfProps"
select="count(//SASchema/SASchemaLevel/SAPropertyType)"/>

<xsl:variable name="NoOfPropsHere"
select="count(//SASchema/SASchemaLevel[(_at_)Number=$ThisLevel]/SAPropertyType)"/>

<xsl:variable name="ColWidth" select="100 div ($TotalNoOfProps )"/>

<xsl:variable name="RemainingProps" select="$TotalNoOfProps -$NoOfPropsHere"/>

<table border="1" width="100%" cellspacing="0" cellpadding="0"
id="maindata{$SPANCount}" class="sortable dataTableBorders">

<xsl:apply-templates
mode="LevelItemPropsTabularWithTabularChildrenHeadersDuPont"
select=".">

<xsl:with-param name="TotalNoOfProps" select="$TotalNoOfProps"/>

<xsl:with-param name="ThisLevel" select="@Number"/>

</xsl:apply-templates>

<xsl:apply-templates
mode="LevelItemPropsTabularWithTabularChildrenNoHeadersDuPont"
select=".">

<xsl:with-param name="TotalNoOfProps" select="$TotalNoOfProps"/>

<xsl:with-param name="ThisLevel" select="@Number"/>

</xsl:apply-templates>

</table>

</xsl:template>

<xsl:template name="LevelItemPropsTabularWithTabularChildrenHeadersDuPont"
match="SALevel"
mode="LevelItemPropsTabularWithTabularChildrenHeadersDuPont">

<xsl:param name="TotalNoOfProps"/>

<xsl:param name="ThisLevel"/>

<xsl:variable name="NoOfPropsHere"
select="count(//SASchema/SASchemaLevel[(_at_)Number=$ThisLevel]/SAPropertyType)"/>

<xsl:variable name="ColWidth" select="100 div ($TotalNoOfProps )"/>

<xsl:variable name="RemainingProps" select="$TotalNoOfProps -$NoOfPropsHere"/>

<xsl:variable name="NextLevel"
select="//SASchema/SASchemaLevel[(_at_)Number=$ThisLevel]/following-sibling::SASchemaLevel[1]/@Number"/>

<xsl:variable name="LevelNode"
select="//SALevel[1]//SALevel[(_at_)Number=$NextLevel]"/>

<xsl:for-each select="SAItem[1]">

<xsl:choose>

<xsl:when test="$NoOfPropsHere &gt; 0">

<tr>

<xsl:for-each select="SAProperty[(_at_)SAPrpName !='Invisible' and
@SAPrpName !='##Invisible##']">

<th width="{$ColWidth}%">

<xsl:value-of select="@SAPrpName"/>

</th>

</xsl:for-each>

<!--xsl:for-each select="SALevel/parent::node()"-->

<!--/xsl:for-each-->

<!--<xsl:for-each select="SALink">

<th width="{100 - ($ColWidth * $NoOfPropsLinked)}%">

<table border="1" width="100%">

<xsl:apply-templates
select="document(@xlink:href)/SAReport/SALevel/SAItem/SALevel"
mode="LevelItemPropsTabularWithTabularChildrenHeaders">

<xsl:with-param name="TotalNoOfProps" select="$RemainingProps"/>

</xsl:apply-templates>

</table>

</th>

</xsl:for-each>-->

<xsl:for-each select="SALevel/parent::node()">

<th width="{100 - ($ColWidth * $NoOfPropsHere)}%">

<table border="1" width="100%">

<xsl:apply-templates select="SALevel"
mode="LevelItemPropsTabularWithTabularChildrenHeadersDuPont">

<xsl:with-param name="TotalNoOfProps" select="$RemainingProps"/>

</xsl:apply-templates>

</table>

</th>

</xsl:for-each>

</tr>

</xsl:when>

<xsl:otherwise>

<!--xsl:for-each select="SALevel/parent::node()"-->

<!--/xsl:for-each-->

<!--<xsl:for-each select="SALink">

<xsl:apply-templates
select="document(@xlink:href)/SAReport/SALevel/SAItem/SALevel"
mode="LevelItemPropsTabularWithTabularChildrenHeadersDuPont">

<xsl:with-param name="TotalNoOfProps" select="$RemainingProps"/>

</xsl:apply-templates>

</xsl:for-each>-->

<xsl:for-each select="SALevel/parent::node()">

<xsl:apply-templates select="SALevel"
mode="LevelItemPropsTabularWithTabularChildrenHeadersDuPont">

<xsl:with-param name="TotalNoOfProps" select="$RemainingProps"/>

</xsl:apply-templates>

</xsl:for-each>

</xsl:otherwise>

</xsl:choose>

</xsl:for-each>

</xsl:template>

<xsl:template name="LevelItemPropsTabularWithTabularChildrenNoHeadersDuPont"
match="SALevel"
mode="LevelItemPropsTabularWithTabularChildrenNoHeadersDuPont">

<!-- This creates tables within tables for each sub level-->

<xsl:param name="TotalNoOfProps"/>

<xsl:param name="ThisLevel"/>

<xsl:variable name="DefDDID" select="./@DDID"/>

<xsl:variable name="DefType" select="./@Type"/>

<xsl:variable name="NoOfPropsHere"
select="count(//SASchema/SASchemaLevel[(_at_)Number=$ThisLevel]/SAPropertyType)"/>

<xsl:variable name="ColWidth" select="100 div ($TotalNoOfProps )"/>

<xsl:variable name="RemainingProps" select="$TotalNoOfProps -$NoOfPropsHere"/>

<xsl:variable name="NextLevel"
select="//SASchema/SASchemaLevel[(_at_)Number=$ThisLevel]/following-sibling::SASchemaLevel[1]/@Number"/>

<xsl:variable name="LevelNode"
select="//SALevel[1]//SALevel[(_at_)Number=$NextLevel]"/>

<xsl:for-each select="SAItem">

<tr>

<xsl:for-each select="SAProperty[(_at_)SAPrpName !='Invisible']">

<td valign="top" width="{$ColWidth}%">

<xsl:apply-templates select="."/>

</td>

<!--<td valign="top" width='{$ColWidth}%'>

<xsl:apply-templates select="." mode="FormatOutputString"/>

</td>-->

</xsl:for-each>

<xsl:choose>

<xsl:when test="count(SALevel/parent::node())>0">

<xsl:for-each select="SALevel/parent::node()">

<!--{100 - ($ColWidth * $NoOfPropsHere)}%-->

<td width="{100 - ($ColWidth * $NoOfPropsHere)}%">

<table border="1" width="100%">

<xsl:apply-templates select="SALevel"
mode="LevelItemPropsTabularWithTabularChildrenNoHeadersDuPont">

<xsl:with-param name="TotalNoOfProps" select="$RemainingProps"/>

<xsl:with-param name="ThisLevel" select="$NextLevel"/>

</xsl:apply-templates>

</table>

</td>

</xsl:for-each>

</xsl:when>

<xsl:otherwise>

<xsl:if test="$NextLevel>0">

<td>

<!--width="{100 - ($RemainingProps)}%-->

<xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>

</td>

<td/>

<td/>

<td/>

<td/>

</xsl:if>

</xsl:otherwise>

</xsl:choose>

</tr>

</xsl:for-each>

</xsl:template>

</

xsl:stylesheet>



Please help me out....thanks in advance


Rashi Bhardwaj

--~------------------------------------------------------------------
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>
  • [xsl] Columns Header Problem, Rashi Bhardwaj <=