This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: Problem with <xsl:import> and <xsl:call-template>!


Hi Jenny and Michael,

Before u read i thought i should summarize.so here it
is 
1)u have Results.xsl which works on Results.xml which
is nothing but a table stucture of html with headers
rows and columns

2) Then u have Sites.xml which has some info and then
it kicks in the Logic which generates the xml needed
for Results and the xsl Sites.xsl renders the header
part and just calls the Results page for rendering the
table structure.
3)but the surprising part is that just by importing
WITHOUT calling the table structure is rendered.
4)Now if I actually call it then i get 2 forms!!!
I am using XT processor!!!


*******************
<?xml version="1.0"?>
<pageData>
   <CMGMTResults>
      <Headers>
         <Header>Contract ID</Header>
         <Header>Revision Number</Header>
         <Header>Supplier Name</Header>
      </Headers>
      <Contracts>
         <Contract label="ContractID" value="01">
            <Value>01</Value>
            <Value>1</Value>
            <Value>JACK ELECTRONICS INC</Value>
         </Contract>
         <Contract label="ContractID" value="02">
            <Value>02</Value>
            <Value>11</Value>
            <Value>ADVANCED MICRO DEVICES INC</Value>
         </Contract>
      </Contracts>
   </CMGMTResults>
</pageData>

This is Results.xsl
*****************************************
<xsl:template match="CMGMTResults" name="Results">
<script language="javascript"
src="{$context}/javascript/resultspage.js"><xsl:comment>helper
routines</xsl:comment></script>
<FORM name ="contractlistform" method="post" >
	
	<table id='contract'>
	<tr>
		<xsl:apply-templates select="Headers"/>
		<xsl:apply-templates select="Contracts"/>
	<tr>
	<table>

</FORM>
</xsl:template>
<xsl:template match="Contracts">

	<xsl:apply-templates/>
</xsl:template>
<xsl:template match="Contract/Value">

	<td align="left" nowrap="yes">		
	<xsl:value-of select="."/>
	</td>
</xsl:template>
<xsl:template name="Headers">
		<xsl:for-each select="Header">
			<xsl:variable name="cnt" select="position()-1"/>

			<TD NOWRAP='true'>
			<FONT FACE="Arial, Helvetica" SIZE="1">
			<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0"
WIDTH="100%">
			<TR>
			<TD align="center"><INPUT TYPE='TEXT'
style="padding-top:2px;padding-bottom:0px;
margin-right: 4px;margin-left:4px; 
                                                color:
#505050; font-family: verdana, arial, sans-serif;
                                               
font-size:11px;border:1px solid
#999999;padding-left:4px;
                                               
padding-right:4px;height:18px;" SIZE="12">
			<xsl:attribute name='NAME'>vs_<xsl:value-of
select="$cnt"/></xsl:attribute>
			<xsl:attribute name='VALUE'><xsl:value-of
select='@value'/></xsl:attribute>
			</INPUT>
			</TD>
			</TR>
			</TABLE>
			</FONT>
			</TD>
		</xsl:for-each>
	
	</i2:tr>
</xsl:template>
</xsl:stylesheet>

So now for the Sites.xml
*****************
<pageData>
   <CMGMTSitesContractSitesDBAccess/>
   <CMGMTContractSites>
      <SiteDetails>
         <SiteHeader label="Contract ID" value="01"/>
         <SiteHeader label="Revision Number"
value="1"/>
         <SiteHeader label="Contract Description"
value="LTA:69-112-4960"/>
         <SiteHeader label="Supplier ID"
value="09-312-0871"/>
         <SiteHeader label="Supplier Name"
value="MICRON TECHNOLOGY INC"/>
         <SiteHeader label="Organization"
value="CONS_SITE2"/>
      </SiteDetails>
   </CMGMTContractSites>
   <CMGMTResults>
      <Headers>
         <Header>Site Name</Header>
         <Header>Division Name</Header>
         <Header>Geography</Header>
      </Headers>
      <Contracts>
         <Contract label="SiteName" value="CHARLOTTE">
            <Value>CHARLOTTE</Value>
            <Value>VEHICLE DIVISION</Value>
            <Value>NORTH AMERICA</Value>
         </Contract>
      </Contracts>
   </CMGMTResults>
</pageData>
So now if the Sites.xsl just does an import of
Results.xsl the table structure is displayed without
calling the template.In the below case because of the
call to the template i am getting 2 forms.

******************************
<xsl:import href = "CMGMTResultsPage.xsl"/>

<xsl:template match="SiteDetails">
	<xsl:apply-templates select="SiteHeader"/>	
	<xsl:call-template name="Results"/>
</xsl:template>

<xsl:template match="SiteHeader" name="Site">
		<table border="0" cellspacing="0" cellpadding="0"
bgcolor="white" width="100%" >
		<tr>
		<td>
		<tr align="center" bgcolor="white">
			<td width="50%" align="left" valign="top"
height="23"><FONT face="verdana" style="FONT-SIZE:
8pt"><xsl:value-of select="@label"/></FONT></td>
			<td width="50%" align="left" class="boldtextArial"
valign="top" height="23"><xsl:value-of
select="@value"/></td>
		</tr>
		</td>
		</tr>
		<tr></tr>
		</table>
		
</xsl:template>


</xsl:stylesheet>

I hope this is understandable!!!
--Vijay




__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]