Hello, on Donnerstag, 8. März 2007, Thomas Schraitle wrote: > On Donnerstag, 8. März 2007, Christian Boltz wrote: > > In short: I have written a xsl file that filters the output of > > zypp-checkpatches-wrapper to send an update notification mail to > > root. > > > > It basically works, however I have some problems with the > > whitespace. > > Basically, it is a good idea to use xsl:text and xsl:strip-space > and/or xsl:preserve-space. Especially if you want exact control of > your whitespace. It can be a bit tricky to find the correct > combination though. :)
"a bit"?!? ;-) > > I'd like to have > > [...] > > Can someone help me with these issues? > > See the attached XSLT file. It gives me the following output: [...] That looks much better, thanks. And I even understand what you do ;-) so I could make some more modifications. I now get the following result which looks how I want it: # xsltproc patch2mail_ts_cb.xsl zypp.xml |grep -v __TOTAL *** ERROR *** Some error during calculation happened *** ERROR *** Another error Update sources: - ftp.gwdg.de (http://ftp.gwdg.de/pub/suse/update/10.1) - irgendwo (http://ftp.irgendwo.de) === java-1_5_0-sun - Patch 1438-0 (security) === SUN Java packages prior 1.5.0 update 7 allow DOS. Sun Java Runtime Environment (JRE) 1.5.0_6 and earlier, JDK 1.5.0_6 and earlier, and SDK 1.5.0_6 and earlier allows remote attackers to cause a denial of service (disk consumption) by using the Font.createFont function to create temporary files of arbitrary size in the %temp% directory (CVE-2006-2426). === java-1_5_0-sun - Patch 1438-0 (security) === SUN Java packages prior 1.5.0 update 7 allow DOS. Sun Java Runtime Environment (JRE) 1.5.0_6 and earlier, JDK 1.5.0_6 and earlier, and SDK 1.5.0_6 and earlier allows remote attackers to cause a denial of service (disk consumption) by using the Font.createFont function to create temporary files of arbitrary size in the %temp% directory (CVE-2006-2426). -------------------------------------------------------- Total: 2 updates (2 security) Thanks for your help! My updated xslt file is attached to this mail (also tested with no errors, no available updates and available updates without errors). I'll post this to opensuse-factory in the next days also - maybe it's something that might be interesting for 10.3... Regards, Christian Boltz, again searching for a xsl-sig ;-) -- Eine "Sprache", in der man <xsl:call-template name="foo"> <xsl:with-param name="arg">blubber</xsl:with-param> </xsl:call-template> schreiben muß, wo jeder andere foo(blubber) schreibt, *muß* irgendwie ein Erfolg werden. Jedenfalls für Festplatten- und Speicherverkäufer. [Stefan Reuther]
<?xml version="1.0" encoding="ISO-8859-15"?> <!-- Copyright (c) 2007 Christian Boltz - www.cboltz.de Thanks to Thomas Schraitle for helping with some xslt details. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License (http://www.gnu.org/copyleft/gpl.html) for more details. --> <xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <!-- <xsl:output method="text" encoding="ISO-8859-15" media-type="text/plain" /> --> <xsl:strip-space elements="*"/> <xsl:template match="/"><xsl:apply-templates /></xsl:template> <xsl:template match="update-status"> <xsl:document href="-" method="text" ><xsl:apply-templates /> </xsl:document></xsl:template> <!-- errors --> <xsl:template match="errors"><xsl:apply-templates /></xsl:template> <xsl:template match="errors/error"> <xsl:text>*** ERROR *** </xsl:text> <xsl:apply-templates /> <xsl:text> </xsl:text> </xsl:template> <!-- update sources --> <xsl:template match="update-sources"> <xsl:text>Update sources: </xsl:text> <xsl:apply-templates /> <xsl:text> </xsl:text> </xsl:template> <xsl:template match="update-sources/source"> <xsl:text>- </xsl:text> <xsl:value-of select="@alias" /> (<xsl:value-of select="@url" />) </xsl:template> <!-- updates --> <xsl:template match="update-list"> <xsl:apply-templates /> </xsl:template> <xsl:template match="update-list/update"> <xsl:text> === </xsl:text> <xsl:value-of select="@name" /> <xsl:text> - Patch </xsl:text> <xsl:value-of select="@edition" /> <xsl:text> (</xsl:text> <xsl:value-of select="@category" /> <xsl:text>) === </xsl:text> <xsl:apply-templates /> <xsl:text> </xsl:text> </xsl:template> <xsl:template match="update-list/update/summary"> <xsl:apply-templates /> </xsl:template> <xsl:template match="update-list/update/description"> <xsl:text> </xsl:text> <xsl:apply-templates /> </xsl:template> <!-- update source of this specific update isn't that interesting ;-) --> <!-- <xsl:template match="update-list/update/source">Update source: <xsl:value-of select="@alias" /> (<xsl:value-of select="@url" />)</xsl:template> --> <!-- summary --> <xsl:template match="update-summary"> <xsl:text>-------------------------------------------------------- </xsl:text> <xsl:text> Total: </xsl:text> <xsl:value-of select="@total" /> <xsl:text> updates (</xsl:text> <xsl:value-of select="@security" /> <xsl:text> security) __TOTAL__</xsl:text> <xsl:value-of select="@total" /><xsl:value-of select="@security" /> <xsl:text>__ </xsl:text> </xsl:template> <!-- end --> </xsl:stylesheet>
