« Home « Kết quả tìm kiếm

Ngôn ngữ XML-Bài 5


Tóm tắt Xem thử

- <book id="bk102">.
- <price>5.95</price>.
- childhood to become queen of the world.</description>.
- <book id="bk107">.
- <price>4.95</price>.
- <description>A deep sea diver finds true love twenty thousand leagues beneath the sea.</description>.
- <book id="bk108">.
- insects.</description>.
- <book id="bk109">.
- <price>6.95</price>.
- discovers the problems of being quantum.</description>.
- <book id="bk110">.
- reference.</description>.
- <xsl:for-each select="//book">.
- <td>.
- <xsl:value-of select="title"/>.
- </td>.
- <xsl:if test="price >.
- 6">.
- <xsl:attribute name="bgcolor">cyan</xsl:attribute>.
- </xsl:if>.
- <xsl:value-of select="price"/>.
- </xsl:for-each>.
- <xsl:choose>.
- <xsl:when test="self::*[genre = 'Romance']">.
- <xsl:attribute name="style">background-color:.
- pink</xsl:attribute>.
- </xsl:when>.
- <xsl:when test="self::*[genre = 'Fantasy']">.
- lightblue</xsl:attribute>.
- <xsl:otherwise>.
- lightgreen</xsl:attribute>.
- </xsl:otherwise>.
- </xsl:choose>.
- Để ý là cặp Tags <xsl:choose>,</xsl:choose>.
- <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform".
- <xsl:template match gt;.
- bgcolor="silver">.
- <b>ID</b>.
- </TD>.
- <b>Author</b>.
- <b>Title</b>.
- <b>Genre</b>.
- <b>Price</b>.
- <b>Description</b>.
- <TD>.
- <xsl:value-of select="@id"/>.
- <xsl:value-of select="author"/>.
- <xsl:value-of select="genre"/>.
- <xsl:value-of select="publish_date"/>.
- <xsl:value-of select="description"/>.
- </xsl:template>.
- </xsl:stylesheet>.
- href="catalog.xsl"?>.
- <P>Order No:.
- <xsl:value-of select="Order/@OrderNo"/>.
- </P>.
- <P>Date:.
- <xsl:value-of select="Order/OrderDate"/>.
- <P>Customer:.
- <xsl:value-of select="Order/Customer"/>.
- <xsl:for-each select="Order/Item">.
- <xsl:apply-templates></xsl:apply-templates>.
- <xsl:template match="Product[@UnitPrice >.
- 70]">.
- <xsl:value-of select="@ProductID"/>.
- <A>.
- <xsl:attribute name="HREF">Products.asp?ProductID=.
- </xsl:attribute>.
- <xsl:value-of select gt;.
- </A>.
- <FONT color="red">.
- <xsl:value-of select="@UnitPrice"/>.
- <xsl:template match="Product">.
- <xsl:template match="Quantity">.
- <P>Date lt;/P>.
- <A HREF="Products.asp?ProductID=1">Chair</A>.
- <A HREF="Products.asp?ProductID=2">Desk</A>.
- <TD><FONT color="red">250</FONT></TD>.
- href="Order.xsl"?>.
- <SCRIPT language="javascript">.
- <BODY onload="init()">.
- <div id="resDOM"></div>

Xem thử không khả dụng, vui lòng xem tại trang nguồn
hoặc xem Tóm tắt