xsl:element

<xsl:element>
Syntax:
<xsl:element name=”element-name” namespace=”URI” use-attribute-sets=”qname” >

</xsl:element>

The xsl:element element is used to create and name an element (node) that can appear in the output. This ability to create both custom elements and attributes, and to display the results, is a major reason why stylesheets generated by XSL are a very sophisticated approach to displaying XML data.
There are two ways to add attributes to a created element: by using the xsl:attributexsl:copy, and the xsl:copy-of elements or, by using the optional use-attribute-sets attribute of the xsl:element element. Any attributes created using the use-attribute-sets attribute that have the same name as attributes created using the xsl:attribute, xsl:copy, and the xsl:copy-of elements, will be overwritten.
There is a firm restriction regarding the addition of attributes. After a child node has been added to an element, no additional attributes can be added to the parent node. This rule is required so that the XSLprocessor does not have to store the result tree in memory. Otherwise, if attributes could be added at a later time, the result tree would have to be stored while the XSL processor searched the entire tree for additional attributes.
Note, you can use the xsl:copy element to copy a node from the source document.
This element is not self-closing. The separate closing element is mandatory .

name=”element-name”

The mandatory name attribute is the qname of the element to be created. A qname is a qualified name that is composed of an optional namespace prefix, a colon, which is only present if there is a prefix, and a mandatory XML name (for example, xsl:zipcode or zipcode).
The name is one of a very few attributes in XSLT that can be set to an expression that is computed at run-time. Such attributes are interpreted as Attribute Value Templates. The syntax for doing this is demonstrated with the following code fragment:
<xsl:element name=”{$emp_name}” />
namespace=”URI”
The optional namespace attribute is the namespace URI (Universal Resource Identifier) of the generated element. The namespace is one of a very few attributes that can be set to an expression that is computed at run-time. (Such attributes are interpreted as Attribute Value Templates.)
use-attribute-sets=”qname”
The optional use-attribute-sets attributes allows the addition of attributes to the created element. It is composed of a white space delimited list (set) of the attributes to be added. This is an alternative to using the xsl:attribute element.