?? language.xsl
字號:
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!DOCTYPE xsl:stylesheet [
<!ENTITY lf SYSTEM "util/lf.xml">
<!ENTITY xsl "http://www.w3.org/1999/XSL/Transform">
]>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="">
<xsl:output
method="xml"
encoding="utf-8"
indent="no"
/>
<xsl:param name="type" />
<xsl:param name="langs" />
<!-- ==================================================================== -->
<!-- / -->
<!-- bootstrap -->
<!-- ==================================================================== -->
<xsl:template match="/">
<xsl:choose>
<xsl:when test="$type = 'list'">
<language-list>
&lf;
<xsl:call-template name="language-list">
<xsl:with-param name="langs" select="normalize-space($langs)" />
</xsl:call-template>
</language-list>
&lf;
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="*" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- ==================================================================== -->
<!-- language-list -->
<!-- generate language list -->
<!-- ==================================================================== -->
<xsl:template name="language-list">
<xsl:param name="langs" />
<xsl:if test="string-length($langs)">
<lang>
<xsl:value-of select="substring-before(concat($langs, ' '),' ')" />
</lang>
&lf;
<xsl:call-template name="language-list">
<xsl:with-param name="langs" select="normalize-space(substring-after(
concat($langs, ' '), ' '))" />
</xsl:call-template>
</xsl:if>
</xsl:template>
<!-- ==================================================================== -->
<!-- <language-list> -->
<!-- generate stuff from language list -->
<!-- ==================================================================== -->
<xsl:template match="/language-list">
<xsl:choose>
<xsl:when test="$type = 'design'">
<items>
&lf;
<xsl:for-each select="lang">
<xsl:variable name="file" select="document(concat('../lang/', .,
'.xml'))/language" />
<item lang="{$file/@id}" charset="{$file/charset}" >
<xsl:value-of select="$file/target-ext" />
</item>
&lf;
</xsl:for-each>
</items>
&lf;
</xsl:when>
<xsl:when test="$type = 'targets'">
<xsl:apply-templates select="/language-list" mode="targets" />
</xsl:when>
<xsl:when test="$type = 'desc'">
<xsl:apply-templates select="/language-list" mode="desc" />
</xsl:when>
<xsl:when test="$type = 'modlists'">
<xsl:apply-templates select="/language-list" mode="modlists" />
</xsl:when>
</xsl:choose>
</xsl:template>
<!-- ==================================================================== -->
<!-- <language-list> -->
<!-- generate target list from language list -->
<!-- ==================================================================== -->
<xsl:template match="/language-list" mode="targets">
<xsl:call-template name="copyright" />
<xsl:call-template name="head">
<xsl:with-param name="text" select="'this file contains language specific
targets and will be included'" />
</xsl:call-template>
<xsl:call-template name="head">
<xsl:with-param name="text" select="'into build.xml. IT IS AUTOGENERATED.
DO NOT TOUCH!'" />
</xsl:call-template>
<xsl:call-template name="sep" />
<project name="lang-targets">
&lf;&lf;
<!-- build *-all targets -->
<!-- =================== -->
<target name="all"
description="- builds all HTML files and nroff man pages">
<xsl:attribute name="depends">
<xsl:for-each select="lang[document(concat('../lang/', .,
'.xml'))/language/messages]">
<xsl:value-of select="." />
<xsl:if test="position() != last()">, </xsl:if>
</xsl:for-each>
</xsl:attribute>
</target>
&lf;
<target name="zip-all"
description="- builds all zip download packages">
<xsl:attribute name="depends">
<xsl:for-each select="lang[document(concat('../lang/', .,
'.xml'))/language/messages]">
<xsl:text>zip-</xsl:text>
<xsl:value-of select="." />
<xsl:if test="position() != last()">, </xsl:if>
</xsl:for-each>
</xsl:attribute>
</target>
&lf;
<target name="war-all"
description="- builds all war download packages">
<xsl:attribute name="depends">
<xsl:for-each select="lang[document(concat('../lang/', .,
'.xml'))/language/messages]">
<xsl:text>war-</xsl:text>
<xsl:value-of select="." />
<xsl:if test="position() != last()">, </xsl:if>
</xsl:for-each>
</xsl:attribute>
</target>
&lf;
<!-- single language targets -->
<!-- ======================= -->
<xsl:for-each select="lang">
<xsl:sort select="." />
<xsl:variable name="file" select="document(concat('../lang/', .,
'.xml'))/language" />
<xsl:if test="$file/messages">
&lf;
<xsl:call-template name="head">
<xsl:with-param name="text" select="$file/name" />
</xsl:call-template>
<xsl:call-template name="sep" />
<property name="inputext.{.}" value="{$file/source-ext}" />&lf;
<property name="outputext.{.}" value="{$file/target-ext}" />&lf;&lf;
<target name="{.}" description="- builds {$file/name} HTML files">
&lf;
<xsl:text> </xsl:text>
<html.generic lang="{.}" />&lf;
<xsl:if test=". = 'en'">
<xsl:text> </xsl:text><runtarget target="man-en" />&lf;
</xsl:if>
</target>
&lf;
<target name="-off-{.}" depends="metafiles"
unless="-off.{.}.done">&lf;
<xsl:text> </xsl:text>
<dependencies.offline lang="{.}" style="zip" dir="_off" />&lf;
<xsl:text> </xsl:text>
<offline.generic lang="{.}" style="zip" dir="_off" />&lf;
<xsl:text> </xsl:text>
<property name="-off.{.}.done" value="yes" />&lf;
</target>
&lf;
<target name="zip-{.}" depends="-off-{.}"
description="- builds the {$file/name} zipped download package">&lf;
<xsl:text> </xsl:text>
<zip.generic lang="{.}" />&lf;
</target>
&lf;
<target name="war-{.}" depends="-off-{.}"
description="- builds the {$file/name} Konqueror Web Archive">&lf;
<xsl:text> </xsl:text>
<war.generic lang="{.}" />&lf;
</target>
&lf;
<xsl:if test="$file/chm">
<target name="chm-{.}"
description="- builds the {$file/name} CHM file">&lf;
<xsl:text> </xsl:text>
<chm.generic lang="{.}" />&lf;
</target>
&lf;
</xsl:if>
<xsl:if test="$file/man">
<target name="man-{.}"
description="- builds the {$file/name} nroff files">&lf;
<xsl:text> </xsl:text>
<nroff.generic lang="{.}" />&lf;
</target>
&lf;
</xsl:if>
<xsl:if test=". = 'en'">
<target name="latex-en"
description="- builds the English latex file">&lf;
<xsl:text> </xsl:text>
<latex.generic lang="en" />&lf;
</target>
&lf;
</xsl:if>
</xsl:if>
</xsl:for-each>
&lf;
<!-- XML validation -->
<!-- ============== -->
<xsl:call-template name="head">
<xsl:with-param name="text" select="'XML validation.'" />
</xsl:call-template>
<xsl:call-template name="head">
<xsl:with-param name="text" select="'If you get an error during
transformation, this task may be useful'" />
</xsl:call-template>
<xsl:call-template name="head">
<xsl:with-param name="text" select="'because it mostly gives you a
hint, where you forgot the </p> ;-)'" />
</xsl:call-template>
<xsl:call-template name="sep" />
<target name="validate-xml" description="- validates all XML source files">
&lf;
<xsl:text> </xsl:text>
<xmlvalidate lenient="false" failonerror="false" warn="true">
&lf;
<xsl:text> </xsl:text>
<xmlcatalog refid="w3c-catalog" />&lf;
<xsl:text> </xsl:text>
<fileset dir="../">&lf;
<xsl:for-each select="lang">
<xsl:sort select="." />
<xsl:variable name="file" select="document(concat(
'../lang/', ., '.xml'))
/language" />
<xsl:if test="$file/messages">
<xsl:text> </xsl:text>
<include name="**/*{$file/source-ext}" />&lf;
</xsl:if>
</xsl:for-each>
&lf;
<xsl:text> </xsl:text>
<patternset refid="excludes" />&lf;
<xsl:text> </xsl:text>
<patternset refid="scratch" />&lf;
<xsl:text> </xsl:text>
</fileset>
&lf;
<xsl:text> </xsl:text>
</xmlvalidate>
&lf;
</target>
&lf;&lf;
</project>
</xsl:template>
<!-- ==================================================================== -->
<!-- <language-list> -->
<!-- generate list of modulelists -->
<!-- ==================================================================== -->
<xsl:template match="/language-list" mode="modlists">
<items>
&lf;
<xsl:for-each select="lang">
<xsl:sort select="." />
<xsl:variable name="file" select="document(concat(
'../lang/', ., '.xml'))
/language" />
<item lang="{.}">
<xsl:text>../../../mod/allmodules</xsl:text>
<xsl:value-of select="$file/source-ext" />
</item>
&lf;
</xsl:for-each>
</items>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -