Get subdomain of XML page from XSL
- by fudgey
I am working with a guild hosting site that provides an XML/XSL transformation widget where all I need to do is enter the URL for the XML and XSL and it does the rest.
I have written an XSL transform to display a World of Warcraft armory page: Here is an example XML page (view source to see it) of the group I'm trying to help now.
So, the user is entering their own XML page url (which has an eu subdomain in this case, but it is not within the XML itself). So when I make links to the character url, I need to add the entire url
<a target="_blank" href="http://eu.wowarmory.com/character-sheet.xml?{@url}">
<xsl:value-of select="@name"/>
</a>
But I can't just set the domain to eu since there are multiple regions. Here are the possibilities: us = www, europe = eu, korea = kr, china = cn and taiwan = tw.
Here is a snippet of the XML which shows the url parameters:
<character achPoints="4275" classId="3" genderId="0" level="80" name="Virtex" raceId="4" rank="2" url="r=Drek%27Thar&cn=Virtex"/>
I guess I could just have the user add a small bit of HTML with their region in another part of their page, something like <div id="region">eu</div>, but I'm trying to make this work without any extra coding on their part.
Edit: Ok, my question explicitly stated: How do I get the URL subdomain using XSL?