You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Dakkar <da...@thenautilus.net> on 2001/10/15 17:52:56 UTC
Generating xml:lang
Hi!
I'm just starting using Cocoon2, and already having problems...
I'm trying to create a multi-lingual site.
My content files look like:
<p xml:lang='it'>qualcosa</p>
<p xml:lang='en'>something</p>
and so on.
I'v got a stylesheet for selecting the appropriate language:
<xsl:param name="lang"/>
<xsl:template match="/html">
<xsl:copy>
<xsl:attribute name="xml:lang"><xsl:value-of select="$lang"/>
</xsl:attribute>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<xsl:template match="@*|node()">
<xsl:choose>
<xsl:when test="lang($lang) or not(ancestor-or-self::*[@xml:lang])">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:when>
<xsl:otherwise/>
</xsl:choose>
</xsl:template>
and the pipeline is:
<map:pipeline>
<map:match pattern="multi/**.**.html">
<map:generate src="multi/{1}.xml"/>
<map:transform src="multi/xsl/langfilter.xsl">
<map:parameter name="lang" value="{1}"/>
</map:transform>
<map:serialize type="xml"/>
</map:match>
</map:pipeline>
but if I look at the output (I put the XML serializer to have direct
output) there's no "xml:lang" attribute. If I set the attribute name
to "lang" (no namespace) it works.
What's going on? Does Cocoon (Xalan?) require a namespace declaration
for "xml:" ??
Thanks for any help.
--
Dakkar - dakkar@thenautilus.net
<Mobilis in mobile>
GPG public key fingerprint = A071 E618 DD2C 5901 9574
6FE2 40EA 9883 7519 3F88
key id = 0x75193F88
"I don't know why, but first C programs tend to look a lot worse than
first programs in any other language (maybe except for fortran, but then
I suspect all fortran programs look like `firsts')"
(By Olaf Kirch)
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>