[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: [Fwd: Re: Mime-typ Scribus?]
From:       Waldo Bastian <bastian () kde ! org>
Date:       2006-06-09 16:55:44
Message-ID: 200606091001.33891.bastian () kde ! org
[Download RAW message or body]

[Attachment #2 (multipart/mixed)]


On Wednesday 07 June 2006 17:28, James Richard Tyrer wrote:
> > Would it be possible to simply have a script that would generate the
> > necessary file: "$KDEDIR/share/mimelnk/application/x-scribus":

I just wrote one for xdg-utils. If anyone wants to help...I'm wondering how to 
embed these xsl chunks into the xdg-mime script and feed it into xsltproc via 
stdin...

README
=======
Here you find some XSL transformation scripts for processing mime
type definitions in XML format as defined by the Shared MIME-info Database
specification [1]

[1] http://www.freedesktop.org/wiki/Standards/shared-mime-info-spec
===
Command: xsltproc sharedmime-list.xsl input-file.xml

Lists all mimetypes contained in a shared mime Database XML input file
===
Command: xsltproc --stringparam type mime/type sharedmime2mimelnk.xsl 
input-file.xml

Converts the mimetype "mime/type" contained in a shared mime Database XML
input file into KDE's mimelnk format.
===
TODO:
* Add support for magic entries and convert to KDE magic chunks in
  share/config/magic/*

-- 
Linux Client Architect - Channel Platform Solutions Group - Intel Corporation

["sharedmime-list.xsl" (text/x-xslt)]

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:mime="http://www.freedesktop.org/standards/shared-mime-info">
<xsl:output method="text"
            encoding="UTF-8"
            indent="no"/>
<xsl:template match="/">
      <xsl:for-each select='mime:mime-info/mime:mime-type'>
        <xsl:value-of select="@type"/><xsl:text>&#10;</xsl:text>
      </xsl:for-each>
</xsl:template>
</xsl:stylesheet>

["sharedmime2mimelnk.xsl" (text/x-xslt)]

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:mime="http://www.freedesktop.org/standards/shared-mime-info">
<xsl:output method="text"
            encoding="UTF-8"
            indent="no"/>
<xsl:template match="/">
      <xsl:for-each select='mime:mime-info/mime:mime-type[@type=$type]'>
        <xsl:text>[Desktop Entry]&#10;</xsl:text>
        <xsl:text>Type=MimeType&#10;</xsl:text>
        <xsl:text>MimeType=</xsl:text><xsl:value-of \
                select="@type"/><xsl:text>&#10;</xsl:text>
        <xsl:text>Icon=</xsl:text><xsl:value-of \
select="translate(@type,'/','-')"/><xsl:text>&#10;</xsl:text>  <xsl:if \
                test="mime:sub-class-of">
           <xsl:text>X-KDE-IsAlso=</xsl:text><xsl:value-of \
select="mime:sub-class-of/@type"/><xsl:text>&#10;</xsl:text>  </xsl:if>
        <xsl:if test="mime:glob">
          <xsl:text>Patterns=</xsl:text>
          <xsl:for-each select='mime:glob[@pattern]'>
            <xsl:value-of select="@pattern"/><xsl:text>;</xsl:text>
          </xsl:for-each>
          <xsl:text>&#10;</xsl:text>
        </xsl:if>
        <xsl:text>Comment=</xsl:text><xsl:value-of \
select="mime:comment[not(@xml:lang)]"/><xsl:text>&#10;</xsl:text>  <xsl:for-each \
select='mime:comment[@xml:lang]'>  <xsl:sort select='@xml:lang'/>
          <xsl:text>Comment[</xsl:text><xsl:value-of \
select="@xml:lang"/><xsl:text>]=</xsl:text><xsl:value-of \
select="."/><xsl:text>&#10;</xsl:text>  </xsl:for-each>
     </xsl:for-each>
</xsl:template>
</xsl:stylesheet>


[Attachment #7 (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic