[kde-edu]: generating word lists for kwordquiz from kgeography-data

Peter Hedlund peter at peterandlinda.com
Thu Jan 13 00:02:54 CET 2005


Peter Hedlund wrote:
> Hi,
> 
> CPH wrote:
> 
>> Hi,   Is it a reasonable suggestion for kwordquiz to use the data from 
>> kgeography (i.e. city/region) ? I think that it could be generated 
>> thru a "simple" XSLT or python script, either during startup or when 
>> given a kgeography file ( .kgm ).

Just for the fun of it, here's some XSLT that will display a .kgm file 
in a table that can be copied into KWordQuiz (somewhat tested). Save as 
kgeography.xsl and then insert this line at the top of the .kgm file:

<?xml-stylesheet type="text/xsl" href="kgeography.xsl"?>

Thanks,
Peter

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
   <html>
   <body>
     <h2>KGeography Map</h2>
     <table border="1">
       <tr bgcolor="#9acd32">
         <th align="left">Country</th>
         <th align="left">Capital</th>
       </tr>
       <xsl:for-each select="map/division">
         <xsl:choose>
           <xsl:when test="ignore='yes'">
           </xsl:when>
           <xsl:otherwise>
             <tr>
               <td><xsl:value-of select="name"/></td>
               <td><xsl:value-of select="capital"/></td>
             </tr>
           </xsl:otherwise>
         </xsl:choose>
       </xsl:for-each>
     </table>
   </body>
   </html>
</xsl:template>
</xsl:stylesheet>


More information about the kde-edu mailing list