XML·XML from well-formed documents to XSLT

XSLT

Transform XML into HTML or another XML shape with templates.

Beginner 14 min read Lesson 6 of 300 Challenge included
What you will be able to do
  • Use xsl:template match to handle nodes.
  • Use xsl:apply-templates to recurse.
  • Use xsl:value-of to output values.
  • Keep transforms small and tested.

In plain English

XSLT is a declarative transformation language. Templates match nodes and apply other templates. Use it for document conversion and feeds, and keep the transformation separate from application code.

course.xslHTML
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:template match="/">
    <h1><xsl:value-of select="course/title" /></h1>
  </xsl:template>
</xsl:stylesheet>
Your turn

Match the root

Easy

Write an xsl:template that matches /.

HTML · starter
<xsl:template>
Check your understanding before moving on.
Knowledge checkQuestion 1

Which element outputs a node value in XSLT?

Select an answer to continue
Study tools

Make it yours.

Keep a private note for this lesson, then turn the key ideas into flashcards you can revisit.

Sign in to save notes and flashcards.Both are private to your account and stay with your progress.
Sign in
Finished reading?

Lock in what you just learned.

Mark this lesson complete to save your place and move one step closer to the certificate.

Next: Parsing XML
Lesson 6 of 300 · 0% of course