Skip to main content

XML document, XSLT and WSDL

Short answer

An XML document is a text file with a hierarchical tree of user-defined tags, consisting of prolog, one root element, child elements and attributes, and must be well-formed. XSLT transforms XML into other formats like HTML using template rules and XPath. WSDL is an XML language that describes a web service's operations, messages, and endpoint address for clients.

Explain about XML document? Explain XSLT and WSDL.

XML document

An XML document is a text file that stores data in a hierarchical tree of elements with user-defined tags. It consists of a prolog (<?xml version="1.0"?>, optional DOCTYPE), one root element, child elements, attributes, text, comments and so on. It is well-formed if it follows XML syntax rules, and valid if it also conforms to a DTD or XML Schema.

<?xml version="1.0" encoding="UTF-8"?>
<students>
  <student id="1"><name>Anil</name><marks>85</marks></student>
</students>

XSLT

XSLT (eXtensible Stylesheet Language Transformations) is an XML-based language that transforms an XML document into another format (HTML, plain text, or another XML). An XSLT processor applies the rules (templates) of a stylesheet to the source tree and produces a result tree. It uses XPath to select nodes.

<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:template match="/">
    <html><body><table>
      <xsl:for-each select="students/student">
        <tr><td><xsl:value-of select="name"/></td>
            <td><xsl:value-of select="marks"/></td></tr>
      </xsl:for-each>
    </table></body></html>
  </xsl:template>
</xsl:stylesheet>
XML + XSLT stylesheet --> XSLT processor --> HTML / XML / text

WSDL

WSDL (Web Services Description Language) is an XML-based language that describes a web service: what it does, where it is, and how to call it. It lets a client program discover the operations and message formats without human help. Main elements:

  • types – data types (XML Schema)
  • message – input/output data
  • portType – abstract operations
  • binding – protocol (SOAP/HTTP) and data format
  • service / port – the endpoint address (URL)

A WSDL file is published (for example in a UDDI registry) and used with SOAP.

✓ Answer checked by Claude Opus 5.5 (high effort)

All Web Technology chapter 7 questions →