Subject: Re: how to override &release.latest; ?
To: None <hubert@feyrer.de>
From: Hiroki Sato <hrs@NetBSD.org>
List: netbsd-docs
Date: 04/08/2007 22:17:18
----Security_Multipart0(Sun_Apr__8_22_17_18_2007_573)--
Content-Type: Multipart/Mixed;
boundary="--Next_Part(Sun_Apr__8_22_17_18_2007_928)--"
Content-Transfer-Encoding: 7bit
----Next_Part(Sun_Apr__8_22_17_18_2007_928)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Hubert Feyrer <hubert@feyrer.de> wrote
in <Pine.LNX.4.64.0704081351400.9004@m2s05.vlinux.de>:
hu> For the pc532 ports page, I'd like to override &release.latest; and set it
hu> to 1.5.3, as that's when the port was last released in binary. How does
hu> one do that?
hu>
hu> Here's what doesn't work:
hu>
hu> <!DOCTYPE webpage
hu> PUBLIC "-//NetBSD//DTD Website-based NetBSD Extension//EN"
hu> "http://www.NetBSD.org/XML/htdocs/lang/share/xml/website-netbsd.dtd" [
hu> ===> <!ENTITY release.latest "1.5.3">
hu> ]>
hu>
hu> The <portspage> tag uses release.latest (and some others.
hu>
hu> Any ideas?
I think something like the attached patch is needed. You can think
the scope and linkage of an entity reference (&foo;) is "static"
storage class in C language. The &foo; defined in an XML file, it
can be used in the same XML file, but not in the XSL stylesheet. So,
redefining &release.latest; in the XML file does not affect the
templates for <portinfo> in the XSL stylesheet.
--
| Hiroki SATO
----Next_Part(Sun_Apr__8_22_17_18_2007_928)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="pc532.diff"
Index: Ports/pc532/index.xml
===================================================================
RCS file: /cvsroot/htdocs/Ports/pc532/index.xml,v
retrieving revision 1.1
diff -d -u -I\$FreeBSD:.*\$ -I\$NetBSD:.*\$ -I\$OpenBSD:.*\$ -I\$DragonFly:.*\$ -I\$Id:.*\$ -I\$hrs:.*\$ -r1.1 index.xml
--- Ports/pc532/index.xml 8 Apr 2007 12:01:37 -0000 1.1
+++ Ports/pc532/index.xml 8 Apr 2007 13:07:59 -0000
@@ -1,17 +1,7 @@
-XXX This file is almost complete, BUT &release.latest; needs to be
-redefined to reflect that this port was released in binary with 1.5.3
-latest. Without this, the links on the right side for download
-etc. will be broken! - hubertf
-
-
<?xml version="1.0"?>
-
<!DOCTYPE webpage
PUBLIC "-//NetBSD//DTD Website-based NetBSD Extension//EN"
- "http://www.NetBSD.org/XML/htdocs/lang/share/xml/website-netbsd.dtd" [
-<!ENTITY FIXMErelease.latest "1.5.3">
-]>
-
+ "http://www.NetBSD.org/XML/htdocs/lang/share/xml/website-netbsd.dtd">
<webpage id="Ports-pc532-index" portpage="pc532">
<config param="desc" value="NetBSD/pc532"/>
@@ -41,7 +31,7 @@
</para>
</portabout>
- <portinfo>
+ <portinfo currel="1.5.3">
<portinfoitem>
<ulink url="faq.html">NetBSD/pc532 FAQ</ulink>
Index: share/xsl/portpage.xsl
===================================================================
RCS file: /cvsroot/htdocs/share/xsl/portpage.xsl,v
retrieving revision 1.21
diff -d -u -I\$FreeBSD:.*\$ -I\$NetBSD:.*\$ -I\$OpenBSD:.*\$ -I\$DragonFly:.*\$ -I\$Id:.*\$ -I\$hrs:.*\$ -r1.21 portpage.xsl
--- share/xsl/portpage.xsl 13 Mar 2007 18:52:24 -0000 1.21
+++ share/xsl/portpage.xsl 8 Apr 2007 13:07:59 -0000
@@ -19,6 +19,7 @@
<xsl:with-param name="logo" select="./@logo"/>
<xsl:with-param name="logoh" select="./@logoheight"/>
<xsl:with-param name="logow" select="./@logowidth"/>
+ <xsl:with-param name="currel" select="./@currel"/>
</xsl:call-template>
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
@@ -113,6 +114,10 @@
<xsl:template match="portinfo">
<xsl:variable name="port" select="ancestor::webpage/@portpage"/>
+ <xsl:variable name="currel" select="@currel"/>
+ <xsl:variable name="currel.major" select="substring-before(@currel, '.')"/>
+ <xsl:variable name="currel.minor" select="substring-after(@currel, '.')"/>
+ <xsl:variable name="currel.previous.major" select="&release.previous.major;"/>
<div class="portinfo">
<xsl:if test="child::portinfoitem">
@@ -185,53 +190,42 @@
<xsl:if test="@type='ftp'">
<a>
<xsl:attribute name="href">
- <xsl:text>ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-&release.latest;/</xsl:text>
- <xsl:value-of select="$port"/>
- <xsl:text>/</xsl:text>
+ <xsl:value-of select="concat('ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-', $currel, '/', $port, '/')" />
</xsl:attribute>
<xsl:text>NetBSD/</xsl:text>
- <xsl:value-of select="$port"/>
- <xsl:text> &release.latest; via FTP</xsl:text>
+ <xsl:value-of select="concat('NetBSD/', $port, ' ', $currel, ' via FTP')"/>
</a>
</xsl:if>
<xsl:if test="@type='installnotes'">
<a>
<xsl:attribute name="href">
- <xsl:text>ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-&release.latest;/</xsl:text>
- <xsl:value-of select="$port"/>
- <xsl:text>/INSTALL.html</xsl:text>
+ <xsl:value-of select="concat('ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-', $currel, '/', $port, '/INSTALL.html')" />
</xsl:attribute>
- <xsl:text>NetBSD/</xsl:text>
- <xsl:value-of select="$port"/>
- <xsl:text> &release.latest; Install Notes</xsl:text>
+ <xsl:value-of select="concat('NetBSD/', $port, ' ', $currel, ' Install Notes')"/>
</a>
</xsl:if>
<xsl:if test="@type='ra'">
<a>
<xsl:attribute name="href">
- <xsl:text>../../Releases/formal-&release.latest.major;/NetBSD-&release.latest;.html</xsl:text>
+ <xsl:value-of select="concat('../../Releases/formal-', $currel.major, '/NetBSD-', $currel, '.html')" />
</xsl:attribute>
- <xsl:text>NetBSD &release.latest; release announcement</xsl:text>
+ <xsl:value-of select="concat('NetBSD ', $currel, ' release announcement')" />
</a>
</xsl:if>
<xsl:if test="@type='port-changes'">
<a>
<xsl:attribute name="href">
- <xsl:text>../../Changes/changes-&release.latest.major;.0.html#port-</xsl:text>
- <xsl:value-of select="$port" />
+ <xsl:value-of select="concat('../../Changes/changes-', $currel.major, '.0.html#port-', $port)" />
</xsl:attribute>
- <xsl:text>NetBSD/</xsl:text>
- <xsl:value-of select="$port" />
- <xsl:text> changes to &release.latest.major;.0</xsl:text>
+ <xsl:value-of select="concat('NetBSD/', $port, ' changes to ', $currel.major, '.0')" />
</a>
</xsl:if>
<xsl:if test="@type='netbsd-changes'">
<a>
<xsl:attribute name="href">
- <xsl:text>ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-&release.latest.major;.0/CHANGES</xsl:text>
+ <xsl:value-of select="concat('ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-', $currel.major, '.0/CHANGES')"/>
</xsl:attribute>
- <xsl:text>Changes from NetBSD &release.previous.major;.0
-to NetBSD &release.latest.major;.0</xsl:text>
+ <xsl:value-of select="concat('Changes from NetBSD ', $currel.previous.major, '.0 to to NetBSD ', $currel.major, '.0')" />
</a>
</xsl:if>
<xsl:if test="@type='packages'">
----Next_Part(Sun_Apr__8_22_17_18_2007_928)----
----Security_Multipart0(Sun_Apr__8_22_17_18_2007_573)--
Content-Type: application/pgp-signature
Content-Transfer-Encoding: 7bit
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (FreeBSD)
iD8DBQBGGOteTyzT2CeTzy0RAtb7AJ40+sMbvwjtC9yLb8pZoZkYoTCWlQCfXs8v
ax/tK8A8bFtIlrPy8JtE+eY=
=iA7K
-----END PGP SIGNATURE-----
----Security_Multipart0(Sun_Apr__8_22_17_18_2007_573)----