This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: please help, xsl transformation trouble
- To: <xsl-list at lists dot mulberrytech dot com>
- Subject: RE: [xsl] please help, xsl transformation trouble
- From: "Chris Bayes" <Chris at Bayes dot co dot uk>
- Date: Mon, 9 Jul 2001 16:19:01 +0100
- Reply-To: xsl-list at lists dot mulberrytech dot com
Kyle,
There are many things wrong here. Have a look at my site
http://www.bayes.co.uk/xml/index.xml?/xml/tutorial/filtering/filter.xml
for an example on how to do this.
Ciao Chris
XML/XSL Portal
http://www.bayes.co.uk/xml
>-----Original Message-----
>From: owner-xsl-list@lists.mulberrytech.com
>[mailto:owner-xsl-list@lists.mulberrytech.com]On Behalf Of Kyle Polillo
>Sent: 09 July 2001 16:06
>To: 'XSL-List@lists.mulberrytech.com'
>Subject: [xsl] 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
>
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list