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]

please help, xsl transformation trouble


Hello all ,

I am new to xml/xsl and I am trying to make a page that sorts the data in a
row by clicking on the column headline. Something happens and the xsl is
transformed but not correctly, I just end up with a blank page. Any help
would be appreciated.

here is the code:

<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl";>
<xsl:template match="/">
<HTML>
<HEAD>
<TITLE>test</TITLE>    
	   
	  <STYLE>
          
		  BODY       { margin:0px; background-color: blue; width:
30em;
                       font-family: Arial, Helvetica, sans-serif; font-size:
small; }
          H1         { color: #888833; }
          P          { margin-top: .5em; margin-bottom: .25em; }
          HR         { color: #888833; }
          .cell      { text-align: center; font-size: xx-small; margin-top:
.25em; background-color: #FFFFDD; }
          .headline  { font-style: italic; font-size: xx-small; cursor:hand;
color: #FFFFDD ; text-align: center; background-color: blue; border:1px
outset white }
          .body      { text-align: justify; background-color: #FFFFDD; }
          .dingbat   { font-family: WingDings; font-style: normal;
font-size: xx-small; }
          .id    	 { font-weight: bold; }
          .self      { font-style: italic; }
          
      
         </STYLE>

</HEAD>
 
	   <SCRIPT><xsl:comment><![CDATA[
	    
	   function sort(field)
	   {
          sortField.value = field;
          <!-- set cursor to watch here? -->
          document.innerHTML =
source.documentElement.transformNode(stylesheet);
       }
      
      ]]></xsl:comment></SCRIPT>

      <SCRIPT for="window" event="onload"><xsl:comment><![CDATA[
        stylesheet = document.XSLDocument;
        source = document.XMLDocument;
        sortField = document.XSLDocument.selectSingleNode("//@order-by");
	   
	   

	   ]]></xsl:comment></SCRIPT>

  
  <BODY>
   
  
    <P class="cell">click on any column header to sort data :)</P>
	<TABLE>
	<TR>
	<TD><xsl:apply-templates select="fields"/></TD>
	</TR>
	</TABLE>
    <TABLE border="0" cellspacing="1">
      <THEAD>
        <td bgcolor="#000000"><DIV class="headline"
onClick="sort('CustomerID')">CustomerID</DIV></td>
        <td bgcolor="#000000"><DIV class="headline"
onClick="sort('ContactFirstName')">FirstName</DIV></td>
        <td bgcolor="#000000"><DIV class="headline"
onClick="sort('ContactLastName')">LastName</DIV></td>
		<td bgcolor="#000000"><DIV class="headline"
onClick="sort('BillingAddress')">Address</DIV></td>
		<td bgcolor="#000000"><DIV class="headline"
onClick="sort('City')">City</DIV></td>
		<td bgcolor="#000000"><DIV class="headline"
onClick="sort('StateOrProvince')">State</DIV></td>
		<td bgcolor="#000000"><DIV class="headline"
onClick="sort('PostalCode')">Zip</DIV></td>
		<td bgcolor="#000000"><DIV class="headline"
onClick="sort('Country')">Country</DIV></td>
		<td bgcolor="#000000"><DIV class="headline"
onClick="sort('PhoneNumber')">Phone</DIV></td>
		<td bgcolor="#000000"><DIV class="headline"
onClick="sort('Extension')">Extension</DIV></td>
		<td bgcolor="#000000"><DIV class="headline"
onClick="sort('EmailAddress')">Email</DIV></td>
		<td bgcolor="#000000"><DIV class="headline"
onClick="sort('Card_Number')">Card Number</DIV></td>
		<td bgcolor="#000000"><DIV class="headline"
onClick="sort('Expiration_Date')">Expiration</DIV></td>
		<td bgcolor="#000000"><DIV class="headline"
onClick="sort('Username')">Username</DIV></td>
		<td bgcolor="#000000"><DIV class="headline"
onClick="sort('Password')">Password</DIV></td>
		<td bgcolor="#000000"><DIV class="headline"
onClick="sort('Membership_Date')">Membership Date</DIV></td>
		<td bgcolor="#000000"><DIV class="headline"
onClick="sort('Membership_Term')">Membership Term</DIV></td>
		<td bgcolor="#000000"><DIV class="headline"
onClick="sort('Renewal_Date')">Renewal Date</DIV></td>
		</THEAD>
	    
	    <xsl:for-each select="DATABASE/RECORD" order-by="CustomerID">
<---this is the line I am attempting to transform
	  <tr>
        <td class="cell"><xsl:value-of select="CustomerID"/></td>
        <td class="cell"><xsl:value-of select="ContactFirstName"/></td>
        <td class="cell"><xsl:value-of select="ContactLastName"/></td>
		<td class="cell"><xsl:value-of
select="BillingAddress"/></td>
		<td class="cell"><xsl:value-of select="City"/></td>
		<td class="cell"><xsl:value-of
select="StateOrProvince"/></td>
		<td class="cell"><xsl:value-of select="PostalCode"/></td>
		<td class="cell"><xsl:value-of select="Country"/></td>
		<td class="cell"><xsl:value-of select="PhoneNumber"/></td>
		<td class="cell"><xsl:value-of select="Extension"/></td>
		<td class="cell"><xsl:value-of select="EmailAddress"/></td>
		<td class="cell"><xsl:value-of
select="Credit_Card_Number"/></td>
		<td class="cell"><xsl:value-of
select="Expiration_Date"/></td>
		<td class="cell"><xsl:value-of select="Username"/></td>
		<td class="cell"><xsl:value-of select="Password"/></td>
		<td class="cell"><xsl:value-of
select="Membership_Date"/></td>
		<td class="cell"><xsl:value-of
select="Membership_Term"/></td>
		<td class="cell"><xsl:value-of select="Renewal_Date"/></td>
		
      </tr>
      </xsl:for-each>
	  </TABLE>
	 
	  </BODY>
	  </HTML>
</xsl:template>
</xsl:stylesheet>

 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]