def xPathWithClass(cls):
  """Builds a XPath expression to select all elements of a page that have a
  given css class.

    >>> xPathWithClass("content")
    "//*[contains(concat(' ', normalize-space(@class), ' '), ' content ')]"

  @type  cls: string
  @param cls: the css class
  @rtype: string
  @return: the XPath expression selecting on this class
  """
  return ("//*[contains(concat(' ', normalize-space(@class), ' '), ' {0} ')]"
      .format(cls))