doc/share/sgml/transtable-common.xsl
Hiroki Sato 2e2010fbb7 Improve transtable.{xml,xsl}, including:
- The structure of transtable.xml is revised.  <word> should be
   bracketed with <group>.

 - A sorting order of the FreeBSD mirror sites rendered using
   mirrors.xml has been determined by sort(1).

 - A template "transtable-lookup" has been added for localization on
   word-by-word basis.

 - Replace English month names in news.xml, press.xml, and
   advisories.xml with numbers that correspond to the names.
   The number->name translation is performed on the fly.

 - Since information in mirrors.xml is used in www/ tree, it depends on
   doc/ tree now.  When WITHOUT_DOC is defined it can be built without
   doc/ tree, but some information becomes unavailable.  For example,
   a list of the mirror sites generated in index.html becomes a dummy
   one, and calling "transtable-lookup" with a word returns the word
   itself.

Neither www/ nor doc/ build should be broken due to this commit, but
until the necessary changes are applied in the localized directories,
the transtable does not work; it simply generates non-localized contents
even if transtable.xsl is used.
2004-01-12 21:27:01 +00:00

50 lines
1.7 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $FreeBSD$ -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<!-- these params should be externally bound. The values
here are not used actually -->
<xsl:param name="transtable.xml" select="'./transtable.xml'" />
<xsl:param name="transtable-sortkey.xml" select="'./transtable-sortkey.xml'" />
<xsl:key name="transtable-lookup-key" match="word" use="orig" />
<xsl:key name="transtable-sortkey-lookup-key" match="word" use="@orig" />
<xsl:template name="transtable-lookup">
<xsl:param name="word" select="''"/>
<xsl:param name="word-group" select="''"/>
<xsl:choose>
<xsl:when test="document($transtable.xml)/transtable/group[@id = $word-group]">
<xsl:for-each select="document($transtable.xml)/transtable/group[@id = $word-group]">
<xsl:choose>
<xsl:when test="key('transtable-lookup-key', $word)">
<xsl:for-each select="key('transtable-lookup-key', $word)">
<xsl:value-of select="tran" />
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$word" />
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$word" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="transtable-sortkey-lookup">
<xsl:param name="word" select="''"/>
<xsl:for-each select="document($transtable-sortkey.xml)/sortkeys">
<xsl:for-each select="key('transtable-sortkey-lookup-key', $word)">
<xsl:attribute name="sortkey">
<xsl:value-of select="@sortkey" />
</xsl:attribute>
</xsl:for-each>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>