Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions books.dtd
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!ELEMENT bookstore (book*)>
<!ELEMENT book (title, author+, year, price)>
<!ATTLIST book category CDATA #REQUIRED
cover (hardback|paperback) #IMPLIED
>
<!ELEMENT title (#PCDATA)>
<!ATTLIST title
lang CDATA "en"
>
<!ELEMENT author (#PCDATA)>
<!ELEMENT year (#PCDATA)>
<!ELEMENT price (#PCDATA)>
2 changes: 2 additions & 0 deletions books.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE bookstore SYSTEM "books.dtd">
<bookstore>
<book category="cooking">
<title lang="en">Everyday Italian</title>
Expand Down
68 changes: 68 additions & 0 deletions books.xsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="bookstore" type="bookstoreType"/>
<xs:complexType name="bookstoreType">
<xs:sequence>
<xs:element name="book" type="bookType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="bookType">
<xs:sequence>
<xs:element name="title">
<xs:complexType>
<xs:simpleContent>
<xs:restriction base="titleType">
<xs:minLength value="2"/>
<xs:maxLength value="30"/>
</xs:restriction>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="author" minOccurs="1" maxOccurs="unbounded">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="2"/>
<xs:maxLength value="30"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="year">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:minInclusive value="1900"/>
<xs:maxInclusive value="2014"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="price">
<xs:simpleType>
<xs:restriction base="xs:decimal">
<xs:minInclusive value="0"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
<xs:attribute name="category" type="xs:string" use="required"/>
<xs:attribute name="cover" use="optional">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="hardback"/>
<xs:enumeration value="paperback"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
<xs:complexType name="titleType">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="lang" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:length value="2"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:schema>
6 changes: 5 additions & 1 deletion student.dtd
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
<!ELEMENT student EMPTY>
<!ELEMENT student ANY>
<!ATTLIST student
fullname CDATA #REQUIRED
group (К6-361|К6-362) #REQUIRED
>
4 changes: 4 additions & 0 deletions student.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE student SYSTEM "student.dtd">
<student fullname = "Chaikovskaia Aleksandra" group = "К6-362">
</student>
1 change: 1 addition & 0 deletions task16
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"/bookstore/book"
1 change: 1 addition & 0 deletions task17
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"/bookstore/book[@cover]"
1 change: 1 addition & 0 deletions task18
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"/bookstore/book[@year=2003]"
1 change: 1 addition & 0 deletions task19
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"/bookstore/book[@price>=30 and @price<40]"
14 changes: 14 additions & 0 deletions task20.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:template match="/">
<html>
<body>
<xsl:for-each select="//book">
<xsl:value-of select="title"/> <xsl:text>&#xa;</xsl:text>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

16 changes: 16 additions & 0 deletions task21.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:template match="/">
<html>
<body>
<xsl:for-each select="//book">
<xsl:sort select="price"/>
<xsl:value-of select="title"/>
<xsl:text>&#xa;</xsl:text>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

18 changes: 18 additions & 0 deletions task22.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:template match="/">
<html>
<body>
<xsl:for-each select="//book">
<xsl:value-of select="title"/>
<xsl:if test="count(author) &gt; 1">
<xsl:text>*</xsl:text>
</xsl:if>
<xsl:text>&#xa;</xsl:text>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

29 changes: 29 additions & 0 deletions task23.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:template match="/">
<html>
<body>
<xsl:for-each select="//book">
<xsl:value-of select="title"/>
<xsl:choose>
<xsl:when test="price &gt; 30">
<xsl:text>&gt;30</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="price &lt; 30">
<xsl:text>&lt;30</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>=30</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
<xsl:text>&#xa;</xsl:text>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
28 changes: 28 additions & 0 deletions task24.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:template match="/">
<html>
<body>
<xsl:text>&lt;?xml version="1.0" encoding="UTF-8"?&gt;&#xa;&lt;library&gt;</xsl:text>
<xsl:apply-templates/>
<xsl:text>&lt;/library&gt;</xsl:text>
</body>
</html>
</xsl:template>
<xsl:template match="book">
<xsl:text>&lt;book title="</xsl:text>
<xsl:value-of select="title"/>
<xsl:text>" year="</xsl:text>
<xsl:value-of select="year"/>
<xsl:text>"&gt;</xsl:text>
<xsl:apply-templates select="author"/>
<xsl:text>&lt;/book&gt;</xsl:text>
</xsl:template>
<xsl:template match="author">
<xsl:text>&lt;author name="</xsl:text>
<xsl:value-of select="."/>
<xsl:text>"&gt;</xsl:text>
<xsl:text>&lt;/author&gt;</xsl:text>
</xsl:template>
</xsl:stylesheet>