|
| THE XML REVOLUTION - TECHNOLOGIES FOR THE FUTURE WEB |
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns="http://www.w3.org/1999/xhtml">
<xsl:template match="card">
<html>
<head>
<title><xsl:value-of select="name/text()"/></title>
</head>
<body bgcolor="#ffffff">
<table border="3">
<tr>
<td>
<xsl:apply-templates select="name"/><br/>
<xsl:apply-templates select="title"/><p/>
<tt><xsl:apply-templates select="email"/></tt><br/>
<xsl:if test="phone">
Phone: <xsl:apply-templates select="phone"/><br/>
</xsl:if>
</td>
<td>
<xsl:if test="logo">
<img src="{logo/@url}"/>
</xsl:if>
</td>
</tr>
</table>
</body>
</html>
</xsl:template>
<xsl:template match="name">
<xsl:value-of select="text()"/>
</xsl:template>
<xsl:template match="title">
<xsl:value-of select="text()"/>
</xsl:template>
<xsl:template match="email">
<xsl:value-of select="text()"/>
</xsl:template>
<xsl:template match="phone">
<xsl:value-of select="text()"/>
</xsl:template>
</xsl:stylesheet>
|
The transformation applied to the business card:
<card> <name>John Doe</name> <title>CEO, Widget Inc.</title> <email>john.doe@widget.com</email> <phone>(202) 555-1414</phone> <logo url="widget.gif"/> </card> |
looks like:
| John Doe CEO, Widget Inc. john.doe@widget.com |
![]() |
|
| COPYRIGHT © 2000-2003 ANDERS MØLLER & MICHAEL I. SCHWARTZBACH |
|