Created
July 22, 2012 03:57
-
-
Save edames/3158319 to your computer and use it in GitHub Desktop.
Extensible Markup Language
This file contains 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
<table> | |
<tr> | |
<td>John <!-- Missing Closing Tag --> | |
<td>Smith</td> | |
<td>Lincoln, NE</td> | |
</tr> | |
</table> |
This file contains 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
<!-- Notice: XML, DTD, XML Schema, XSLT start with the XML version and encoding --> | |
<?xml version="1.0" encoding="UTF-8"?> | |
<!ELEMENT employee (lastname, firstname, address, city, state, zipcode)> | |
<!ELEMENT firstname (#PCDATA)> | |
<!ELEMENT lastname (#PCDATA)> | |
<!ELEMENT address (#PCDATA)> | |
<!ELEMENT city (#PCDATA)> | |
<!ELEMENT state (#PCDATA)> | |
<!ELEMENT zipcode (#PCDATA)> | |
<!--Comment describing your root element--> | |
<!ELEMENT employees ((employee))> |
This file contains 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
<employee> | |
<employee> | |
<firstname>John</firstname> | |
<lastname>Smith</lastname> | |
<address>123 West Avenue</address> | |
<city>Lincoln</city> | |
<state>Nebraska</state> | |
<zipcode>68588</zipcode> | |
</employee> | |
</employee> |
This file contains 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"?> | |
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> | |
<xs:complexType name="employeeType"/> | |
<xs:element name="employee"> | |
<xs:complexType> | |
<xs:sequence> | |
<xs:element ref="firstname"/> | |
<xs:element ref="lastname"/> | |
<xs:element ref="address"/> | |
<xs:element ref="city"/> | |
<xs:element ref="state"/> | |
<xs:element ref="zipcode"/> | |
</xs:sequence> | |
</xs:complexType> | |
</xs:element> | |
<xs:element name="firstname" type="xs:string"/> | |
<xs:element name="lastname" type="xs:string"/> | |
<xs:element name="address" type="xs:string"/> | |
<xs:element name="city" type="xs:string"/> | |
<xs:element name="state" type="xs:string"/> | |
<xs:element name="zipcode" type="xs:string"/> | |
<xs:element name="employees"> | |
<xs:annotation> | |
<xs:documentation>Comment describing your root element</xs:documentation> | |
</xs:annotation> | |
<xs:complexType> | |
<xs:complexContent> | |
<xs:extension base="employeeType"> | |
<xs:sequence> | |
<xs:element ref="employee"/> | |
</xs:sequence> | |
</xs:extension> | |
</xs:complexContent> | |
</xs:complexType> | |
</xs:element> | |
</xs:schema> |
This file contains 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="iso-8859-1"?> | |
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2004/10/xpath-functions" xmlns:xdt="http://www.w3.org/2004/10/xpath-datatypes"> | |
<xsl:output version="1.0" encoding="iso-8859-1" indent="no" omit-xml-declaration="yes" media-type="text/xml" /> | |
<xsl:template match="/"> | |
<html> | |
<head> | |
<title>Employee Example</title> | |
</head> | |
<body> | |
<table cellpadding="0" cellspacing="0" border="0" width="776" bgcolor="#ffffff"> | |
<tr valign="top"> | |
<td><div style="margin: 5px 5px 5px 5px;"> | |
<h3>Employees</h3> | |
<xsl:for-each select="employees"> | |
<xsl:for-each select="employee"> | |
Name: <xsl:for-each select="firstname"> | |
<xsl:apply-templates /> | |
</xsl:for-each> | |
 <xsl:for-each select="lastname"> | |
<xsl:apply-templates /> | |
</xsl:for-each> | |
<br />Address: <xsl:for-each select="address"> | |
<xsl:apply-templates /> | |
</xsl:for-each> | |
<br />City: <xsl:for-each select="city"> | |
<xsl:apply-templates /> | |
</xsl:for-each> | |
<br />State: <xsl:for-each select="state"> | |
<xsl:apply-templates /> | |
</xsl:for-each> | |
<br />Zip Code: <xsl:for-each select="zipcode"> | |
<xsl:apply-templates /> | |
</xsl:for-each> | |
</xsl:for-each> | |
</xsl:for-each> | |
</div></td> | |
</tr> | |
</table> | |
</body> | |
</html> | |
</xsl:template> | |
</xsl:stylesheet> |
This file contains 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
<p></b>Employee</p></b> <!-- Improperly nested --> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment