Created
May 12, 2013 10:05
-
-
Save jalalhejazi/5563046 to your computer and use it in GitHub Desktop.
xslt: book.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | |
<xsl:output method="html"/> | |
<xsl:template match="/"> | |
<html> | |
<head> | |
<title>Books</title> | |
</head> | |
<body> | |
<xsl:apply-templates/> | |
</body> | |
</html> | |
</xsl:template> | |
<xsl:template match="books"> | |
<xsl:apply-templates/> | |
</xsl:template> | |
<xsl:template match="book"> | |
<p> | |
Title: <xsl:value-of select="title" /> | |
</p> | |
</xsl:template> | |
</xsl:stylesheet> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > | |
<xsl:output method="xml" /> | |
<xsl:template match="books"> | |
<books> | |
<xsl:apply-templates /> | |
</books> | |
</xsl:template> | |
<xsl:template match="book"> | |
<book> | |
<xsl:attribute name="isbn" > | |
<xsl:value-of select="isbn" /> | |
</xsl:attribute> | |
<xsl:copy-of select="title" /> | |
</book> | |
</xsl:template> | |
</xsl:stylesheet> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | |
<xsl:output method="html"/> | |
<xsl:template match="/"> | |
<html> | |
<head> | |
<title>Books</title> | |
<link type="text/css" rel="stylesheet" href="style.css"/> | |
</head> | |
<body> | |
<xsl:apply-templates/> | |
</body> | |
</html> | |
</xsl:template> | |
<xsl:template match="books"> | |
<xsl:apply-templates/> | |
</xsl:template> | |
<xsl:template match="book"> | |
<div class="book"> | |
<br/> | |
<address> <xsl:value-of select="title" /> </address> | |
<span> <xsl:value-of select="price" /> $ </span> | |
</div> | |
<div class="book"> | |
<xsl:for-each select="authors/author" > | |
<xsl:value-of select="concat( @fname , ' ' ,@lname )" /> | |
<br/> | |
</xsl:for-each> | |
<span id="eval"> | |
<xsl:if test="count(reviews/review)"> | |
<xsl:for-each select="reviews/review"> | |
<xsl:value-of select="." /> | |
<br/> | |
</xsl:for-each> | |
</xsl:if> | |
</span> | |
<br/> | |
</div> | |
</xsl:template> | |
</xsl:stylesheet> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<?xml-stylesheet type="text/xsl" href="book.xsl"?> | |
<books> | |
<book isbn="1-861002-85-8"> | |
<title>Professional Java XML Programming</title> | |
<publisher>Wrox Press</publisher> | |
<price>35.99</price> | |
<pages>772</pages> | |
<chapters>13</chapters> | |
<appendices>13</appendices> | |
<authors> | |
<author fname="Alexander" lname="Nakhimovsky"/> | |
<author fname="Tom" lname="Myers"/> | |
</authors> | |
<reviews> | |
<review eval="4">Good introduction to Java and XML</review> | |
<review eval="5">Comprehensive coverage of latest XML and Java news</review> | |
</reviews> | |
</book> | |
<book isbn="1-861003-12-9"> | |
<title>XSLT Programmer's Reference</title> | |
<publisher>Wrox Press</publisher> | |
<price>25.99</price> | |
<pages>777</pages> | |
<chapters>10</chapters> | |
<appendices>2</appendices> | |
<authors> | |
<author fname="Michael" lname="Kay"/> | |
</authors> | |
<reviews> | |
<review eval="5">Superb and detailed descriptions of everything</review> | |
<review eval="5">Good examples</review> | |
</reviews> | |
</book> | |
<book isbn="0-201-63361-2" discounted="0.85"> | |
<title>Design Patterns</title> | |
<publisher>Addison Wesley</publisher> | |
<price>29.95</price> | |
<pages>395</pages> | |
<chapters>6</chapters> | |
<appendices>3</appendices> | |
<authors> | |
<author fname="Erich" lname="Gamma"/> | |
<author fname="Richard" lname="Helm"/> | |
<author fname="Ralph" lname="Johnson"/> | |
<author fname="John" lname="Vlissides"/> | |
</authors> | |
<reviews> | |
<review eval="5">Excellent coverage of OO design patterns</review> | |
<review eval="4">The definitive text on reusable patterns</review> | |
<review eval="5">A must-read for all OO designers and architects</review> | |
</reviews> | |
</book> | |
<book isbn="1-56592-515-7"> | |
<title>Web Design in a Nutshell</title> | |
<publisher>O'Reilly</publisher> | |
<price>18.95</price> | |
<pages>560</pages> | |
<chapters>27</chapters> | |
<appendices>5</appendices> | |
<authors> | |
<author fname="Jennifer" lname="Niederst"/> | |
</authors> | |
<reviews> | |
</reviews> | |
</book> | |
</books> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Design by Jalal Hejazi 2010-04-01 */ | |
body { | |
background-color: #222; | |
font-size: 1.2em; | |
border:20px #FF3300 solid ; | |
} | |
div.book { | |
position: relative; | |
left: 150px; | |
top: 30px; | |
padding-bottom: 20px; | |
} | |
div.book span { | |
color: green; | |
} | |
div.book span#eval{ | |
color:#FF9933; | |
position:relative; | |
left:50px; | |
} | |
address { | |
font-size: large ; | |
display: inline; | |
color: white; | |
padding-right: 10px; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment