Return to Snippet

Revision: 17236
at August 29, 2009 20:15 by mustam


Updated Code
<?xml version="1.0" encoding="UTF-8"?>
<!-- vim: ts=2 sw=2 expandtab
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  <xsl:output method="html" encoding="UTF-8"/>
  <xsl:template match="/">
    <html>
      <head><title>busata log (size: <xsl:value-of select="count(statuses/status)"/>)</title></head>
      <body>
        <table><tr style="background: gray; color: white;"><th>ID</th><th>TEXT</th><th>DATE</th></tr>
          <xsl:for-each select="statuses/status">
            <xsl:sort select="created_at.epoch" order="ascending" data-type="number"/>
            <tr>
              <td style="color: #333; font-size: x-small;"><xsl:value-of select="id"/></td>
              <xsl:apply-templates select="text" />
              <td style="color: #333; font-size: small;"><xsl:value-of select="created_at"/></td>
            </tr>
          </xsl:for-each>
        </table>
    </body></html>
  </xsl:template>

  <xsl:template match="text">
    <xsl:choose>
      <xsl:when test="contains(., 'http://')">
        <td>
          <xsl:value-of select="substring-before(., 'http://')"/>
          <a><xsl:attribute name="href">http://<xsl:value-of select="substring-after(., 'http://')"/></xsl:attribute>http://<xsl:value-of select="substring-after(., 'http://')"/></a>
        </td>
      </xsl:when>
      <xsl:otherwise>
        <td><xsl:value-of select="."/></td>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
</xsl:stylesheet>

Revision: 17235
at August 29, 2009 20:13 by mustam


Updated Code
<?xml version="1.0" encoding="UTF-8"?>
<!-- vim: ts=2 sw=2
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  <xsl:output method="html" encoding="UTF-8"/>
  <xsl:template match="/">
    <html>
      <head><title>busata log (size: <xsl:value-of select="count(statuses/status)"/>)</title></head>
      <body>
        <table><tr style="background: gray; color: white;"><th>ID</th><th>TEXT</th><th>DATE</th></tr>
          <xsl:for-each select="statuses/status">
            <xsl:sort select="created_at.epoch" order="ascending" data-type="number"/>
            <tr>
              <td style="color: #333; font-size: x-small;"><xsl:value-of select="id"/></td>
							<xsl:apply-templates select="text" />
              <td style="color: #333; font-size: small;"><xsl:value-of select="created_at"/></td>
            </tr>
          </xsl:for-each>
        </table>
    </body></html>
  </xsl:template>

	<xsl:template match="text">
		<xsl:choose>
			<xsl:when test="contains(., 'http://')">
				<td>
					<xsl:value-of select="substring-before(., 'http://')"/>
					<a><xsl:attribute name="href">http://<xsl:value-of select="substring-after(., 'http://')"/></xsl:attribute>http://<xsl:value-of select="substring-after(., 'http://')"/></a>
				</td>
			</xsl:when>
			<xsl:otherwise>
				<td><xsl:value-of select="."/></td>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
</xsl:stylesheet>

Revision: 17234
at August 28, 2009 10:15 by mustam


Updated Code
<?xml version="1.0" encoding="UTF-8"?>
<!-- vim: ts=2 sw=2
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  <xsl:output method="html" encoding="UTF-8"/>
  <xsl:template match="/">
    <html>
      <head><title>busata log (size: <xsl:value-of select="count(statuses/status)"/>)</title></head>
      <body>
        <table><tr style="background: gray; color: white;"><th>ID</th><th>TEXT</th><th>DATE</th></tr>
          <xsl:for-each select="statuses/status">
            <xsl:sort select="created_at.epoch" order="ascending"/>
            <tr>
              <td style="color: #333; font-size: x-small;"><xsl:value-of select="id"/></td>
              <td><xsl:value-of select="text"/></td>
              <td style="color: #333; font-size: small;"><xsl:value-of select="created_at"/></td>
            </tr>
          </xsl:for-each>
        </table>
    </body></html>
  </xsl:template>
</xsl:stylesheet>

Revision: 17233
at August 27, 2009 22:39 by mustam


Initial Code
<?xml version="1.0" encoding="UTF-8"?>
<!-- vim: ts=2 sw=2
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  <xsl:output method="html" encoding="UTF-8"/>
  <xsl:template match="/">
    <html>
      <head><title>busata log (size: <xsl:value-of select="count(statuses/status)"/>)</title></head>
      <body>
        <table><tr style="background: gray; color: white;"><th>ID</th><th>TEXT</th><th>DATE</th></tr>
          <xsl:for-each select="statuses/status">
            <xsl:sort select="id" order="descending"/>
            <tr>
              <td style="color: #333; font-size: x-small;"><xsl:value-of select="id"/></td>
              <td><xsl:value-of select="text"/></td>
              <td style="color: #333; font-size: small;"><xsl:value-of select="created_at"/></td>
            </tr>
          </xsl:for-each>
        </table>
    </body></html>
  </xsl:template>
</xsl:stylesheet>

Initial URL


Initial Description
This is xslt file for twitter-logged xml file.

*    cf. [Backup my twitter-log](http://snipplr.com/view/18925/backup-my-twitterlog/)

*    cf. [Merge twitter-logged files into one xml-file](http://snipplr.com/view/18928/merge-twitterlogged-files-into-one-xmlfile/)

Initial Title
Stylesheet for twitter-log file

Initial Tags
twitter

Initial Language
XSLT