tracker r2808 - in trunk: . utils/services



Author: pvanhoof
Date: Tue Jan 20 11:27:44 2009
New Revision: 2808
URL: http://svn.gnome.org/viewvc/tracker?rev=2808&view=rev

Log:
        * utils/services/sample.xsl: added a sample XSLT
        * utils/services/README.example: Added a sample XSLT




Added:
   trunk/utils/services/README.example
   trunk/utils/services/sample.xsl
Modified:
   trunk/ChangeLog
   trunk/utils/services/service2xml.py

Added: trunk/utils/services/README.example
==============================================================================
--- (empty file)
+++ trunk/utils/services/README.example	Tue Jan 20 11:27:44 2009
@@ -0,0 +1 @@
+python ./service2xml.py < ../../data/services/email.metadata > t.xml ; xsltproc sample.xsl t.xml

Added: trunk/utils/services/sample.xsl
==============================================================================
--- (empty file)
+++ trunk/utils/services/sample.xsl	Tue Jan 20 11:27:44 2009
@@ -0,0 +1,18 @@
+<xsl:stylesheet version = '1.0'
+     xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
+<xsl:output method="text" />
+<xsl:template match="service">
+<xsl:for-each select="section">
+// item#<xsl:value-of select="position()"/> for <xsl:value-of select="@fullname" /> 
+get<xsl:value-of select="@name"/>Of<xsl:value-of select="@prefix" /> {
+    <xsl:for-each select="item">
+  <xsl:value-of select="@name"/> {
+       full   : <xsl:value-of select="@fullvalue"/>
+       prefix : <xsl:value-of select="prefix" />
+       value  : <xsl:value-of select="value" />
+    }
+  </xsl:for-each>
+}
+</xsl:for-each>
+</xsl:template>
+</xsl:stylesheet> 

Modified: trunk/utils/services/service2xml.py
==============================================================================
--- trunk/utils/services/service2xml.py	(original)
+++ trunk/utils/services/service2xml.py	Tue Jan 20 11:27:44 2009
@@ -4,9 +4,10 @@
 config = ConfigParser.ConfigParser()
 config.readfp(sys.stdin)
 
+print "<service>"
 for section in config.sections():
    splitted = section.split (":")
-   print "<section prefix=\"" + splitted[0] + "\" name=\"" + splitted[1] + "\" fullname=\"" + section + "\">"
+   print " <section prefix=\"" + splitted[0] + "\" name=\"" + splitted[1] + "\" fullname=\"" + section + "\">"
    for name, value in config.items (section):
      vsplit = value.split (":")
      print "\t<item name=\""+ name + "\" fullvalue=\"" + value+ "\">"
@@ -17,4 +18,5 @@
        print "\t\t<prefix />"
        print "\t\t<value>" + value + "</value>"
      print "\t</item>"
-   print "</section>"
+   print " </section>"
+print "</service>"



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]