Commit 3fd0dccc authored by Nicolas Delaby's avatar Nicolas Delaby

use more simple xpath expressions

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@31607 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 601a1d9c
...@@ -95,7 +95,7 @@ class PortalTypePropertySheetDocumentationHelper(DocumentationHelper): ...@@ -95,7 +95,7 @@ class PortalTypePropertySheetDocumentationHelper(DocumentationHelper):
context=self, object=self, context=self, object=self,
filename=self.title_or_id() filename=self.title_or_id()
) )
xpath = '//*[name() = "office:text"]//*[name() = "text:p"]' xpath = '//office:text//text:p'
# parse content.xml # parse content.xml
xml_doc = etree.fromstring(source_xml) xml_doc = etree.fromstring(source_xml)
# the namespace text # the namespace text
...@@ -103,7 +103,7 @@ class PortalTypePropertySheetDocumentationHelper(DocumentationHelper): ...@@ -103,7 +103,7 @@ class PortalTypePropertySheetDocumentationHelper(DocumentationHelper):
# all element text:p # all element text:p
text_list = xml_doc.xpath(xpath, namespaces=xml_doc.nsmap) text_list = xml_doc.xpath(xpath, namespaces=xml_doc.nsmap)
# all element wich have an text:style-name attribute # all element wich have an text:style-name attribute
parent_tag_list = xml_doc.xpath('//*[@*[name() = "text:style-name"]]', namespaces=xml_doc.nsmap) parent_tag_list = xml_doc.xpath('//*[@text:style-name]', namespaces=xml_doc.nsmap)
# Change the attribute text:style-name with a default value # Change the attribute text:style-name with a default value
[parent_tag.attrib.update({'{%s}style-name' % text_ns: 'Preformatted_20_Text'}) \ [parent_tag.attrib.update({'{%s}style-name' % text_ns: 'Preformatted_20_Text'}) \
for parent_tag in parent_tag_list] for parent_tag in parent_tag_list]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment