Previous | Next | Indexes
enternetusers > Tutorials > XSLT 2.0 Tutorial > Functions operating on strings (13/15) >

Absolute URIs' from relative ones with resolve-uri() function

The function resolve-uri() resolves a relative URI provided as the first argument on the basis of URI provided as the second argument. If the relative URI is an empty sequence an empty sequence is returned, if the base URI is empty, a fatal error occurs.

This function does not attempt to find out whether the URI exists, it is merely a syntactic operation on two character strings.

Please note the difference between baseA and baseB. If we imagine that the base URI addresses a filesystem, the CCC in baseA is a directory, in baseB a file.

XSLT

      <xsl:stylesheet
                  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">
                  <xxx>
                        <i>
                              <xsl:value-of  select="resolve-uri(bbb,baseA)"/>
                        </i>
                        <ii>
                              <xsl:value-of  select="resolve-uri(bbb,baseB)"/>
                        </ii>
                  </xxx>
                  <yyy>
                        <i>
                              <xsl:value-of  select="resolve-uri(ccc,baseA)"/>
                        </i>
                        <ii>
                              <xsl:value-of  select="resolve-uri(ccc,baseB)"/>
                        </ii>
                  </yyy>
                  <zzz>
                        <i>
                              <xsl:value-of  select="resolve-uri(ddd,baseA)"/>
                        </i>
                        <ii>
                              <xsl:value-of  select="resolve-uri(ddd,baseB)"/>
                        </ii>
                  </zzz>
                  <ppp>
                        <i>
                              <xsl:value-of  select="resolve-uri(eee,baseA)"/>
                        </i>
                        <ii>
                              <xsl:value-of  select="resolve-uri(eee,baseB)"/>
                        </ii>
                  </ppp>
                  <qqq>
                        <i>
                              <xsl:value-of  select="resolve-uri(fff,baseA)"/>
                        </i>
                        <ii>
                              <xsl:value-of  select="resolve-uri(fff,baseB)"/>
                        </ii>
                  </qqq>
                  <rrr>
                        <i>
                              <xsl:value-of  select="resolve-uri(ggg,baseA)"/>
                        </i>
                        <ii>
                              <xsl:value-of  select="resolve-uri(ggg,baseB)"/>
                        </ii>
                  </rrr>
            </xsl:template>

      </xsl:stylesheet>
XML

      <aaa>
            <baseA>http://enternetusers.com/AAA/BBB/CCC/</baseA>
            <baseB>http://enternetusers.com/AAA/BBB/CCC</baseB>
            <bbb>bbb.xml</bbb>
            <ccc>../../CCC/ccc.xml</ccc>
            <ddd>../..</ddd>
            <eee>/eee.xml</eee>
            <fff>../../../../../../../</fff>
      </aaa>
Output

      <xxx>
            <i>http://enternetusers.com/AAA/BBB/CCC/bbb.xml</i>
            <ii>http://enternetusers.com/AAA/BBB/bbb.xml</ii>
      </xxx>
      <yyy>
            <i>http://enternetusers.com/AAA/CCC/ccc.xml</i>
            <ii>http://enternetusers.com/CCC/ccc.xml</ii>
      </yyy>
      <zzz>
            <i>http://enternetusers.com/AAA/</i>
            <ii>http://enternetusers.com/</ii>
      </zzz>
      <ppp>
            <i>http://enternetusers.com/eee.xml</i>
            <ii>http://enternetusers.com/eee.xml</ii>
      </ppp>
      <qqq>
            <i>http://enternetusers.com/../../../../</i>
            <ii>http://enternetusers.com/../../../../../</ii>
      </qqq>
      <rrr>
            <i/>
            <ii/>
      </rrr>


Previous chapter: Arithmetics
Next chapter: Transforming strings with regular expressions
Previous page: Joining strings with string-join
Next page: Escaping of URI with encode-for-uri, iri-to-uri, and escape-html-uri

Board Shorts >>


Quiksilver Board Shorts
Roxy Board Shorts
Volcom Board Shorts
Billabong Board Shorts
Quicksilver Board Shorts
Hurley Board Shorts
Quicksilveredition Board Shorts
Rusty Board Shorts
Reef Board Shorts
oneill Board Shorts

Ezekiel surf clothing Board Shorts
Paul Frank surf clothing Board Shorts
Mada surf clothing Board Shorts
Analog surf clothing Board Shorts
Quicksilver surf clothing Board Shorts
Jet Pilot surf clothing Board Shorts
Quicksilveredition surf clothing Board Shorts
Dakine surf clothing Board Shorts
Matix surf clothing Board Shorts
Reef surf clothing Board Shorts
O'neil surf clothing Board Shorts

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: quiksilver tees http://www.killerdana.com/killerdana/search2.asp?SearchResults.SearchHandle=QT1NZW5zIFNTIFRlZXN_Qj1NZW5zIFNTIFRlZXN_RD01OX5FPTBeMV4yXm51bV9uZXd_ST1QcmljZX5LPTR_TD0xfk09NH5OPTN_&SearchResults.SortAscending=False&SearchResults.SortBy=num_new&Answer=766

quiksilver shirt Quiksilver Shirt

quiksilver board short quiksilver board short

quiksilver clothing Quiksilver clothing

quiksilver apparel Quiksilver apparel

quiksilver jackets quiksilver jacket

quiksilver jeans Quiksilver Shirt

Quiksilver Shirt

Quiksilver Pants

quiksilver shoes Quiksilver Shoes

quiksilver sweaters Quiksilver Sweaters

quiksilver tank Quiksilver Tanks

quiksilver tees Quiksilver Tops

Quiksilver Tees

quiksilver wetsuits Quiksilver Wetsuits

Quiksilver Wetsuits

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 Swim Shop for swim wear wimming gear women's and men's 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 Swim Shop for swim wear wimming gear women's and men's