amycwoods Posted December 21, 2010 Share Posted December 21, 2010 How do I display my xslt file, which is a sortable table, in a web browser?<?xml version="1.0" encoding="ISO8859-1"?><!-- DWXMLSource="mon_thurs.xml" --><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:output method="html"/><xsl:template match="/"><html><head> <link href="mon_thurs.css" rel="stylesheet" type="text/css" /><script type="text/javascript" src="scripts/jquery-1.4.4.js"></script><script type="text/javascript" src="scripts/tablesort.js"></script></head><body> <div id="monThurs"><div id="mthlist"><table id="myTable" class="tablesorter" width="740px"> <tr> <th class="sortable"> DATE</th> <th class="sortable"> DAY</th> <th class="sortable"> TIME</th> <th class="sortable"> NAME</th> <th class="sortable"> LOCATION</th> <th class="sortable"> MAIN ACT</th> <th class="sortable"> GENRE</th> <th class="sortable"> COST</th> </tr> <xsl:for-each select="VENUES/VENUE"> <xsl:sort select="DATE" order="ascending"/> <tr> <td><xsl:value-of select="DATE"/></td> <td><xsl:value-of select="DAY"/></td> <td><xsl:value-of select="TIME"/></td> <td> <a> <xsl:attribute name="target">_blank</xsl:attribute> <xsl:attribute name="href"> <xsl:value-of select="NAME/@VALUE"/></xsl:attribute> <xsl:value-of select="NAME"/> </a> </td> <td><xsl:value-of select="LOCATION"/></td> <td><xsl:value-of select="MAIN_ACT"/></td> <td><xsl:value-of select="GENRE"/></td> <td><xsl:value-of select="COST"/></td> </tr> </xsl:for-each> </table> </div></div></body> </html> </xsl:template> </xsl:stylesheet> Link to comment Share on other sites More sharing options...
Martin Honnen Posted December 22, 2010 Share Posted December 22, 2010 An XSLT stylesheet alone does not make much sense to a web browser, you would need to load an XML document that links to it with e.g. <?xml-stylesheet type="text/xsl" href="yourStylesheet.xsl"?><VENUES> <VENUE> ... </VENUE></VENUES> Link to comment Share on other sites More sharing options...
ckrudelux Posted December 27, 2010 Share Posted December 27, 2010 How do I display my xslt file, which is a sortable table, in a web browser?<?xml version="1.0" encoding="ISO8859-1"?><!-- DWXMLSource="mon_thurs.xml" --><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:output method="html"/><xsl:template match="/"><html><head> <link href="mon_thurs.css" rel="stylesheet" type="text/css" /><script type="text/javascript" src="scripts/jquery-1.4.4.js"></script><script type="text/javascript" src="scripts/tablesort.js"></script></head><body> <div id="monThurs"><div id="mthlist"><table id="myTable" class="tablesorter" width="740px"> <tr> <th class="sortable"> DATE</th> <th class="sortable"> DAY</th> <th class="sortable"> TIME</th> <th class="sortable"> NAME</th> <th class="sortable"> LOCATION</th> <th class="sortable"> MAIN ACT</th> <th class="sortable"> GENRE</th> <th class="sortable"> COST</th> </tr> <xsl:for-each select="VENUES/VENUE"> <xsl:sort select="DATE" order="ascending"/> <tr> <td><xsl:value-of select="DATE"/></td> <td><xsl:value-of select="DAY"/></td> <td><xsl:value-of select="TIME"/></td> <td> <a> <xsl:attribute name="target">_blank</xsl:attribute> <xsl:attribute name="href"> <xsl:value-of select="NAME/@VALUE"/></xsl:attribute> <xsl:value-of select="NAME"/> </a> </td> <td><xsl:value-of select="LOCATION"/></td> <td><xsl:value-of select="MAIN_ACT"/></td> <td><xsl:value-of select="GENRE"/></td> <td><xsl:value-of select="COST"/></td> </tr> </xsl:for-each> </table> </div></div></body> </html> </xsl:template> </xsl:stylesheet>You could use several method JavaScript is one option but is limited to the users which has JS enabled, other options is asp or php which is server side and works for every user.JS method ASP method PHP method Link to comment Share on other sites More sharing options...
cintolas Posted December 28, 2010 Share Posted December 28, 2010 Is there any way to link an XML file to an XSL file?I can plop an XSL stylesheet into an XML file no problem.However, I have no control over the XML file. I can only change the stylesheet. Right now I am resorting to making the transform using php and then displaying the result, but I would rather not have to use some server side technology (or client side javascript) if the browser can render it on the fly.I really find this to be a limitation of xsl Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.