Ulgurmutid
From ICO wiki
Tiimi liikmed
- Kristi Paakspuu
- Madis Peep
- Mardo Pahk
Idee
Idee on luua automatiseeritud external javascripti failide loomise keskkond mille sisu saab hallata antud keskkonnas ning saada ka mingisugust statistikat (pageviews).
XML
XML
<?xml version="1.0" encoding="utf-8" ?> <Tags> <Tag ID="1" Hash="ef829858697fad3a25da0692aaaeca0b"> <Timestamps> <Timestamp>1363536429597</Timestamp> <Timestamp>1363536436040</Timestamp> <Timestamp>1363536463034</Timestamp> <Timestamp>1363536470586</Timestamp> </Timestamps> <Stats> <Pageviews> <Total>4</Total> <Today>4</Today> <Last_hour>2</Last_hour> </Pageviews> </Stats> <Description URL="mikumaa.ee"> Mingi mikumaa site. </Description> <Script type="javascript/text"> alert('Hello'); </Script> </Tag> <Tag ID="2" Hash="3714b76ba5767f5a4c490a29db299136"> <Timestamps> <Timestamp>1363539079235</Timestamp> <Timestamp>1363539089011</Timestamp> <Timestamp>1363539098178</Timestamp> <Timestamp>1363539106934</Timestamp> <Timestamp>1363539126730</Timestamp> <Timestamp>1363539137630</Timestamp> <Timestamp>1363539146094</Timestamp> </Timestamps> <Stats> <Pageviews> <Total>7</Total> <Today>4</Today> <Last_hour>1</Last_hour> </Pageviews> </Stats> <Description URL="makaronid.ee"> Leht makaronidest. </Description> <Script type="javascript/text"> alert('Hello V66ld!'); </Script> </Tag> <Tag ID="3" Hash="eff7d5dba32b4da32d9a67a519434d3f"> <Timestamps> <Timestamp>1363539345886</Timestamp> <Timestamp>1363539354250</Timestamp> <Timestamp>1363539361690</Timestamp> <Timestamp>1363539370959</Timestamp> <Timestamp>1363539379614</Timestamp> <Timestamp>1363539386845</Timestamp> <Timestamp>1363539395532</Timestamp> </Timestamps> <Stats> <Pageviews> <Total>7</Total> <Today>7</Today> <Last_hour>7</Last_hour> </Pageviews> </Stats> <Description URL="bad.com"> Bad.com - the baddest site on the web. </Description> <Script type="javascript/text"> alert('Oh harro!'); </Script> </Tag> </Tags>
XML Schema
<?xml version="1.0" encoding="utf-8"?> <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="Tags"> <xs:complexType> <xs:sequence> <xs:element maxOccurs="unbounded" name="Tag"> <xs:complexType> <xs:sequence> <xs:element name="Timestamps"> <xs:complexType> <xs:sequence> <xs:element maxOccurs="unbounded" name="Timestamp" type="xs:unsignedLong" /> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="Stats"> <xs:complexType> <xs:sequence> <xs:element name="Pageviews"> <xs:complexType> <xs:sequence> <xs:element name="Total" type="xs:unsignedByte" /> <xs:element name="Today" type="xs:unsignedByte" /> <xs:element name="Last_hour" type="xs:unsignedByte" /> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="Description"> <xs:complexType> <xs:simpleContent> <xs:extension base="xs:string"> <xs:attribute name="URL" type="xs:string" use="required" /> </xs:extension> </xs:simpleContent> </xs:complexType> </xs:element> <xs:element name="Script"> <xs:complexType> <xs:simpleContent> <xs:extension base="xs:string"> <xs:attribute name="type" type="xs:string" use="required" /> </xs:extension> </xs:simpleContent> </xs:complexType> </xs:element> </xs:sequence> <xs:attribute name="ID" type="xs:unsignedByte" use="required" /> <xs:attribute name="Hash" type="xs:string" use="required" /> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:schema>
XSLT 1
<?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl" > <xsl:output method="html" indent="yes"/> <xsl:template match="/"> <html> <body> Kõigide scriptide hashid (nende järgi tuntakse ära mis linki päriti). <ul> <xsl:for-each select="Tags/Tag"> <li> <xsl:value-of select="@Hash"/> </li> </xsl:for-each> </ul> </body> </html> </xsl:template> </xsl:stylesheet>
XSLT 2
<?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl" > <xsl:output method="html" indent="yes"/> <xsl:template match="/"> <html> <body> Scriptid millele lingid hakkavad viitama <ul> <xsl:for-each select="Tags/Tag"> <li><xsl:value-of select="Script"/></li> </xsl:for-each> </ul> </body> </html> </xsl:template> </xsl:stylesheet>
XSLT 3
<?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl" > <xsl:output method="html" indent="yes"/> <xsl:template match="/"> <html> <body> Kõik timestampid. Kui nüüd kombineerida need hashiga, siis saame teada mis kellaajal mingit scripti on laetud ning kui palju (sisuliselt mingi scripti pageview-de arv). <ol> <xsl:for-each select="Tags/Tag"> Järgmised timestampid: <xsl:for-each select="Timestamps/Timestamp"> <li> <xsl:value-of select="."/> </li> </xsl:for-each> <br/><br/> </xsl:for-each> </ol> </body> </html> </xsl:template> </xsl:stylesheet>