Skip to content
Snippets Groups Projects
Commit 0685991a authored by Goik Martin's avatar Goik Martin
Browse files

Memo XSD + XSL completed

parent d1db55ca
No related branches found
No related tags found
No related merge requests found
<!ELEMENT memo (from, to+, date, subject, content)>
<!ELEMENT from (name, surname)>
<!ELEMENT to (name, surname)>
<!ELEMENT date EMPTY>
<!ATTLIST date
year NMTOKEN #REQUIRED
month NMTOKEN #REQUIRED
day NMTOKEN #REQUIRED>
<!ELEMENT subject (#PCDATA)>
<!ELEMENT content (para)+>
<!ELEMENT para (#PCDATA)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT surname (#PCDATA)>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning" elementFormDefault="qualified"
vc:minVersion="1.0" vc:maxVersion="1.1">
<xs:element name="memo">
<xs:complexType>
<xs:sequence>
<xs:element name="from" type="nameSurname"/>
<xs:element name="to" minOccurs="1" maxOccurs="unbounded" type="nameSurname"/>
<xs:element name="date" type="xs:date"/>
<xs:element name="subject" type="xs:string"/>
<xs:element ref="content"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="nameSurname">
<xs:sequence>
<xs:element name="name" type="xs:string"/>
<xs:element name="surname" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:element name="content">
<xs:complexType>
<xs:sequence>
<xs:element name="para" type="xs:string"
minOccurs="1" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- $Id: memo2html.xsl 148 2006-03-17 13:57:51Z goik $ -->
<xsl:stylesheet version="1.0" xmlns:xsl=
"http://www.w3.org/1999/XSL/Transform">
<xsl:stylesheet version="2.0" xmlns:xsl=
"http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xsl:output method="html" indent="yes"/>
......@@ -10,64 +11,56 @@
</xsl:template>
<xsl:template match="memo">
<HTML>
<TITLE>
<html>
<title>
<xsl:text>Short message from: </xsl:text>
<xsl:value-of select="from/name"/>
<xsl:text> </xsl:text>
<xsl:value-of select="from/surname"/>
<xsl:text>, </xsl:text>
<xsl:apply-templates select="datum"/>
</TITLE>
<BODY>
<H1>
<xsl:value-of select='format-date(date, "[D].[M].[Y]")'/>
</title>
<body>
<h1>
<xsl:text>Short message from: </xsl:text>
<xsl:value-of select="from/name"/>
<xsl:text> </xsl:text>
<xsl:value-of select="from/surname"/>
</H1>
To:
</h1>
<p>To:</p>
<UL>
<ul>
<xsl:for-each select="to">
<LI>
<li>
<xsl:apply-templates select="."/>
</LI>
</li>
</xsl:for-each>
</UL>
<P>
Date:
<B>
<xsl:apply-templates select="date"/>
</B>
</P>
<P>
<B>Subject:<xsl:value-of select="subject"/></B>
</ul>
<p>
<xsl:text>Date: </xsl:text>
<b>
<xsl:value-of select='format-date(date, "[D].[M].[Y]")'/>
</b>
</p>
<p>
<b>Subject:<xsl:value-of select="subject"/></b>
<xsl:apply-templates select="content"/>
</P>
</BODY>
</HTML>
</xsl:template>
<xsl:template match="date">
<xsl:value-of select="@month"/>
<xsl:text>/</xsl:text>
<xsl:value-of select="@day"/>
<xsl:text>/</xsl:text>
<xsl:value-of select="@year"/>
</p>
</body>
</html>
</xsl:template>
<xsl:template match="from|to">
<xsl:value-of select="name"/>
<xsl:text> </xsl:text>
<B>
<b>
<xsl:value-of select="surname"/>
</B>
</b>
</xsl:template>
<xsl:template match="content">
<xsl:for-each select="para">
<P><xsl:value-of select="."/></P>
<p><xsl:value-of select="."/></p>
</xsl:for-each>
</xsl:template>
......
<?xml version="1.0" ?>
<!DOCTYPE memo SYSTEM "memo.dtd">
<memo>
<memo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="memo.xsd">
<from>
<name>Martin</name>
<surname>Goik</surname>
......@@ -13,7 +13,7 @@
<name>Eve</name>
<surname>Intruder</surname>
</to>
<date year="2005" month="1" day="6"/>
<date>2014-11-29</date>
<subject>Firewall problems</subject>
<content>
<para>Thanks for your excellent work.</para>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment