This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Document() function
Hi,
so what kind of help do you need? I can leave here some example, how I use
the document function.
We use it for multilanguage support, also I want to make a point of discuss,
if I use it right way. Next point is about performance. Could anybody
comment it?
What I mean: Every time when you access some page, it probably look thrgough
all language.xml and search for right element. I don't know how parsers
work, but if it works like I think, it's little performance consuming.
I will not include XML, because I think it is not necessary.
Extracted and trigged part of xsl:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="html"/>
<!-- these variables we have in global.xsl, which we include to all our
XSLs -->
<xsl:variable name="language">en</xsl:variable>
<!--<xsl:variable name="language"><xsl:value-of
select="//service/header/userInfo/language"/></xsl:variable>-->
<xsl:variable name="languageFile">mcsdp/include/language.xml</xsl:variable>
<!-- mcsdp/include is relative path from root path of transcoder, we are
using WTP from IBM. -->
<xsl:include href="mcsdp/include/global.xsl"/>
<xsl:template match="/">
<a class="menuup">
<xsl:attribute name="href"><xsl:value-of
select="$url_p"/>ADDRESSBOOK</xsl:attribute>
<img width="86" height="20" border="0">
<xsl:attribute
name="src">/portal/images/main/text_buttons/addressbook_<xsl:value-of
select="$language"/>.gif</xsl:attribute>
<xsl:attribute name="alt"><xsl:value-of
select="document($languageFile)/resources/literals[lang($language)]/literal[
@id='mu_addressbook']"/></xsl:attribute>
</img>
</a>
</xsl:template>
</xsl:stylesheet>
Extracted and trigged part of language.xml:
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<!--English-->
<literals xml:lang="en">
<!--Labels of UC-->
<literal id="mu_addressbook">ADDRESS BOOK</literal>
</literals>
<!--Finish-->
<literals xml:lang="fi">
<!--Labels of UC-->
<literal id="mu_addressbook">OSOITEKIRJA</literal>
</literals>
</resources>
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list