admin write
blogblogblogbloglocation loglocation logtag listtag listguest bookguest book
rss feed

10rwebp #4

2007. 4. 20. 12:28

지난주에 만들었던 booklist
employee에는 없는 새로운 개념이 다수 있으니 참고

- booklist.xml -

<?xml version="1.0" encoding="euc-kr"?>

<!-- XSL 문서 적용 -->
<?xml-stylesheet type="text/xsl" href="booklist.xsl"?>

<booklist>
   
  <book id="b1" kind="computer">
    <title>JSP And Servlet</title>
    <author>이규미</author>
    <publisher>인포북</publisher>
    <price>25000</price>
  </book>

  <book id="b2" kind="computer">
    <title>Inside XML</title>
    <author>신민철</author>
    <publisher>디지털북스</publisher>
    <price>35000</price>
  </book>

  <book id="b3" kind="language">
    <title>쉽게 배우는 영어</title>
    <author>채규태</author>
    <publisher>시사영어사</publisher>
    <price>20000</price>
  </book>

  <book id="b4" kind="computer">
    <title>XML 전자상거래</title>
    <author>이종호</author>
    <publisher>정보문화사</publisher>
    <price>28000</price>
  </book>

  <book id="b5" kind="소설">
    <title>사랑과 전쟁</title>
    <author>이사랑</author>
    <publisher>전쟁문화사</publisher>
    <price>15000</price>
  </book>

  <book id="b6" kind="수필">
    <title>사랑을 느끼세요</title>
    <author>이사랑</author>
    <publisher>사랑출판사</publisher>
    <price>15000</price>
  </book>

  <book id="b7" kind="잡지">
    <title>월간 중앙</title>
    <author>중앙일보기자</author>
    <publisher>중앙일보사</publisher>
    <price>18000</price>
  </book>

  <book id="b8" kind="잡지">
    <title>주간 경제지</title>
    <author>조선일보기자</author>
    <publisher>조선일보사</publisher>
    <price>27000</price>
  </book>
</booklist>



- booklist.xsl -

<?xml version='1.0' encoding='UTF-8'?>
<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>

<xsl:template match='/'>
<html>
<body>
<h2><font color='blue'>Our Book's List</font></h2>
<table border='1' cellspacing='0' width='80%'>
<tr bgcolor='#ffff66'><th>title</th><th>kind</th><th>author</th><th>publisher</th><th>price</th></tr>

<xsl:apply-templates select='booklist/book'>
<xsl:sort select='price' data-type='number' order='ascending' />
</xsl:apply-templates>
<!--xsl:apply-templates select='booklist/book[@kind="잡지"]' mode='b'/-->
</table>
<p><xsl:call-template name='company'/></p>
</body></html>
</xsl:template>

<xsl:template match='//book'>
<tr>
<td><font color=''><xsl:value-of select='title'/></font></td>
<td><font color=''><xsl:value-of select='@kind'/></font></td>
<td><font color=''><xsl:value-of select='author'/></font></td>
<td><font color=''><xsl:value-of select='publisher'/></font></td>
<td><font color=''><xsl:value-of select='price'/></font></td>
</tr>
</xsl:template>
<!--
<xsl:template match='//book' mode='b'>
<tr>
<td><font color='red'><xsl:value-of select='title'/></font></td>
<td><font color='red'><xsl:value-of select='author'/></font></td>
</tr>
</xsl:template> -->
<xsl:template name='company'>
<font color='blue'>옥동자 소프트웨어</font>
</xsl:template>
</xsl:stylesheet>