??? Profit: Difference between revisions
From ICO wiki
Jump to navigationJump to search
Line 4: | Line 4: | ||
* Frank Karl Koppel | * Frank Karl Koppel | ||
==XML/XSD/XSLT( | ==XML/XSD/XSLT(unfinished)== | ||
===XML=== | ===XML=== | ||
<div class="toccolours mw-collapsible mw-collapsed" style="width:75em"> | <div class="toccolours mw-collapsible mw-collapsed" style="width:75em"> |
Revision as of 18:37, 20 March 2017
Meeskond "??? Profit"
- Aivar Romandi
- Frank Karl Koppel
XML/XSD/XSLT(unfinished)
XML
<?xml version="1.0" encoding="utf-8"?>
<Series>
<Show id="0" releaseYear="2010" onGoing="true" country="USA" language="English">
<ShowName><![CDATA[Hea saate nimi]]></ShowName>
<ShowDescription><![CDATA[saade on selline]]> </ShowDescription>
<BannerUrl><![CDATA[http://img2.tvtome.com/i/u/0aa3afb3cbe3468fc6e43e50070b0810.png]]></BannerUrl>
<Genres>
<Genre><![CDATA[drama]]></Genre>
</Genres>
<Seasons>
<Season nr="1">
<SeasonDescription><![CDATA[description]]></SeasonDescription>
<Episodes>
<Episode nr="1" releaseDate="2010-10-10" length="88" lengthType="min">
<EpisodeName><![CDATA[What?!]]></EpisodeName>
<EpisodeDescription><![CDATA[description]]></EpisodeDescription>
</Episode>
</Episodes>
</Season>
<Season nr="2">
<SeasonDescription><![CDATA[description]]></SeasonDescription>
<Episodes>
<Episode nr="1" releaseDate="2010-10-10" length="88" lengthType="min">
<EpisodeName><![CDATA[What?!]]></EpisodeName>
<EpisodeDescription><![CDATA[description]]></EpisodeDescription>
</Episode>
</Episodes>
</Season>
</Seasons>
<Credits>
<Actors>
<Actor sex="m" birthDate="1980-10-10">
<FirstName><![CDATA[Pakiraam]]></FirstName>
<LastName><![CDATA[Peeter]]></LastName>
<Role><![CDATA[Anderson]]></Role>
</Actor>
</Actors>
<Directors>
<Director sex="m" birthDate="1980-10-10">
<FirstName><![CDATA[Peeter]]></FirstName>
<LastName><![CDATA[Pakiraam]]></LastName>
</Director>
</Directors>
</Credits>
</Show>
</Series>
XSD
<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Series">
<xs:complexType>
<xs:sequence>
<xs:element name="Show" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="ShowName" type="xs:string"/>
<xs:element name="ShowDescription" type="xs:string" minOccurs="0" maxOccurs="1"/>
<xs:element name="BannerUrl" type="xs:string" minOccurs="0" maxOccurs="1" />
<xs:element name="Genres">
<xs:complexType>
<xs:sequence>
<xs:element name="Genre" type="xs:string" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Seasons">
<xs:complexType>
<xs:sequence>
<xs:element name="Season" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="SeasonDescription" type="xs:string"/>
<xs:element name="Episodes">
<xs:complexType>
<xs:sequence>
<xs:element name="Episode">
<xs:complexType>
<xs:sequence>
<xs:element name="EpisodeName" type="xs:string"/>
<xs:element name="EpisodeDescription" type="xs:string"/>
</xs:sequence>
<xs:attribute name="nr" type="xs:unsignedByte" use="required" />
<xs:attribute name="releaseDate" type="xs:date" use="required" />
<xs:attribute name="length" type="xs:unsignedByte" use="required" />
<xs:attribute name="lengthType" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="nr" type="xs:unsignedByte" use="required" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Credits">
<xs:complexType>
<xs:sequence>
<xs:element name="Actors">
<xs:complexType>
<xs:sequence>
<xs:element name="Actor" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="FirstName" type="xs:string"/>
<xs:element name="LastName" type="xs:string" />
<xs:element name="Role" type="xs:string" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute name="sex" type="xs:string" use="required" />
<xs:attribute name="birthDate" type="xs:date" use="required" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Directors">
<xs:complexType>
<xs:sequence>
<xs:element name="Director" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="FirstName" type="xs:string"/>
<xs:element name="LastName" type="xs:string"/>
</xs:sequence>
<xs:attribute name="sex" type="xs:string" use="required" />
<xs:attribute name="birthDate" type="xs:date" use="required" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:unsignedByte" use="required" />
<xs:attribute name="releaseYear" type="xs:gYear" use="required" />
<xs:attribute name="endYear" type="xs:gYear" use="optional" />
<xs:attribute name="onGoing" type="xs:boolean" use="required" />
<xs:attribute name="country" type="xs:string" use="required" />
<xs:attribute name="language" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
XSLT HTML
<?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"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
>
<xsl:output method="html" indent="yes"/>
<xsl:template match="/">
<html>
<body>
<xsl:for-each select="/Series/Show">
<xsl:sort select="@releaseYear" data-type="number"/>
<details>
<summary style="font-size:20px;">
<xsl:value-of select="ShowName"/>
<xsl:text> ( </xsl:text>
<xsl:value-of select="@releaseYear"/>
<xsl:text> - </xsl:text>
<xsl:if test="@onGoing='false'">
<xsl:value-of select="@endYear"/>
</xsl:if>
<xsl:text> )</xsl:text>
</summary>
<p>
<xsl:value-of select="ShowDescription"/>
</p>
<p>
<xsl:if test="count(Genres/Genre)>0">
<xsl:text>Genre: </xsl:text>
<xsl:for-each select="Genres/Genre">
<xsl:if test="position() != 1">
<xsl:text>, </xsl:text>
</xsl:if>
<xsl:value-of select="."/>
</xsl:for-each>
</xsl:if>
</p>
<xsl:for-each select="Seasons/Season">
<xsl:sort select="@id" data-type="number"/>
<details>
<summary>
<xsl:text>Season </xsl:text>
<xsl:value-of select="@id"/>
</summary>
<p>
<xsl:value-of select="SeasonDescription"/>
</p>
<p>Episodes:</p>
<ol>
<xsl:for-each select="Episodes/Episode">
<xsl:sort select="@id" data-type="number"/>
<li>
<details>
<summary>
<xsl:value-of select="EpisodeName"/>
</summary>
<p>
<xsl:value-of select="EpisodeDescription"/>
</p>
<p>
<xsl:text>Runtime: </xsl:text>
<xsl:value-of select="@length"/>
<xsl:value-of select="@lengthType"/>
</p>
<p>
<xsl:text>Releasedate: </xsl:text>
<xsl:value-of select="@releaseDate"/>
</p>
</details>
</li>
</xsl:for-each>
</ol>
</details>
</xsl:for-each>
<br/>
<details>
<summary>
<xsl:text>Directors</xsl:text>
</summary>
<ol>
<xsl:for-each select="Credits/Directors/Director">
<li>
<xsl:value-of select="FirstName"/>
<xsl:text> </xsl:text>
<xsl:value-of select="LastName"/>
</li>
</xsl:for-each>
</ol>
</details>
<details>
<summary>
<xsl:text>Actors</xsl:text>
</summary>
<ol>
<xsl:for-each select="Credits/Actors/Actor">
<li>
<xsl:value-of select="FirstName"/>
<xsl:text> </xsl:text>
<xsl:value-of select="LastName"/>
<xsl:text> as </xsl:text>
<xsl:value-of select="Role"/>
</li>
</xsl:for-each>
</ol>
</details>
</details>
<br/>
<br/>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
XSLT XML
<?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="xml" indent="yes"/>
<xsl:param name="dateNow">2017-03-19</xsl:param>
<xsl:template match="/">
<Unaired>
<xsl:for-each select="Series/Show">
<xsl:variable name="showName" select="ShowName"/>
<xsl:variable name ="lastEpDate" select="Seasons/Season[last()]/Episodes/Episode[last()]/@releaseDate"/>
<xsl:if test="translate($dateNow, '- :', '') < translate($lastEpDate, '- :', '')">
<Show id="@id">
<xsl:copy-of select="ShowName" />
<Episodes>
<xsl:for-each select="Seasons/Season">
<xsl:for-each select="Episodes/Episode">
<xsl:if test="translate($dateNow, '- :', '') < translate(@releaseDate, '- :', '')">
<xsl:copy-of select="." />
</xsl:if>
</xsl:for-each>
</xsl:for-each>
</Episodes>
</Show>
</xsl:if>
</xsl:for-each>
</Unaired>
</xsl:template>
</xsl:stylesheet>
Väljund
SIIA PILT VMS