Use the html-news-generate-anchor template consistently.

This fixes a malformed anchor id used in <a> or <link> element.

Spotted by:	Osmany Guirola Cruz (osmany.guirola at cigb dot edu dot cu)
This commit is contained in:
Hiroki Sato 2005-03-10 14:40:34 +00:00
parent c82e8655cd
commit ea01e24b92
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/www/; revision=24050
2 changed files with 68 additions and 10 deletions

View file

@ -1,14 +1,20 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!-- $FreeBSD: www/en/news/news-rdf.xsl,v 1.5 2003/08/15 17:35:42 simon Exp $ -->
<!-- $FreeBSD: www/en/news/news-rdf.xsl,v 1.6 2004/05/25 01:18:44 hrs Exp $ -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:cvs="http://www.FreeBSD.org/XML/CVS">
<xsl:import href="../includes.xsl"/>
<xsl:import href="includes.xsl"/>
<xsl:output method="xml" indent="yes"/>
<xsl:variable name="base" select="'..'"/>
<xsl:variable name="title" select="'FreeBSD News Flash RDF'"/>
<xsl:variable name="date">
<xsl:value-of select="//cvs:keyword[@name='freebsd']"/>
</xsl:variable>
<!-- Generate the main body of the RDF file -->
<xsl:template match="news">
@ -29,6 +35,18 @@
<!-- Generate the <item> elements and their content -->
<xsl:template match="event" xmlns="http://my.netscape.com/rdf/simple/0.9/">
<xsl:param name="year" select="../../../name" />
<xsl:param name="month" select="../../name" />
<xsl:param name="day" select="../name" />
<xsl:param name="this" select="." />
<xsl:param name="pos">
<xsl:for-each select="../event">
<xsl:if test=". = $this">
<xsl:value-of select="position()" />
</xsl:if>
</xsl:for-each>
</xsl:param>
<item>
<xsl:choose>
<xsl:when test="count(child::title)">
@ -38,7 +56,16 @@
<title><xsl:value-of select="normalize-space(p)"/></title>
</xsl:otherwise>
</xsl:choose>
<link>http://www.FreeBSD.org/news/newsflash.html#<xsl:call-template name="generate-event-anchor"/></link>
<link>
<xsl:text>http://www.FreeBSD.org/news/newsflash.html#</xsl:text>
<xsl:call-template name="html-news-generate-anchor">
<xsl:with-param name="label" select="'event'" />
<xsl:with-param name="year" select="$year" />
<xsl:with-param name="month" select="$month" />
<xsl:with-param name="day" select="$day" />
<xsl:with-param name="pos" select="$pos" />
</xsl:call-template>
</link>
</item>
</xsl:template>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!-- $FreeBSD: www/share/sgml/includes.misc.xsl,v 1.18 2005/01/10 20:26:08 ceri Exp $ -->
<!-- $FreeBSD: www/share/sgml/includes.misc.xsl,v 1.19 2005/01/10 21:43:13 ceri Exp $ -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
@ -602,9 +602,18 @@
<xsl:choose>
<xsl:when test="$localizeditems/event">
<xsl:for-each select="$localizeditems/event">
<xsl:param name="anchor-position" select="position()" />
<xsl:value-of select="$leadingmark" /><a>
<xsl:attribute name="href">
news/newsflash.html#<xsl:call-template name="generate-event-anchor"/>
<xsl:text>news/newsflash.html#</xsl:text>
<xsl:call-template name="html-news-generate-anchor">
<xsl:with-param name="label" select="'event'" />
<xsl:with-param name="year" select="$year" />
<xsl:with-param name="month" select="$month" />
<xsl:with-param name="day" select="$day" />
<xsl:with-param name="pos" select="$anchor-position" />
</xsl:call-template>
</xsl:attribute>
<xsl:choose>
@ -621,9 +630,18 @@
<xsl:otherwise>
<xsl:for-each select="event">
<xsl:param name="anchor-position" select="position()" />
<xsl:value-of select="$leadingmark" /><a>
<xsl:attribute name="href">
news/newsflash.html#<xsl:call-template name="generate-event-anchor"/>
<xsl:text>news/newsflash.html#</xsl:text>
<xsl:call-template name="html-news-generate-anchor">
<xsl:with-param name="label" select="'event'" />
<xsl:with-param name="year" select="$year" />
<xsl:with-param name="month" select="$month" />
<xsl:with-param name="day" select="$day" />
<xsl:with-param name="pos" select="$anchor-position" />
</xsl:call-template>
</xsl:attribute>
<xsl:choose>
@ -664,12 +682,19 @@
<xsl:param name="news.press.xml" select="''" />
<xsl:for-each select="document($news.press.xml-master)/descendant::story[position() &lt;= 5]">
<xsl:param name="year" select="../../year/name" />
<xsl:param name="month" select="../month/name" />
<xsl:param name="pos" select="position()" />
<xsl:param name="year" select="../../name" />
<xsl:param name="month" select="../name" />
<xsl:param name="url" select="url" />
<xsl:param name="site-url" select="site-url" />
<xsl:param name="pos">
<xsl:for-each select="../story">
<xsl:if test="url = $url">
<xsl:value-of select="position()" />
</xsl:if>
</xsl:for-each>
</xsl:param>
<!-- search localized items per story(URL) basis -->
<xsl:param name="localizeditems"
select="document($news.press.xml)
@ -680,7 +705,13 @@
<xsl:value-of select="$leadingmark" />
<a>
<xsl:attribute name="href">
news/press.html#<xsl:call-template name="generate-story-anchor"/>
<xsl:text>news/press.html#</xsl:text>
<xsl:call-template name="html-news-generate-anchor">
<xsl:with-param name="label" select="'story'" />
<xsl:with-param name="year" select="$year" />
<xsl:with-param name="month" select="$month" />
<xsl:with-param name="pos" select="$pos" />
</xsl:call-template>
</xsl:attribute>
<xsl:choose>