Generating XML

So far, we've seen how you can use templates to insert new information, such as HTML tags, into the content of your XML documents. There are also some ways in which we can actually use XSLT to write elements and attributes into the output, effectively changing the XSL from one vocabulary to another.

xsl:element

The xsl:element element enables you to use a template to create a new element in your output. The element element takes three attributes:

  • name— The name attribute allows you to specify the name of the element. This either can be a straightforward name, or it can take the form of an expression. This provides you with the power to generate dynamic names for your elements based on the content of the XML document being processed. ...

Get Special Edition Using XML, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.