Professional Documents
Culture Documents
Lab Assignment - 12
CODE Question 1 :
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="html"/>
<xsl:template match="/">
<html>
<head>
<title>Thesaurus</title>
fi
fi
19BPS1126 E2 Kshitij Lariwal
</head>
<body style="background-color:lightblue;">
<form method="post" action="">
<table style="border:1px solid black;margin-left:auto;margin-
right:auto;">
<tr>
<td>Enter word:</td>
</tr>
<tr>
<td><input type="text" id="search"/></td>
<td><input type="submit" id="submit" value="Submit"/></td>
</tr>
<xsl:variable name="SearchWord"
select="umbraco.library:Request('submit')"/>
<xsl:for-each select="thesaurus/word[@content=$SearchWord]">
<tr>
<td>ENTERED WORD: <xsl:value-of select="@content"/></td>
</tr>
<tr>
<td>Synonyms: <xsl:for-each select="synonyms"><xsl:value-of
select="."/>, </xsl:for-each></td>
</tr>
<tr>
<td>Antonyms: <xsl:for-each select="antonyms"><xsl:value-of
select="."/>, </xsl:for-each></td>
</tr>
</xsl:for-each>
</table>
</form>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
19BPS1126 E2 Kshitij Lariwal
}
</style>
<body style="background-color:lightblue;">
<table border = "1" class="center">
<tr bgcolor = "#FFFF00">
<th>Employee Number</th>
<th>Employee Name</th>
<th>Salary</th>
</tr>
<!-- for-each processing instruction
Looks for each element matching the XPath expression
-->
<xsl:for-each select="class/employee">
<xsl:choose>
<xsl:when test="salary > 100000">
<tr bgcolor="green">
<td>
<!-- value-of processing instruction
process the value of the element matching the XPath expression -->
<xsl:value-of select = "@number"/>
</td>
<td><xsl:value-of select = "name"/></td>
<td><xsl:value-of select = "salary"/></td>
<td>Salary greater than 100000</td>
</tr>
</xsl:when>
<xsl:otherwise>
<tr bgcolor="red">
19BPS1126 E2 Kshitij Lariwal
<td>
<!-- value-of processing instruction
process the value of the element matching the XPath expression -->
<xsl:value-of select = "@number"/>
</td>
<td><xsl:value-of select = "name"/></td>
<td><xsl:value-of select = "salary"/></td>
<td>Salary less than 100000</td>
</tr>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
<!--- Put your DTDDoc comment here. --> <!ELEMENT class (employee)*>
<!--- Put your DTDDoc comment here. --> <!ELEMENT employee (name|
salary)*> <!ATTLIST employee number CDATA #IMPLIED> <!--- Put your
DTDDoc comment here. -->