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
Empty file modified README.md
100644 → 100755
Empty file.
10 changes: 10 additions & 0 deletions books.dtd
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!ELEMENT bookstore (book*)>
<!ELEMENT book (title,year,price,author+)>
<!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)>
15 changes: 15 additions & 0 deletions books.xml
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE bookstore [
<!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)>
]>

<bookstore>
<book category="cooking">
<title lang="en">Everyday Italian</title>
Expand Down
84 changes: 84 additions & 0 deletions books.xsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<?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>

<!-- type for title to define attribute-->
<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>
Empty file modified example.xsd
100644 → 100755
Empty file.
Empty file modified results.html
100644 → 100755
Empty file.
Empty file modified results.xml
100644 → 100755
Empty file.
Empty file modified results.xsl
100644 → 100755
Empty file.
4 changes: 4 additions & 0 deletions student.dtd
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
<!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="Sheludko Sergey Dmirtievich" group="К6-361"/>
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>&#xa;</xsl:text>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
17 changes: 17 additions & 0 deletions task21.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?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>

20 changes: 20 additions & 0 deletions task22.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?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>

32 changes: 32 additions & 0 deletions task23.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?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>