Revision 1217 tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xtz/XTZPager.groovy

XTZPager.groovy (revision 1217)
5 5

  
6 6
import org.txm.objects.BaseParameters
7 7
import org.w3c.dom.Element
8

  
8 9
import org.txm.scripts.importer.*
9 10
import org.txm.stat.utils.ConsoleProgressBar
10 11
import org.txm.utils.BundleUtils;
......
267 268
			String s = module.getProject().getEditionDefinition("default").getWordsPerPage()
268 269
			if (s != null && s.length() > 0)
269 270

  
270
				// shared XSL parameters
271
				xslParams["number-words-per-page"] = Integer.parseInt(s);
271
			// shared XSL parameters
272
			xslParams["number-words-per-page"] = Integer.parseInt(s);
272 273
			xslParams["pagination-element"] = module.getProject().getEditionDefinition("default").getPageElement()
273 274
			xslParams["import-xml-path"] = module.getProject().getProjectDirectory()
274 275
			//println "XSL PARAMS: "+xslParams
275 276

  
276 277
			def xslFiles = xslDirectory.listFiles()
277
			xslFiles.sort()
278
			xslFiles = xslFiles.sort() { f -> 
279
				try {
280
				return Integer.parseInt(f.getName().substring(0, f.getName().indexOf("-")))
281
				} catch(Exception e) {}
282
				return -1;
283
			}
278 284
			def editionsCreated = [:]
279 285
			for (File xslFile : xslFiles) {
280 286
				if (xslFile.isDirectory() || xslFile.isHidden() || !xslFile.getName().endsWith(".xsl")) continue;
281
				if (!xslFile.getName().matches("[1-9]-.+")) continue;
287
				if (!xslFile.getName().matches("[1-9]{1.3}-.+")) continue;
282 288

  
283 289
				String xslName = xslFile.getName().substring(2); // remove the "1-", "2-", etc.
284 290
				int idx2 = xslName.indexOf(".")

Also available in: Unified diff