# Python script to count default-locale values
# Author: Rintze M. Zelle
# Version: 2012-11-01
# * Requires lxml library (http://lxml.de/)
#
# Prints the default-locale values

import os, glob, re
from lxml import etree

path = 'C:\Documents and Settings\zelle\My Documents\CSL\styles\\'
uniqueStrings = {}
styles = []
stylesTested = 0

for stylepath in glob.glob( os.path.join(path, '*.csl') ):
    styles.append(os.path.join(stylepath))
##for stylepath in glob.glob( os.path.join(path, 'dependent', '*.csl') ):
##    styles.append(os.path.join(stylepath))

for style in styles:
    parsedStyle = etree.parse(style)
    styleElement = parsedStyle.getroot()

    stylesTested += 1

    if "default-locale" in styleElement.attrib:
        defaultLocale = styleElement.get("default-locale")
    else:
        defaultLocale = "no default-locale"

    if defaultLocale in uniqueStrings:
        uniqueStrings[defaultLocale] += 1
    else:
        uniqueStrings[defaultLocale] = 1

sortedStrings = sorted(uniqueStrings, key=uniqueStrings.get, reverse=True)

print("Styles tested: " + "%d" % (stylesTested))
print("default-locale values:")
for string in sortedStrings:
    print('"' + string + '"' + ": %d" % (uniqueStrings[string]))

@@ -84,15 +84,15 @@
  201
-2-11-01
+3-04-07
 %0A# *
@@ -189,16 +189,25 @@
 glob, re
+, inspect
 %0Afrom lx
@@ -227,122 +227,249 @@
 ee%0A%0A
-path = 'C:%5CDocuments and Settings%5Czelle%5CMy Documents%5CCSL%5Cstyles%5C%5C'%0AuniqueStrings = %7B%7D%0A
+# http://stackoverflow.com/questions/50499%0AfolderPath =  os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))%0A%0AparentFolderPath = os.path.dirname (folderPath)%0Apath =  os.path.join(parentFolderPath, '
 styles
- = %5B%5D
+')%0A
 %0Astyles
-Tested
  = 
-0
+%5B%5D
 %0A%0Afo
@@ -568,18 +568,16 @@
 epath))%0A
-##
 for styl
@@ -644,10 +644,8 @@
  ):%0A
-##
     
@@ -684,16 +684,53 @@
 path))%0A%0A
+uniqueStrings = %7B%7D%0AstylesTested = 0%0A%0A
 for styl

Update default-locale count script