Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 4th, 2004, 03:54 PM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 451
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Ben Horne
Default XSL Stylesheet Problem

Hi all,

I'm having a problem with an XSL Stylesheet file that I've written. Basically, what the XSL stylesheet does is style the usaOrig XML file so that it looks all nice and fancy.:D

Here's the XSL Stylesheet code:

<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
 <xsl:template match="/">
  <html>
   <head>
    <title>State Information</title>
   </head>
   <body>
    <table width="100%" border="1">
     <tr style="background-color:red;color:white">
       <th>State</th>
       <th>Capital</th>
       <th>Population</th>
       <th>Area</th>
       <th>County</th>
       <th>County Seat</th>
       <th>County Population</th>
     </tr>
     <xsl:for-each select="usa/state">

      <tr>
        <td>
          <xsl:value-of select="stName" />
        </td>
        <td>
         <xsl:value-of select="stCapital" />
        </td>
        <td>
         <xsl:value-of select="stPopulation" />
        </td>
        <td>
         <xsl:value-of select="stArea" />
        </td>
    <xsl:for-each select="stCounties/county"></xsl:for-each>
        <td>
         <xsl:value-of select="coName" />
        </td>
        <td>
         <xsl:value-of select="coSeat" />
        </td>
        <td>
         <xsl:value-of select="coPopulation" />
        </td>
      </tr>
     </xsl:for-each>
    </table>
    </body>
   </html>
 </xsl:template>
</xsl:stylesheet>


I looked at the XML file after I applied the necessary changes and saw that the data stopped in the middle of the table Now, I think the problem lies in the XSL file but I'm not sure. Can anyone help?

Thanks in advance,


Ben Horne
Madison Area Technical College student
-------------------------
http://community.webshots.com/user/valerian114

Go there. I have a lot of awesome photos that I rendered myself
__________________
Ben Horne
-------------------------
I don\'t want to sound like I haven\'t made any mistakes. I\'m confident I have.

Most likely using FireFox and concocting my next Macromedia Flash project
Snibworks Forums Moderator

Welcome to the New Age
 
Old March 5th, 2004, 05:16 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

What's this empty for-each <xsl:for-each select="stCounties/county"></xsl:for-each> supposed to be doing? I can't try out your xsl coz I don't know what your xml file looks like.
 
Old March 5th, 2004, 05:43 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

You are also using an outdated form of xsl, developed by Microsoft before the final standards were agreed. You're are going to find documentation and support for this version very difficult to come by. Try switching to XSLT, the first step is changing the xsl namespace declaration to "http://www.w3.org/1999/XSL/Transform".

--

Joe
 
Old March 5th, 2004, 04:22 PM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 451
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Ben Horne
Default

What's the XSLT version? I copied and pasted your corrections and I could not view the stylesheet because I got an error message stating that the version attribute was missing.

Quote:
quote:Originally posted by joefawcett
 You are also using an outdated form of xsl, developed by Microsoft before the final standards were agreed. You're are going to find documentation and support for this version very difficult to come by. Try switching to XSLT, the first step is changing the xsl namespace declaration to "http://www.w3.org/1999/XSL/Transform".

--

Joe
Ben Horne
Madison Area Technical College student
-------------------------
http://community.webshots.com/user/valerian114

Go there. I have a lot of awesome photos that I rendered myself
 
Old March 6th, 2004, 05:50 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

You'll need version="1.0" in the stylesheet element.

--

Joe





Similar Threads
Thread Thread Starter Forum Replies Last Post
scx to html, using a xsl stylesheet bluetorch XSLT 0 October 18th, 2005 11:38 AM
CSS 2 Stylesheet jainnid CSS Cascading Style Sheets 1 July 6th, 2005 01:16 AM
My stylesheet treat!! freezotic BOOK: Beginning Java 2 1 March 26th, 2004 04:30 PM
javascript problem in stylesheet extension polecat XSLT 8 June 30th, 2003 11:06 AM
XSL Transform with xsl string NOT xsl file skin XSLT 0 June 16th, 2003 07:30 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.