localised tagging functions, removed unused
svn path=/trunk/; revision=35521
This commit is contained in:
parent
d2fb1fef39
commit
4c8a4f5d3e
@ -35,14 +35,4 @@
|
||||
|
||||
</xsl:template>
|
||||
|
||||
<!-- displayy dynamic list of news and events -->
|
||||
<xsl:template match="tagged-news-and-events">
|
||||
|
||||
<xsl:call-template name="tagged-news-and-events">
|
||||
<xsl:with-param name="absolute-fsfe-links" select="'no'" />
|
||||
</xsl:call-template>
|
||||
|
||||
</xsl:template>
|
||||
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
@ -4,35 +4,76 @@
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:dt="http://xsltsl.org/date-time">
|
||||
|
||||
<xsl:import href="../tools/xsltsl/tagging.xsl" />
|
||||
<xsl:import href="../fsfe.xsl" />
|
||||
<xsl:output method="html" encoding="utf-8" indent="yes" doctype-system="about:legacy-compat" />
|
||||
|
||||
<!--
|
||||
For documentation on tagging (e.g. fetching news and events), take a
|
||||
look at the documentation under
|
||||
/tools/xsltsl/tagging-documentation.txt
|
||||
-->
|
||||
|
||||
<!-- The top level element of the input file is "buildinfo" -->
|
||||
<xsl:template match="buildinfo">
|
||||
<xsl:apply-templates select="node()"/>
|
||||
</xsl:template>
|
||||
|
||||
<!-- TODO: add tags that correspond to project ids -->
|
||||
|
||||
|
||||
<!--display dynamic list of news items-->
|
||||
<xsl:template match="all-tags-news">
|
||||
|
||||
<xsl:call-template name="all-tags-news"/>
|
||||
|
||||
|
||||
<xsl:element name="ul">
|
||||
<xsl:attribute name="class">taglist</xsl:attribute>
|
||||
|
||||
<xsl:for-each select="/buildinfo/document/set/news/tags/tag">
|
||||
<xsl:sort select="." order="ascending" />
|
||||
<xsl:variable name="thistag" select="node()" />
|
||||
|
||||
<xsl:if test="generate-id() = generate-id(key('news-tags-by-value', normalize-space(.)))">
|
||||
<xsl:element name="li">
|
||||
<xsl:element name="a">
|
||||
<xsl:attribute name="href">
|
||||
<xsl:text>/tags/tagged.</xsl:text>
|
||||
<xsl:value-of select="/buildinfo/@language" />
|
||||
<xsl:text>.html#n</xsl:text>
|
||||
<xsl:value-of select="translate($thistag,' ','')" />
|
||||
</xsl:attribute>
|
||||
<xsl:value-of select="."/>
|
||||
</xsl:element>
|
||||
</xsl:element>
|
||||
</xsl:if>
|
||||
|
||||
</xsl:for-each>
|
||||
|
||||
</xsl:element>
|
||||
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!--display dynamic list of newsletters items-->
|
||||
<xsl:template match="all-tags-events">
|
||||
|
||||
<xsl:call-template name="all-tags-events"/>
|
||||
|
||||
<xsl:element name="ul">
|
||||
<xsl:attribute name="class">taglist</xsl:attribute>
|
||||
|
||||
<xsl:for-each select="/buildinfo/document/set/event/tags/tag">
|
||||
<xsl:sort select="." order="ascending" />
|
||||
<xsl:variable name="thistag" select="node()" />
|
||||
|
||||
<xsl:if test="generate-id() = generate-id(key('events-tags-by-value', normalize-space(.)))">
|
||||
<xsl:element name="li">
|
||||
<xsl:element name="a">
|
||||
<xsl:attribute name="href">
|
||||
<xsl:text>/tags/tagged.</xsl:text>
|
||||
<xsl:value-of select="/buildinfo/@language" />
|
||||
<xsl:text>.html#e</xsl:text>
|
||||
<xsl:value-of select="translate($thistag,' ','')" />
|
||||
</xsl:attribute>
|
||||
<xsl:value-of select="."/>
|
||||
</xsl:element>
|
||||
</xsl:element>
|
||||
</xsl:if>
|
||||
|
||||
</xsl:for-each>
|
||||
|
||||
</xsl:element>
|
||||
|
||||
</xsl:template>
|
||||
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
@ -33,27 +33,6 @@
|
||||
|
||||
</xsl:template>
|
||||
|
||||
<!--display dynamic list of (not yet tagged) newsletters items-->
|
||||
|
||||
<xsl:template name="fetch-newsletters">
|
||||
<xsl:param name="today" select="/buildinfo/@date" />
|
||||
<xsl:param name="nb-items" select="''" />
|
||||
|
||||
<xsl:for-each select="/buildinfo/document/set/news [translate(@date, '-', '') <= translate($today, '-', '')
|
||||
and (tags/tag[@key] = 'newsletter'
|
||||
or tags/tag = 'newsletter'
|
||||
or @type = 'newsletter' ) ]">
|
||||
|
||||
<xsl:sort select="@date" order="descending" />
|
||||
|
||||
<xsl:if test="position()<= $nb-items or $nb-items=''">
|
||||
<xsl:call-template name="newsletter" />
|
||||
</xsl:if>
|
||||
</xsl:for-each>
|
||||
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!--display dynamic list of tagged event items-->
|
||||
|
||||
<xsl:template name="fetch-events">
|
||||
@ -118,144 +97,8 @@
|
||||
</xsl:template>
|
||||
|
||||
<xsl:key name="news-tags-by-value" match="news/tags/tag" use="."/>
|
||||
|
||||
<!--display dynamic list of tags used in news-->
|
||||
|
||||
<xsl:template name="all-tags-news">
|
||||
|
||||
<xsl:element name="ul">
|
||||
<xsl:attribute name="class">taglist</xsl:attribute>
|
||||
|
||||
<xsl:for-each select="/buildinfo/document/set/news/tags/tag">
|
||||
<xsl:sort select="." order="ascending" />
|
||||
<xsl:variable name="thistag" select="node()" />
|
||||
|
||||
<xsl:if test="generate-id() = generate-id(key('news-tags-by-value', normalize-space(.)))">
|
||||
<xsl:element name="li">
|
||||
<xsl:element name="a">
|
||||
<xsl:attribute name="href">
|
||||
<xsl:text>/tags/tagged.</xsl:text>
|
||||
<xsl:value-of select="/buildinfo/@language" />
|
||||
<xsl:text>.html#n</xsl:text>
|
||||
<xsl:value-of select="translate($thistag,' ','')" />
|
||||
</xsl:attribute>
|
||||
<xsl:value-of select="."/>
|
||||
</xsl:element>
|
||||
</xsl:element>
|
||||
</xsl:if>
|
||||
|
||||
</xsl:for-each>
|
||||
|
||||
</xsl:element>
|
||||
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:key name="events-tags-by-value" match="event/tags/tag" use="."/>
|
||||
|
||||
|
||||
<!--display dynamic list of tags used in events-->
|
||||
|
||||
<xsl:template name="all-tags-events">
|
||||
|
||||
<xsl:element name="ul">
|
||||
<xsl:attribute name="class">taglist</xsl:attribute>
|
||||
|
||||
<xsl:for-each select="/buildinfo/document/set/event/tags/tag">
|
||||
<xsl:sort select="." order="ascending" />
|
||||
<xsl:variable name="thistag" select="node()" />
|
||||
|
||||
<xsl:if test="generate-id() = generate-id(key('events-tags-by-value', normalize-space(.)))">
|
||||
<xsl:element name="li">
|
||||
<xsl:element name="a">
|
||||
<xsl:attribute name="href">
|
||||
<xsl:text>/tags/tagged.</xsl:text>
|
||||
<xsl:value-of select="/buildinfo/@language" />
|
||||
<xsl:text>.html#e</xsl:text>
|
||||
<xsl:value-of select="translate($thistag,' ','')" />
|
||||
</xsl:attribute>
|
||||
<xsl:value-of select="."/>
|
||||
</xsl:element>
|
||||
</xsl:element>
|
||||
</xsl:if>
|
||||
|
||||
</xsl:for-each>
|
||||
|
||||
</xsl:element>
|
||||
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!-- recursive, nested list of parent-region children tags -->
|
||||
|
||||
<xsl:template name="append-children-tags">
|
||||
|
||||
<xsl:param name="parent-region" select="''" />
|
||||
|
||||
<xsl:element name="ul">
|
||||
|
||||
<xsl:if test="$parent-region=''">
|
||||
<xsl:attribute name="class">taglist</xsl:attribute>
|
||||
</xsl:if>
|
||||
|
||||
<xsl:attribute name="parent-region"><xsl:value-of select="$parent-region" /></xsl:attribute>
|
||||
|
||||
<xsl:for-each select="/buildinfo/document/set/tag[ (not(@parent-region) and $parent-region='') or
|
||||
@parent-region = $parent-region ]">
|
||||
|
||||
<xsl:variable name="id" select="@id" />
|
||||
<!-- <xsl:variable name="nb" select="count( /buildinfo/document/set/news/tags/tag[text() = $id]) " /> -->
|
||||
|
||||
<xsl:element name="li">
|
||||
<xsl:element name="a">
|
||||
<xsl:attribute name="href">
|
||||
<xsl:text>/tags/tagged.</xsl:text>
|
||||
<xsl:value-of select="/buildinfo/@language" />
|
||||
<xsl:text>.html#n</xsl:text>
|
||||
<xsl:value-of select="translate($id,' ','')" />
|
||||
</xsl:attribute>
|
||||
<xsl:value-of select="@name"/>
|
||||
</xsl:element>
|
||||
|
||||
<!-- if there are children, add them as a sublist -->
|
||||
<xsl:for-each select="/buildinfo/document/set/tag[ @parent-region = $id ]">
|
||||
<xsl:call-template name="append-children-tags">
|
||||
<xsl:with-param name="parent-region" select="$id" />
|
||||
</xsl:call-template>
|
||||
</xsl:for-each>
|
||||
|
||||
</xsl:element> <!-- </li> -->
|
||||
|
||||
</xsl:for-each>
|
||||
|
||||
</xsl:element> <!-- </ul> -->
|
||||
|
||||
</xsl:template>
|
||||
|
||||
|
||||
|
||||
|
||||
<xsl:template name="fetch-links">
|
||||
|
||||
<xsl:element name="ul">
|
||||
<xsl:for-each select="/buildinfo/document/set/link">
|
||||
<xsl:element name="li">
|
||||
|
||||
<xsl:element name="a">
|
||||
<xsl:attribute name="href"> <xsl:value-of select="href" /> </xsl:attribute>
|
||||
<xsl:value-of select="title"/>
|
||||
</xsl:element>
|
||||
<xsl:if test="description">
|
||||
<xsl:element name="p"> <xsl:value-of select="description"/> </xsl:element>
|
||||
</xsl:if>
|
||||
|
||||
</xsl:element>
|
||||
</xsl:for-each>
|
||||
</xsl:element>
|
||||
|
||||
</xsl:template>
|
||||
|
||||
|
||||
|
||||
<!--display dynamic list of tagged news, sorted by tag -->
|
||||
|
||||
@ -360,95 +203,5 @@
|
||||
|
||||
|
||||
<xsl:key name="all-tags-by-value" match="tags/tag" use="."/>
|
||||
|
||||
<!-- display list of tagged news and events sorted by tag -->
|
||||
|
||||
<xsl:template name="tagged-news-and-events">
|
||||
|
||||
<!--FiXME: this select takes too much time -->
|
||||
|
||||
<!-- loop through all tags accross news and events -->
|
||||
<!-- <xsl:for-each select="/buildinfo/document/set/news/tags/tag | /buildinfo/document/set/event/tags/tag"> -->
|
||||
|
||||
<!-- <xsl:sort select="." order="ascending" /> -->
|
||||
|
||||
<!-- <xsl:variable name="tag" select="." /> -->
|
||||
|
||||
<!-- <xsl:element name="div"> -->
|
||||
<!-- <xsl:attribute name="class">tag-<xsl:value-of select="$tag" /> tag title</xsl:attribute> -->
|
||||
<!-- <xsl:attribute name="id"> -->
|
||||
<!-- <xsl:text>tag-</xsl:text> -->
|
||||
<!-- <xsl:value-of select="translate($tag, ' ', '')" /> -->
|
||||
<!-- </xsl:attribute> -->
|
||||
|
||||
<!-- <xsl:element name="h3"> -->
|
||||
<!-- <xsl:call-template name="generate-id-attribute" /> -->
|
||||
<!-- <xsl:choose> -->
|
||||
<!-- <xsl:when test="@content"> -->
|
||||
<!-- <xsl:value-of select="@content"/> -->
|
||||
<!-- </xsl:when> -->
|
||||
<!-- <xsl:otherwise> -->
|
||||
<!-- <xsl:value-of select="$tag" /> -->
|
||||
<!-- </xsl:otherwise> -->
|
||||
<!-- </xsl:choose> -->
|
||||
<!-- </xsl:element> -->
|
||||
|
||||
<!-- <xsl:if test="/buildinfo/document/set/news[tags/tag = $tag]"> -->
|
||||
|
||||
<!-- <xsl:element name="ul"> -->
|
||||
<!-- <xsl:attribute name="class">tag-<xsl:value-of select="$tag" /> tag list</xsl:attribute> -->
|
||||
<!-- <xsl:attribute name="id"> -->
|
||||
<!-- <xsl:text>n</xsl:text> -->
|
||||
<!-- <xsl:value-of select="translate($tag, ' ', '')" /> -->
|
||||
<!-- </xsl:attribute> -->
|
||||
|
||||
<!-- <xsl:for-each select="/buildinfo/document/set/news[tags/tag = $tag]"> -->
|
||||
|
||||
<!-- <xsl:element name="li"> -->
|
||||
<!-- <xsl:element name="a"> -->
|
||||
<!-- <xsl:attribute name="href"><xsl:value-of select="link" /></xsl:attribute> -->
|
||||
<!-- <xsl:value-of select="title" /> -->
|
||||
<!-- </xsl:element> -->
|
||||
<!-- </xsl:element> -->
|
||||
|
||||
<!-- </xsl:for-each> -->
|
||||
|
||||
<!-- </xsl:element> -->
|
||||
|
||||
<!-- </xsl:if> -->
|
||||
|
||||
<!-- <xsl:if test="/buildinfo/document/set/event[tags/tag = $tag]"> -->
|
||||
|
||||
<!-- <xsl:element name="ul"> -->
|
||||
<!-- <xsl:attribute name="class">tag-<xsl:value-of select="$tag" /> tag list</xsl:attribute> -->
|
||||
<!-- <xsl:attribute name="id"> -->
|
||||
<!-- <xsl:text>e</xsl:text> -->
|
||||
<!-- <xsl:value-of select="translate($tag, ' ', '')" /> -->
|
||||
<!-- </xsl:attribute> -->
|
||||
|
||||
<!-- <xsl:for-each select="/buildinfo/document/set/event[tags/tag = $tag]"> -->
|
||||
|
||||
<!-- <xsl:element name="li"> -->
|
||||
<!-- <xsl:element name="a"> -->
|
||||
<!-- <xsl:attribute name="href"> -->
|
||||
<!-- <xsl:call-template name="event-link"> -->
|
||||
<!--xsl:with-param name="absolute-fsfe-links" select="$absolute-fsfe-links" -->
|
||||
<!-- </xsl:call-template> -->
|
||||
<!-- </xsl:attribute> -->
|
||||
<!-- <xsl:value-of select="title" /> -->
|
||||
<!-- </xsl:element> -->
|
||||
<!-- </xsl:element> -->
|
||||
|
||||
<!-- </xsl:for-each> -->
|
||||
|
||||
<!-- </xsl:element> -->
|
||||
|
||||
<!-- </xsl:if> -->
|
||||
|
||||
<!-- </xsl:element> -->
|
||||
|
||||
<!-- </xsl:for-each> -->
|
||||
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
Loading…
x
Reference in New Issue
Block a user