Previous | Next | Indexes
Zvon > Tutorials > XSLT 2.0 Tutorial > Namespaces (1/11) >

Creating elements in some namespace

Namespaced elements which names are known at the beginning of transformation can be created using the standard XML procedures.
XSLT

      <xsl:stylesheet
                  xmlns:qqq="some-namespace"
                  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                  version="2.0">
            <xsl:output  method="xml"
                        indent="yes"
                        omit-xml-declaration="yes"/>

            <xsl:template  match="/aaa">
                  <qqq:bbb>
                        <qqq:ccc/>
                  </qqq:bbb>
            </xsl:template>

      </xsl:stylesheet>
XML

      <aaa/>
Output

      <qqq:bbb
                  xmlns:qqq="some-namespace">
            <qqq:ccc/>
      </qqq:bbb>


Previous chapter: Multiple Outputs
Next chapter: Keys
Previous page: - - -
Next page: Dynamically generated elements in some namespace