2007-05-05 16:34:57 +00:00
|
|
|
<?xml version="1.0" encoding="utf-8"?>
|
2007-03-03 14:52:27 +00:00
|
|
|
|
2013-01-17 23:13:14 +00:00
|
|
|
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
|
|
|
xmlns:dt="http://xsltsl.org/date-time"
|
|
|
|
exclude-result-prefixes="dt"
|
|
|
|
xmlns:str="http://exslt.org/strings"
|
|
|
|
extension-element-prefixes="str">
|
2014-06-23 10:10:57 +00:00
|
|
|
|
2015-03-26 16:48:20 +00:00
|
|
|
<xsl:import href="build/xslt/gettext.xsl" />
|
2014-06-22 15:04:05 +00:00
|
|
|
<xsl:import href="tools/xsltsl/static-elements.xsl" />
|
|
|
|
<xsl:import href="tools/xsltsl/tagging.xsl" />
|
2014-01-23 15:39:19 +00:00
|
|
|
|
2014-09-15 11:23:09 +00:00
|
|
|
<xsl:import href="build/xslt/fsfe_head.xsl" />
|
|
|
|
<xsl:import href="build/xslt/fsfe_body.xsl" />
|
|
|
|
|
2014-06-30 02:13:01 +00:00
|
|
|
<!-- For pages used on external web servers, load the CSS from absolute URL -->
|
|
|
|
<xsl:variable name="urlprefix">
|
|
|
|
<xsl:if test="/buildinfo/document/@external">https://fsfe.org</xsl:if>
|
|
|
|
</xsl:variable>
|
|
|
|
|
2019-10-03 13:25:33 +00:00
|
|
|
<!-- EXTRACT -->
|
|
|
|
<xsl:variable name="metadesc">
|
|
|
|
<!-- Get the meta element description -->
|
|
|
|
<xsl:value-of select="/buildinfo/document/head/meta[@name = 'description']/@content" />
|
|
|
|
</xsl:variable>
|
|
|
|
|
|
|
|
<!-- if there is a meta description, take that -->
|
|
|
|
<xsl:variable name="extract">
|
|
|
|
<xsl:choose>
|
|
|
|
<!-- if there is a meta description, take that -->
|
|
|
|
<xsl:when test="$metadesc != ''">
|
|
|
|
<xsl:value-of select="$metadesc" />
|
|
|
|
</xsl:when>
|
|
|
|
<xsl:otherwise>
|
|
|
|
<!-- take a first extract which should be sufficient for most pages -->
|
|
|
|
<xsl:variable name="extract1">
|
|
|
|
<!-- retrieve the first 200 letters of the first p element after h1 -->
|
|
|
|
<xsl:value-of select="substring(normalize-space(/buildinfo/document/body/h1[1]/following::p[1]),1,200)" />
|
|
|
|
</xsl:variable>
|
|
|
|
<!-- measure first extract length -->
|
|
|
|
<xsl:variable name="extractlength1">
|
|
|
|
<xsl:value-of select="string-length($extract1)" />
|
|
|
|
</xsl:variable>
|
|
|
|
<!-- define cases what happens with which extract length -->
|
|
|
|
<xsl:choose>
|
|
|
|
<!-- case: first extract is long enough -->
|
|
|
|
<xsl:when test="$extractlength1 > 50">
|
|
|
|
<xsl:value-of select="$extract1" />
|
|
|
|
<xsl:text>...</xsl:text>
|
|
|
|
</xsl:when>
|
|
|
|
<!-- case: first extract is too short -->
|
|
|
|
<xsl:otherwise>
|
|
|
|
<xsl:variable name="extract2">
|
|
|
|
<!-- retrieve the first 200 letters of the *second* p element after h1 -->
|
|
|
|
<xsl:value-of select="substring(normalize-space(/buildinfo/document/body/h1[1]/following::p[2]),1,200)" />
|
|
|
|
</xsl:variable>
|
|
|
|
<!-- measure *second* extract length -->
|
|
|
|
<xsl:variable name="extractlength2">
|
|
|
|
<xsl:value-of select="string-length($extract2)" />
|
|
|
|
</xsl:variable>
|
|
|
|
<xsl:choose>
|
|
|
|
<!-- case: second extract is long enough -->
|
|
|
|
<xsl:when test="$extractlength2 > 50">
|
|
|
|
<xsl:value-of select="$extract2" />
|
|
|
|
</xsl:when>
|
|
|
|
<!-- case: second extract is too short, so take default text -->
|
|
|
|
<xsl:otherwise>
|
|
|
|
Non profit organisation working to create general understanding and support for software freedom. Includes news, events, and campaigns.
|
|
|
|
</xsl:otherwise>
|
|
|
|
</xsl:choose>
|
|
|
|
</xsl:otherwise>
|
|
|
|
</xsl:choose>
|
|
|
|
</xsl:otherwise>
|
|
|
|
</xsl:choose>
|
|
|
|
</xsl:variable>
|
|
|
|
|
2014-06-23 15:55:26 +00:00
|
|
|
<xsl:include href="build/xslt/fsfe_document.xsl" />
|
|
|
|
<xsl:include href="build/xslt/fsfe_headings.xsl" />
|
|
|
|
<xsl:include href="build/xslt/fsfe_localmenu.xsl" />
|
2014-06-23 15:21:46 +00:00
|
|
|
|
2014-06-22 15:33:35 +00:00
|
|
|
<!-- Do not copy non-HTML elements to output -->
|
2014-06-23 15:55:26 +00:00
|
|
|
<xsl:include href="build/xslt/fsfe_nolocal.xsl" />
|
2014-06-22 15:33:35 +00:00
|
|
|
|
|
|
|
<!-- HTML 5 compatibility doctype, since our XSLT parser doesn't support disabling output escaping -->
|
|
|
|
<xsl:output method="html" encoding="utf-8" indent="yes" doctype-system="about:legacy-compat" />
|
2008-12-07 21:07:01 +00:00
|
|
|
|
2014-06-22 15:04:05 +00:00
|
|
|
<!-- Ignore "latin" tags, used only for printable material -->
|
2010-05-14 09:54:35 +00:00
|
|
|
<xsl:template match="latin">
|
|
|
|
<xsl:apply-templates select="@*|node()"/>
|
|
|
|
</xsl:template>
|
2013-01-17 23:13:14 +00:00
|
|
|
|
2014-01-27 23:03:27 +00:00
|
|
|
<!--FIXME ↓-->
|
2014-01-27 20:37:36 +00:00
|
|
|
<xsl:template match="fetch-news">
|
|
|
|
<xsl:call-template name="fetch-news">
|
2014-01-27 21:30:08 +00:00
|
|
|
<xsl:with-param name="tag" select="'/buildinfo/document/sidebar/@news'"/>
|
2014-01-27 20:37:36 +00:00
|
|
|
<xsl:with-param name="nb-items" select="4"/>
|
|
|
|
</xsl:call-template>
|
|
|
|
</xsl:template>
|
2018-11-28 10:51:11 +00:00
|
|
|
|
|
|
|
<!-- Static elements which can be included everywhere -->
|
|
|
|
<xsl:template match="static-element">
|
|
|
|
<xsl:variable name="id"><xsl:value-of select="@id"/></xsl:variable>
|
2019-09-09 09:44:29 +00:00
|
|
|
<xsl:copy-of select="/buildinfo/document/set/element[@id=$id]/node()" />
|
2018-11-28 10:51:11 +00:00
|
|
|
</xsl:template>
|
2014-01-27 20:37:36 +00:00
|
|
|
|
2007-03-03 14:52:27 +00:00
|
|
|
</xsl:stylesheet>
|