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
9 changes: 9 additions & 0 deletions books.dtd
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!DOCTYPE bookstore [
<!ELEMENT bookstore (book*)>
<!ELEMENT book (title,year,price,author+)>
<!ATTLIST book category CDATA #REQUIRED>
<!ATTLIST book cover CDATA #IMPLIED>
<!ATTLIST book cover (hardback|paperback)>
<!ATTLIST title lang CDATA #REQUIRED>
<!ATTLIST title lang CDATA "en">
]>
10 changes: 10 additions & 0 deletions books.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
<!DOCTYPE bookstore [
<!ELEMENT bookstore (book*)>
<!ELEMENT book (title,author+,year,price)>
<!ATTLIST book category CDATA #REQUIRED>
<!ATTLIST book cover CDATA #IMPLIED>
<!ATTLIST book cover (hardback|paperback)>
<!ATTLIST title lang CDATA #REQUIRED>
<!ATTLIST title lang CDATA "en">
]>

<bookstore>
<book category="cooking">
<title lang="en">Everyday Italian</title>
Expand Down
77 changes: 77 additions & 0 deletions books.xsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?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>
5 changes: 4 additions & 1 deletion student.dtd
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
<!ELEMENT student EMPTY>
<!ATTLIST student
fullname CDATA #REQUIRED
group (К6-361|К6-362) #REQUIRED
>
3 changes: 3 additions & 0 deletions student.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE student SYSTEM "student.dtd">
<student fullname="Сашин Александр Андреевич" group="К6-362" />
1 change: 1 addition & 0 deletions task16
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//book
1 change: 1 addition & 0 deletions task17
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//book[@cover]
1 change: 1 addition & 0 deletions task18
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//book[child::year=2003]
1 change: 1 addition & 0 deletions task19
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//book[child::price >= 30 and child::price < 40
15 changes: 15 additions & 0 deletions task20.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?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>&#xA0;</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>&#xA0;</xsl:text>
</xsl:for-each>
</body>
</html>

</xsl:template>
</xsl:stylesheet>
19 changes: 19 additions & 0 deletions task22.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?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>&#xA0;</xsl:text>
</xsl:for-each>
</body>
</html>

</xsl:template>
</xsl:stylesheet>
31 changes: 31 additions & 0 deletions task23.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?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>&#xA0;</xsl:text>
</xsl:for-each>
</body>
</html>

</xsl:template>
</xsl:stylesheet>