diff options
author | Shaun McCance <shaunm@gnome.org> | 2013-10-27 21:02:46 -0400 |
---|---|---|
committer | Shaun McCance <shaunm@gnome.org> | 2013-10-27 21:02:46 -0400 |
commit | dde5a9ac006ab839b67e711e27977fbf074dc04e (patch) | |
tree | fc4ccecf7280be34b5e5fcc5fb3ed85217abd1dd | |
parent | 45872e7e4252aadd0fc304ab3c9d1d740c690b5f (diff) | |
download | itstool-dde5a9ac006ab839b67e711e27977fbf074dc04e.tar.gz |
Add support for its:param
-rwxr-xr-x | itstool.in | 12 | ||||
-rwxr-xr-x | tests/ITS-2.0-Testsuite/run_tests.sh | 16 |
2 files changed, 12 insertions, 16 deletions
@@ -517,6 +517,13 @@ class Document (object): if self._xml_err: raise libxml2.parserError(self._xml_err) + def register_its_params(self, xpath, rules): + for child in xml_child_iter(rules): + if xml_is_ns_name(child, NS_ITS, 'param'): + name = child.nsProp('name', None) + value = child.getContent() + xpath.xpathRegisterVariable(name, None, value) + def apply_its_rule(self, rule, xpath): if rule.type != 'element': return @@ -746,6 +753,7 @@ class Document (object): xpath.xpathRegisterNs(nsdef.name, nsdef.content) nsdef = nsdef.next par = par.parent + self.register_its_params(xpath, root) self.apply_its_rule(rule, xpath) def apply_local_its_rules (self): @@ -760,12 +768,14 @@ class Document (object): nsdef = nsdef.next xpath = self._doc.xpathNewContext() reg_ns(xpath, rules) + self.register_its_params(xpath, rules) for rule in xml_child_iter(rules): if rule.type != 'element': continue if rule.nsDefs() is not None: - rule_xpath = self._doc.xpathNewContent() + rule_xpath = self._doc.xpathNewContext() reg_ns(rule_xpath, rule) + self.register_its_params(rule_xpath, rules) else: rule_xpath = xpath self.apply_its_rule(rule, rule_xpath) diff --git a/tests/ITS-2.0-Testsuite/run_tests.sh b/tests/ITS-2.0-Testsuite/run_tests.sh index f57ef00..7ee5d60 100755 --- a/tests/ITS-2.0-Testsuite/run_tests.sh +++ b/tests/ITS-2.0-Testsuite/run_tests.sh @@ -9,28 +9,14 @@ localizationnote/locnote/locNote preservespace/preservespace/preserveSpace translate/translate/translate " - exclude=" -externalresource4xml -externalresource5xml -idvalue4xml -idvalue5xml -locale7xml -locnote10xml -locnote11xml -preservespace5xml -preservespace6xml -translate9xml -translate10xml -withintext5xml -withintext6xml - locale1xml locale2xml locale3xml locale4xml locale5xml locale6xml +locale7xml locale8xml " |