[xsl] lang function in a named template

Subject: [xsl] lang function in a named template
From: Marc Franquesa <marc.franquesa@xxxxxxxxx>
Date: Sat, 16 Oct 2004 19:02:28 +0200
Hi, I'm new to the list and don't a good english-speaker, sorry.

I have a little problem with the xml:lang attribute, I belive that I
found the cause
but not sure, so...

I set xml:lang attribute in the root element (faq) of XML file
(xfaq.xml), this document uses the xfaq.xsl stylesheet.

The xfaq.xsl stylesheet imports the page.xsl stylesheet, and the only
template in xfaq.xsl is the '<xsl:template match="faq">' template (the
one that matches the root element 'faq' with the xml:lang attribute).

In the 'page.xsl' stylesheet there is a template that matches '/' and
inside it I call
the named template 'PageFoot' which contains this code:

<xsl:choose>
	<xsl:when test="lang(ca)">Catal`</xsl:when>
	<xsl:when test="lang(es)">Espaqol</xsl:when>
	<xsl:when test="lang(en)">English</xsl:when>
	<xsl:otherwise>No xml:lang</xsl:otherwise>
</xsl:choose>

This code doesn't work: displays nothing (despite the otherwise).

First, I suspected that the problem was the named template, I thinked
that in a named template no 'context-node' exist, but later consulting
some FAQs and doc I see examples doing it.

I think the problem can be that the calling template matches '/' and
not 'faq', then no xml:lang attribute has been defined.

?Someone knows exactly which the cause is?
Any suggestion will be accepted.

--
'Pero existe la voluntad, "El Futuro" es inherentemente plural'
All tomorrow parties - William Gibson
http://www.l3jane.net
Vic - Catalonia

Current Thread