Web Basics · Web and Internet Technology

HTML, CSS, XML, XSL, Query Languages for XML

Watch lectures

HTML, CSS, XML, XSL, Query Languages for XML

SVGVector Architecture Diagram (SVG)
WEB & INTERNET TECHNOLOGY · Module 1★ MCQ FavouriteHTML, CSS, XML, XSL & XPathBEU CSE Sem 6 · Code 105614 · Web BasicsMNEMONICHTML structures pages, CSS styles them, XML carries data, XSL transforms it.XPath selects nodes; XQuery is SQL for XML (FLWOR).Core BreakdownHTMLFixed tags that structure web pages; HTML5 is the living standard.Describes structure and meaning; it is not a programming language.CSSRule syntax: selector { property: value; }. Controls look and layout.Apply inline, internal (style tag) or external (link to a .css file).XMLUser-defined tags that describe and carry data; must be well-formed.Case-sensitive, one root, every tag closed; platform independent.XSLXSLT transforms XML, XPath addresses nodes, XSL-FO formats print.Can sort, filter and rebuild a tree; CSS can only style it.QueriesXPath selects nodes, e.g. //student[marks>85]/name.XQuery uses FLWOR: for, let, where, order by, return.Diagram: Data to PageXML data students.xmlXPath / XQuery select the nodesXSLT + XSL transformHTML + CSS shown in the browserPI linkxml-stylesheetSelectorsh1 .c #idFLWORfor/where/returnData (XML) + Style (CSS/XSL) = Web page⚠️ Exam Traps & Viva Favorites① HTML versus XML?HTML displays data with fixed tags and forgiveserrors. XML describes data with your own tagsand must be well-formed.② CSS versus XSL?CSS only styles existing elements. XSL transforms:sort, filter and restructure XML into HTMLor text.③ BEU 2026 Q1(b) answer?HTML structures pages, XML allows own tags, CSSpresents HTML or XML, XSL transforms XML.All four are correct: option 1, 2, 3 and 4.Tip: link styles with the xml-stylesheet PIMaster Revision Table(learn it row by row!)TechnologyFull formPurposeRemarkHTMLHyperText Markup LanguageStructure of web pagesPredefined tagsCSSCascading Style SheetsPresentation and layoutThree ways to applyXMLeXtensible Markup LanguageDescribe and carry dataUser-defined tagsXSLTXSL TransformationsConvert XML to other formsUses XPath templatesXPathXML Path LanguageSelect nodes/a/b, //b[@id='1']XQueryXML Query LanguageQuery XML like SQLFLWOR expressionsQUICK FACTSXML 1998 (W3C) · CSS rule: selector { property: value; }XPath: count(//student) = 2 on the sample students.xmlLink a stylesheet: <?xml-stylesheet type='text/xsl' href='st.xsl'?>VERIFIED★ Golden rule: XML holds the data,CSS or XSL decides how it looks.

1. Big picture: who does what?

SVGVector Architecture Diagram (SVG)
HTMLstructure of web page XMLstructure of data CSS / XSLpresentation / transform Browser viewformatted page XPath / XQueryquery the data
Technology Full form / type Purpose
HTML HyperText Markup Language Structure and content of web pages
CSS Cascading Style Sheets Look and layout of HTML/XML
XML eXtensible Markup Language Describe and transport data with user-defined tags
XSL eXtensible Stylesheet Language Transform/format XML (XSLT + XSL-FO + XPath)
XPath / XQuery XML query languages Select and extract data from XML

2. HTML (HyperText Markup Language)

  • Standard markup language for web documents; a fixed set of tags; HTML5 is the current living standard.
  • Describes structure and semantics: headings, paragraphs, links, lists, tables, forms, media.
  • Not a programming language; case-insensitive; browsers are forgiving.
<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><title>My Page</title></head>
<body>
  <h1>Welcome</h1>
  <p>Hello <a href="https://www.beu.ac.in">BEU</a></p>
</body>
</html>

(Details of tags, tables, forms in Module 2.)

3. CSS (Cascading Style Sheets)

CSS controls presentation – colours, fonts, spacing, layout – and separates it from structure.

Rule syntax: selector { property: value; }

h1 { color: navy; text-align: center; }
.note { background: #eef; padding: 8px; }
#top { font-size: 20px; }

Selectors: element (h1), class (.note), id (#top). "Cascading" = when rules conflict, priority is decided by origin, specificity and order.

Three ways to apply CSS

Method Where Example
Inline style attribute on element <p style="color:red">
Internal <style> in <head> <style> p {color:red} </style>
External separate .css file linked with <link> <link rel="stylesheet" href="a.css">

Benefits: consistent look, smaller pages, easy maintenance, faster loading through caching. CSS can also style XML: <?xml-stylesheet type="text/css" href="a.css"?>.

4. XML (eXtensible Markup Language)

  • W3C recommendation (1998), a simplified subset of SGML.
  • Describes data, not how to display it; tags are user-defined and self-descriptive.
  • Platform- and software-independent – used for data exchange, config files, RSS, SVG, web services (SOAP).
<?xml version="1.0"?>
<students>
  <student roll="101"><name>Ravi</name><marks>82</marks></student>
  <student roll="102"><name>Sita</name><marks>91</marks></student>
</students>

HTML vs XML

HTML XML
Displays data Describes/stores data
Predefined tags User-defined tags
Errors tolerated Must be well-formed
Case-insensitive Case-sensitive
Closing tags optional (some) Closing tags compulsory
Presentation-oriented Content-oriented

5. XSL (eXtensible Stylesheet Language)

XSL is a family of W3C recommendations for styling XML:

  1. XSLT – transforms an XML tree into another tree (HTML, text, another XML).
  2. XPath – addressing parts of an XML document (used inside XSLT).
  3. XSL-FO – formatting objects, for print/PDF output.
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="html"/>
  <xsl:template match="/">
    <table border="1">
      <tr><th>Roll</th><th>Name</th></tr>
      <xsl:for-each select="students/student[marks &gt; 85]">
        <tr><td><xsl:value-of select="@roll"/></td><td><xsl:value-of select="name"/></td></tr>
      </xsl:for-each>
    </table>
  </xsl:template>
</xsl:stylesheet>

(The stylesheet above is well-formed; its select expression picks only students with marks above 85, i.e. Sita, roll 102.) Link it with <?xml-stylesheet type="text/xsl" href="st.xsl"?>.

CSS vs XSL

CSS XSL
Only styles existing elements Can restructure, sort, filter, add content
Simple, not XML syntax XML syntax, more powerful
Works with HTML and XML Mainly XML
Cannot reorder nodes Can reorder/select nodes
MermaidDiagram
Rendering diagram…

6. Query languages for XML

Language Role
XPath Path expressions to select nodes (/students/student/name)
XQuery Full query language for XML (FLWOR expressions), like SQL for XML
XSLT Transform using XPath templates
XPointer / XLink Address fragments and link XML resources (Module 3)

XPath examples (tested with xmllint on the student XML)

Expression Result
//student/name all name elements
//student[marks>85]/name Sita
//student[@roll='101'] the student with roll 101
count(//student) 2
/students/student[1] first student

XQuery (FLWOR) example

for $s in doc("students.xml")/students/student
where $s/marks > 85
order by $s/name
return <topper>{ $s/name/text() }</topper>

FLWOR = For, Let, Where, Order by, Return.

7. Putting it together

A typical page: data in XML → filtered by XPath/XQuery → converted to HTML with XSLT → styled with CSS → displayed by the browser.

Frequently Asked Questions

QWhat is the difference between HTML and XML?

HTML presents data with predefined tags and tolerates errors; XML describes data with user-defined tags and must be well-formed.

QWhat is CSS and why is it used?

Cascading Style Sheets define the presentation (colour, font, layout) of HTML/XML, separating content from style for consistency and easy maintenance.

QWhat are the three ways to include CSS?

Inline (style attribute), internal (<style> element in head) and external (<link> to a .css file).

QWhat is XSL? Name its parts.

A style language for XML: XSLT (transformation), XPath (addressing), XSL-FO (formatting objects).

QDifference between CSS and XSL?

CSS only styles; XSL can transform, sort, filter and generate new structure from XML.

QWhat is XPath?

A language of path expressions to select nodes in an XML document, e.g. //student[marks>85]/name.

QWhat is XQuery?

A query language for XML using FLWOR expressions, like SQL for relational data.

QWhich technologies are used for structuring/presenting web documents and data? (BEU 2026 Q1b)

HTML structures web documents; XML allows user-defined tags; CSS defines presentation of HTML/XML; XSL transforms/presents XML. All four statements are correct, so the answer is "1, 2, 3 and 4".

QCan a browser display raw XML?

Yes, as a tree of tags, but to format it use CSS or transform it to HTML with XSLT.

QWhat is the use of the `xml-stylesheet` processing instruction?

It links an XML document to a CSS or XSL stylesheet.

Free AppAndroid App

Coursify Android App

Generate AI courses, take quick quizzes between classes, and master complex engineering concepts on the go.

← All Web and Internet Technology modules