def update_link_rel_based(self, old_rel, new_rel=None, new_text=None, single_link=False):
links = self.metadata.xpath('<STR_LIT>'.format(old_rel))<EOL>if len(links) < <NUM_LIT:1>:<EOL><INDENT>log.warning('<STR_LIT>'.format(str(old_rel)))<EOL>return False<EOL><DEDENT>if new_rel and not new_text:<EOL><INDENT>for link in links:<EOL><INDENT>link.attrib['<STR_LIT>'] = new_rel<EOL>if single_link:<EOL><INDENT>break<EOL><DEDENT><DEDENT><DEDENT>elif not new_rel and new_text:<EOL><INDENT>for link in links:<EOL><INDENT>link.text = new_text<EOL>if single_link:<EOL><INDENT>break<EOL><DEDENT><DEDENT><DEDENT>elif new_rel and new_text:<EOL><INDENT>log.warning('<STR_LIT>')<EOL>return False<EOL><DEDENT>else:<EOL><INDENT>log.warning('<STR_LIT>')<EOL>return False<EOL><DEDENT>return True<EOL>
Update link nodes, based on the existing link/@rel values.

This requires specifying a link/@rel value to update, and either a new
link/@rel value, or a new link/text() value for all links which match
the link/@rel value.  Optionally, only the first link which matches the
link/@rel value will be modified.

:param old_rel: The link/@rel value used to select link nodes to update
:param new_rel: The new link/@rel value
:param new_text: The new link/text() value
:param single_link: Determine if only the first, or multiple, linkes are modified.
:return: True, unless there are no links with link[@rel='old_rel']