From the course: XML Essential Training

Unlock the full course today

Join today to access over 24,700 courses taught by industry experts.

Simple XSLT

Simple XSLT

- [Instructor] Let's take what we've learned about XSLT so far and try a simple example. So, I'm going to open up simple transform.xml in my chapter seven start. And this file is pretty simple. It only has one XML tag, and there's some text in the tag. Let's also open up simple transform.xslT, and we'll come back to this. This is the style sheet that we're going to build that's going to match the JavaCo Tea tag in this XML file. So first, right at the top, we have our style sheet declaration. This tells the style sheet parser that this is an XSLT style sheet. Then I have a template definition. The template uses an XPath expression to match this template with content in the source XML file. So in this case, the match expression says, start at the root of the document, which is that forward slash, and then look for a tag named JavaCo Tea. And sure enough, if you look in the XML, that's what we have. We have the root tag, and it is named JavaCo Tea. So when the match takes place, the…

Contents