Please find my contribution for making the package list [1] human
readable. A request for help was made on the forums [2] and since I
was looking for the same thing, I thought I'd address the problem with
a solution. The XSLT is pretty simple, but I just wanted to get
something working which could then be improved on.
There are some problems with the original XML though.
"<ENDOFPACKAGES>" as a delimiter? I don't think that is a good idea.
And it would be useful to see a xsd file created so that things like
status can be standardised and validated.
Because I used XSLT 2.0 you'll need to do the transform server-side or
with a Firefox plugin like this [3]. It could be made XSLT 1.0 if you
dropped the grouping by category or rewrote the original XML to group
the packages by category in the first place.
I release this code under the standard BSD license.
Ari Maniatis
[1] http://www.pfsense.com/packages/pkg_config.xml
[2] http://forum.pfsense.org/index.php/topic,7743.0.html
[3] https://addons.mozilla.org/en-US/firefox/addon/5023
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="2.0">
<xsl:output method="html" encoding="UTF-8" indent="yes"/>
<xsl:template match="pfsensepkgs">
<html>
<head>
<title>pfSense Open Source Firewall Distribution -
Packages</title>
<link rel="shortcut icon" href="http://www.pfsense.org/images/favicon.ico
" />
<link rel="stylesheet" href="templates/modular_plazza/
css/template_css.css" type="text/css" />
<link rel="stylesheet" href="templates/modular_plazza/
css/sfish.css" type="text/css" />
</head>
<body class="bodies">
<h2>pfSense Package list</h2>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
<xsl:template match="packages">
<xsl:for-each-group select="package" group-by="category">
<h3>
Category: <xsl:value-of select="current-grouping-
key()"/>
</h3>
<xsl:for-each select="current-group()">
<h4>
<xsl:value-of select="name"/>
</h4>
<span class="version">Version <xsl:value-of
select="version"/> </span>
<xsl:choose>
<xsl:when test="status = 'ALPHA'" ><span
style="color:red">alpha</span></xsl:when>
<xsl:when test="status = 'BETA'" ><span
style="color:blue">beta</span></xsl:when>
<xsl:otherwise><span
style="color:green"><xsl:value-of select="status"/></span></
xsl:otherwise>
</xsl:choose>
<br/>
<xsl:value-of select="descr" disable-output-
escaping="yes"/>
</xsl:for-each>
</xsl:for-each-group>
</xsl:template>
</xsl:stylesheet>
-------------------------->
ish
http://www.ish.com.au
Level 1, 30 Wilson Street Newtown 2042 Australia
phone +61 2 9550 5001 fax +61 2 9550 4001
GPG fingerprint CBFB 84B4 738D 4E87 5E5C 5EFA EF6A 7D2E 3E49 102A
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
Commercial support available - https://portal.pfsense.org