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
10 changes: 10 additions & 0 deletions book.dtd
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!ELEMENT books (book+)>
<!ELEMENT book (title, year, price, author+)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT year (#PCDATA)>
<!ELEMENT price (#PCDATA)>
<!ELEMENT author (#PCDATA)>
<!ATTLIST book
category CDATA #REQUIRED
cover CDATA #IMPLIED (paperback|hardback)>
<!ATTLIST title lang CDATA #REQUIRED "en">
10 changes: 10 additions & 0 deletions books.dtd
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!ELEMENT books (book+)>
<!ELEMENT book (title, year, price, author+)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT year (#PCDATA)>
<!ELEMENT price (#PCDATA)>
<!ELEMENT author (#PCDATA)>
<!ATTLIST book
category CDATA #REQUIRED
cover CDATA #IMPLIED (paperback|hardback)>
<!ATTLIST title lang CDATA #REQUIRED "en">
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 student SYSTEM "books.dtd">
<bookstore>
<book category="cooking">
<title lang="en">Everyday Italian</title>
Expand Down
63 changes: 63 additions & 0 deletions books.xsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

<xs:simpleType name="lang">
<xs:restriction base="xs:string">
<xs:length value="2">
</xs:restriction>
</xs:simpleType>

<xs:simpleType="author">
<xs:restriction base="xs:string">
<xs:minLength value="2"/>
<xs:maxLength value="30"/>
</xs:restriction>
</xs:simpleType>

<xs:simpleType name="price">
<xs:restriction base="xs:integer">
<xs:minInclusive value="0"/>
</xs:restriction>
</xs:simpleType>

<xs:simpleType name="year">
<xs:restriction base="xs:integer">
<xs:minInclusive value="1900"/>
<xs:maxInclusive value="2014"/>
</xs:restriction>
</xs:simpleType>

<xs:simpleType name="cover">
<xs:restriction base="xs:string">
<xs:pattern value="(hard|paper)cover"/>
</xs:restriction>
</xs:simpleType>

<xs:complexType name="title">
<xs:restriction base="xs:string">
<xs:minLength value="2"/>
<xs:maxLength value="30"/>
</xs:restriction>
<xs:attribute name="lang" type="lang" use="required"/>
</xs:complexType>

<xs:complexType name="bookstore">
<xs:sequence>
<xs:element name="book" type="book"/>
</xs:sequence>
</xs:complexType>

<xs:complexType name="book">
<xs:sequence>
<xs:element name="title" type="title"/>
<xs:sequence>
<xs:element name="author" type="author"/>
</xs:sequence>
<xs:element name="year" type="year"/>
<xs:element name="price" type="price"/>
</xs:sequence>
<xs:attribute name="category" type="xs:string" use="required"/>
<xs:attribute name="cover" type="cover"/>
</xs:complexType>

<xs:element name="bookstore" type="bookstore"/>
5 changes: 5 additions & 0 deletions student.dtd
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
<!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="Vladimir" group="K5-362"/>
1 change: 1 addition & 0 deletions task16.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/bookstore/*
1 change: 1 addition & 0 deletions task17.txt
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 task18.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//book[child::year=2003]
1 change: 1 addition & 0 deletions task19.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//book[child::price>=30 and child::price<40]
8 changes: 8 additions & 0 deletions task20.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:template match="/">
<xsl:for-each select="//book">
<xsl:value-of select="child::title"/>,
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
9 changes: 9 additions & 0 deletions task21.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:template match="/">
<xsl:for-each select="//book">
<xsl:sort select="price"/>
<xsl:value-of select="child::title"/>,
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>