The legacy wiki pages are here for reference purposes only.
For up-to-date information make sure to check the documentation section.

The GetCurrentDomains function is used to return a domains object which contains the current domains and their associated languages.

Setting up a domain in your Umbraco installation

For the sample below to work you will need to have setup at least one domain, you do this by right clicking your top level content node and then "Manage Hostnames"

This function cannot be used directly as an XSLT extension

This cannot be called directly using the XSLT extension as it returns an object rather than a Xml Node set which would be better for use within XSLT ( maybe a future revision! )

Using this function in XSLT via an embedded script

You can however use embedded script to make use of this function.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp "&#x00A0;">
]>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxml="urn:schemas-microsoft-com:xslt"
xmlns:vizioz="urn:vizioz-com:xslt"
xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets"
exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets vizioz">


<xsl:output method="xml" omit-xml-declaration="yes"/>

<xsl:param name="currentPage"/>

<xsl:template match="/">

<!-- Return a list of domains and convert them into a node set -->
<xsl:variable name="domains" select="Exslt.ExsltStrings:tokenize(vizioz:GetDomain($currentPage/@id),' ')"/>

<xsl:for-each select="$domains">
<xsl:value-of select="."/>
<br/>
</xsl:for-each>

</xsl:template>

<msxml:script language="CSharp" implements-prefix="vizioz">
<msxml:assembly href="../bin/cms.dll" />
<msxml:assembly href="../bin/umbraco.dll" />
<msxml:using namespace="umbraco" />
<msxml:using namespace="umbraco.cms.businesslogic.web" />

public static string GetDomain(int pageId)
{
string domainList = "";
try
{
Domain[] domains = library.GetCurrentDomains(pageId);
if (domains != null &amp;&amp; domains.Length &gt;= 0)
{
foreach (Domain d in domains)
{
if (domainList.Length > 0)
{domainList += ' ';}
domainList += d.Name;
}
return domainList;
}
}
catch (Exception errDictionary)
{
}
return string.Empty;
}
</msxml:script>

</xsl:stylesheet>

This will return a list of the domain names.

Extract the language

You could of course extend this and add a function that returns the languages from the domain object, a similar example of which can be found on this forum post:

http://our.umbraco.org/forum/developers/xslt/4747-How-do-you-retrieve-the-Culture-Code-for-a-given-Node

Our.umbraco.org is the community mothership for Umbraco, the open source asp.net cms. With a friendly forum for all your questions, a comprehensive documentation and a ton of packages from the community. This site is running Umbraco version 7.3.0-RC