def _decorate_collection(node, rdfprefix):
        """Take care of collection (a.k.a. Lists).
		@param node: the node for the C{<ul>/<ol>}
		@param rdfprefix: the prefix of the RDF namespace
		"""
        List = "%s:List" % rdfprefix
        first = "%s:first" % rdfprefix
        rest = "%s:rest" % rdfprefix
        nil = "[%s:nil]" % rdfprefix
        rtype = "%s:type" % rdfprefix
        # the list of 'li'-s is needed in advance (eg, for their numbers)
        originalNodes = [
            n for n in node.childNodes
            if n.nodeType == node.ELEMENT_NODE and n.tagName == "li"
        ]
        # a bnode id should be generated for the top level node
        if node.hasAttribute("about"):
            currId = node.getAttribute("about")
        else:
            currId = "[%s]" % _give_BID()
            node.setAttribute("about", currId)

        index = 1
        for i in xrange(0, len(originalNodes)):
            n = originalNodes[i]
            # first the current <li> must be massaged
            if not _has_one_of_attributes(n, "href", "resource", "typeof",
                                          "about", "rel", "rev", "property"):
                # the simple case, the node is changed in situ..
                n.setAttribute("about", currId)
                n.setAttribute("property", first)
            else:
                # an enclosure for that node should be created, and the original node
                # is just reparented
                newEnclosure = node.ownerDocument.createElement("div")
                newEnclosure.setAttribute("rel", first)
                newEnclosure.setAttribute("about", currId)
                node.replaceChild(newEnclosure, n)
                newEnclosure.appendChild(n)
            # An extra <li> is necessary to add some additional info...
            newLi = node.ownerDocument.createElement("li")
            newLi.setAttribute("about", currId)
            newLi.setAttribute("rel", rest)
            if i != 0: newLi.setAttribute("typeof", List)
            if i == len(originalNodes) - 1:
                # This is the last element
                newLi.setAttribute("resource", nil)
                node.appendChild(newLi)
            else:
                newId = "[%s]" % _give_BID()
                newLi.setAttribute("resource", newId)
                currId = newId
                node.insertBefore(newLi, originalNodes[i + 1])
	def _decorate_collection(node,rdfprefix) :
		"""Take care of collection (a.k.a. Lists).
		@param node: the node for the C{<ul>/<ol>}
		@param rdfprefix: the prefix of the RDF namespace
		"""
		List  = "%s:List"  % rdfprefix
		first = "%s:first" % rdfprefix
		rest  = "%s:rest"  % rdfprefix
		nil   = "[%s:nil]"   % rdfprefix
		rtype = "%s:type"  % rdfprefix
		# the list of 'li'-s is needed in advance (eg, for their numbers)
		originalNodes = [ n for n in node.childNodes if n.nodeType == node.ELEMENT_NODE and n.tagName == "li" ]
		# a bnode id should be generated for the top level node
		if node.hasAttribute("about") :
			currId = node.getAttribute("about")
		else :
			currId = "[%s]" % _give_BID()
			node.setAttribute("about",currId)

		index = 1
		for i in xrange(0,len(originalNodes)) :
			n = originalNodes[i]
			# first the current <li> must be massaged
			if not _has_one_of_attributes(n,"href","resource","typeof","about","rel","rev","property") :
				# the simple case, the node is changed in situ..
				n.setAttribute("about",currId)
				n.setAttribute("property",first)
			else :
				# an enclosure for that node should be created, and the original node
				# is just reparented
				newEnclosure = node.ownerDocument.createElement("div")
				newEnclosure.setAttribute("rel",first)
				newEnclosure.setAttribute("about",currId)
				node.replaceChild(newEnclosure,n)
				newEnclosure.appendChild(n)
			# An extra <li> is necessary to add some additional info...
			newLi = node.ownerDocument.createElement("li")
			newLi.setAttribute("about",currId)
			newLi.setAttribute("rel",rest)
			if i != 0 : newLi.setAttribute("typeof",List)
			if i == len(originalNodes) - 1 :
				# This is the last element
				newLi.setAttribute("resource",nil)
				node.appendChild(newLi)
			else :
				newId = "[%s]" % _give_BID()
				newLi.setAttribute("resource",newId)
				currId = newId
				node.insertBefore(newLi,originalNodes[i+1])
	def _decorate_container(node,rdfprefix) :
		"""Take care of containers (ie, Seq, Alt, and Bag).
		@param node: the node for the C{<ul>/<ol>}
		@param rdfprefix: the prefix of the RDF namespace
		"""
		index = 1
		originalNodes = [n for n in node.childNodes if n.nodeType == node.ELEMENT_NODE and n.tagName == "li" ]
		for n in originalNodes :
			pr = "%s:_%s"  % (rdfprefix,index)
			index += 1
			if not _has_one_of_attributes(n,"href","resource","typeof","about","rel","rev","property") :
				# the simple case...
				n.setAttribute("property",pr)
			else :
				# the original node should not be changed, but should be reparanted into a new
				# enclosure
				newEnclosure = node.ownerDocument.createElement("div")
				newEnclosure.setAttribute("rel",pr)
				node.replaceChild(newEnclosure,n)
				newEnclosure.appendChild(n)
    def _decorate_container(node, rdfprefix):
        """Take care of containers (ie, Seq, Alt, and Bag).
		@param node: the node for the C{<ul>/<ol>}
		@param rdfprefix: the prefix of the RDF namespace
		"""
        index = 1
        originalNodes = [
            n for n in node.childNodes
            if n.nodeType == node.ELEMENT_NODE and n.tagName == "li"
        ]
        for n in originalNodes:
            pr = "%s:_%s" % (rdfprefix, index)
            index += 1
            if not _has_one_of_attributes(n, "href", "resource", "typeof",
                                          "about", "rel", "rev", "property"):
                # the simple case...
                n.setAttribute("property", pr)
            else:
                # the original node should not be changed, but should be reparanted into a new
                # enclosure
                newEnclosure = node.ownerDocument.createElement("div")
                newEnclosure.setAttribute("rel", pr)
                node.replaceChild(newEnclosure, n)
                newEnclosure.appendChild(n)