Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Coding Forum


You are currently viewing our Coding Forum as a guest. Please register to participate.
Login



Reply
Problem opening XSL file
Old 02-05-2009, 12:20 PM Problem opening XSL file
pealo86's Avatar
Super Spam Talker

Posts: 850
Name: Matt Pealing
Location: England, north west
Trades: 0
I have a .xsl file that reads from a local .xml file and outputs some data in HTML format. But I'm not too sure how to open it properly??

The only way I can view it properly is by clicking the 'preview in browser' button on Dreamweaver, which previews it correctly in FF. The address bar also gives the impression that it is some sort of temporary file aswell.

But if I open the file from windows explorer, or try to open it directly from the browser, it just displays the document tree like so

Quote:
This XML file does not appear to have any style information associated with it. The document tree is shown below.
Here is the code for my documents:

stu.xml
Code:
<?xml version="1.0" encoding="utf-8"?>
<CLASS ID="Advanced Web Development">
<STUDENT>
<NAME>Tom</NAME>
<AGE>19</AGE>
<HEIGHT>1.3</HEIGHT>
<SEX>M</SEX>
<GRADE>B</GRADE>
</STUDENT>
<STUDENT>
<NAME>Dick</NAME>
<AGE>29</AGE>
<HEIGHT>1.1</HEIGHT>
<SEX>M</SEX>
<GRADE>A</GRADE>
</STUDENT>
<STUDENT>
<NAME>Harry</NAME>
<AGE>39</AGE>
<HEIGHT>1.5</HEIGHT>
<SEX>M</SEX>
<GRADE>C</GRADE>
</STUDENT>
<STUDENT>
<NAME>Mary</NAME>
<AGE>30</AGE>
<HEIGHT>1.1</HEIGHT>
<SEX>F</SEX>
<GRADE>A</GRADE>
</STUDENT>
<STUDENT>
<NAME>Tim</NAME>
<AGE>23</AGE>
<HEIGHT>1.5</HEIGHT>
<SEX>M</SEX>
<GRADE>A</GRADE>
</STUDENT>
</CLASS>
stu.xsl:
Code:
<?xml version="1.0" encoding="ISO-8859-1"?><!-- DWXMLSource="stu.xml" -->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">

<html>
<body>

<h1>XSLT Exercise 4</h1>

<table border="1" width="500">
    <tr>
        <th>Name</th>
        <th>Age</th>
    </tr>
    <xsl:for-each select="//STUDENT">
        <tr>
        <td>
            <xsl:value-of select="NAME"/>
        </td>
        <td>
            <xsl:value-of select="AGE"/>
        </td>
        </tr>
    </xsl:for-each>
</table>

</body>
</html>

</xsl:template>
</xsl:stylesheet>
If anyone could help anytime soon that would be great As this assignment is due in tomorrow lol.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Last edited by pealo86; 02-05-2009 at 01:35 PM..
pealo86 is offline
Reply With Quote
View Public Profile Visit pealo86's homepage!
 
 
Register now for full access!
Old 02-05-2009, 01:41 PM Re: Problem opening XSL file
pealo86's Avatar
Super Spam Talker

Posts: 850
Name: Matt Pealing
Location: England, north west
Trades: 0
*Solved*

It looks as though Dreamweaver was using it's own makeshift code or something ?
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE
pealo86 is offline
Reply With Quote
View Public Profile Visit pealo86's homepage!
 
Old 02-05-2009, 04:08 PM Re: Problem opening XSL file
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
Well, you have 2 method to view them.
The first, and probably the one you found, is to add an <xml-stylsheet> pi to the xml file, and open the xml file in your browser.
Code:
<?xml-stylesheet href="mySheet.xsl" type="text/xsl"?>
The second, is to use a xslt engine to which you specify the xml document and the xsl stylesheet.
No need to declare the xsl in the xml in that case, as you explicitely tell the program which one to use

On a linux machine, with libxslt installed, you have xsltproc for that usage.
I don't know of something similar to windows without buying a product like xmlSpy, though.
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Reply     « Reply to Problem opening XSL file
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.42063 seconds with 12 queries