Previous | Next | Indexes
adultinternetusers > Tutorials > XSLT 2.0 Tutorial > Namespaces (9/11) >

Namespace aliasing

In advanced programming, e.g. when a stylesheet is generated by another stylesheet, it is some times useful to use aliases for namespaces to be outputed.

Element xsl:namespace-alias is very useful in such a case. In the example the first alias moves element from "oooooo" namespace to "rrrrrr" namespace and so we have r:yyy in the output. The second alias moves unprefixed element in the stylesheet to the "ssssss" namespace and so we have s:ppp. The third alias moves elements from "zzzzzz" namespace to default result namespace, in this case the element xxx is in the null namespace.

XSLT

      <xsl:stylesheet
                  xmlns:o="oooooo"
                  xmlns:r="rrrrrr"
                  xmlns:s="ssssss"
                  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                  xmlns:z="zzzzzz"
                  version="2.0">
            <xsl:output  method="xml"
                        indent="yes"
                        omit-xml-declaration="yes"/>
            <xsl:namespace-alias  stylesheet-prefix="o"
                        result-prefix="r"/>
            <xsl:namespace-alias  stylesheet-prefix="#default"
                        result-prefix="s"/>
            <xsl:namespace-alias  stylesheet-prefix="z"
                        result-prefix="#default"/>

            <xsl:template  match="/aaa">
                  <z:xxx  xsl:exclude-result-prefixes="#all">
                        <o:yyy/>
                        <ppp/>
                  </z:xxx>
            </xsl:template>

      </xsl:stylesheet>
XML

      <aaa/>
Output

      <xxx
                  xmlns:r="rrrrrr"
                  xmlns:s="ssssss">
            <r:yyy/>
            <s:ppp/>
      </xxx>


Previous chapter: Multiple Outputs
Next chapter: Keys
Previous page: Removal of unwanted namespace declarations
Next page: Namespace creation

Kevin Carr

Natural Skin Care European Soaps
Scented Body Care Shea Body Butter
city of stanton
search engine optimization orange county internetusers


Also, you will want to check out Stanton California so you can see what's up and they are part of Stanton City Hall as well.

You can also get Organic Skin Care products from Bliss Bath Body and you must check out their Natural Body Lotions and bath soaps

Now if you are looking for the best deals on surf clothing from Quiksilver and Roxy then you have to check these amazing deals here:

Hey, check out this Organic Skin Care European Soaps along with Natural Lavender Body Lotion and shea butter

This is the guy we need in government office. His name is Kevin Carr City Of Stanton Council Candidate and he is a great guy. and we can get surf t shirts surfing shirt and And you must check out this website swim suit swimming suit and swim trunks