diff --git a/product/ERP5/Document/BusinessTemplate.py b/product/ERP5/Document/BusinessTemplate.py
index 947b7a45085823fc59069cc0d307b23a14075f57..0524bc4e8dbf39b0632108be695f559d3af92892 100644
--- a/product/ERP5/Document/BusinessTemplate.py
+++ b/product/ERP5/Document/BusinessTemplate.py
@@ -70,6 +70,7 @@ from warnings import warn
 from OFS.ObjectManager import customImporters
 from gzip import GzipFile
 from xml.dom.minidom import parse
+from xml.sax.saxutils import escape
 from Products.CMFCore.Expression import Expression
 import tarfile
 from urllib import quote, unquote
@@ -2510,20 +2511,28 @@ class SitePropertyTemplateItem(BaseTemplateItem):
             if action == 'nothing':
               continue
           dir, id = posixpath.split(path)
-          if p.hasProperty(id):
-            continue
           prop_type, property = self._objects[path]
-          p._setProperty(id, property, type=prop_type)
+          if p.hasProperty(id):
+            if p.getPropertyType(id) != prop_type:
+              p._delProperty(id)
+              p._setProperty(id, property, type=prop_type)
+            else:
+              p._updateProperty(id, property)
+          else:
+            p._setProperty(id, property, type=prop_type)
     else:
       BaseTemplateItem.install(self, context, trashbin, **kw)
       p = context.getPortalObject()
-      for id,property in self._archive.keys():
+      for id, property in self._archive.keys():
         property = self._archive[id]
         if p.hasProperty(id):
-          continue
-          # Too much???
-          #raise TemplateConflictError, 'the property %s already exists' % id
-        p._setProperty(id, property['value'], type=property['type'])
+          if p.getPropertyType(id) != property['type']:
+            p._delProperty(id)
+            p._setProperty(id, property['value'], type=property['type'])
+          else:
+            p._updateProperty(id, property['value'])
+        else:
+          p._setProperty(id, property['value'], type=property['type'])
 
   def uninstall(self, context, **kw):
     p = context.getPortalObject()
@@ -2542,16 +2551,16 @@ class SitePropertyTemplateItem(BaseTemplateItem):
     xml_data = ''
     prop_type, obj = self._objects[path]
     xml_data += '\n <property>'
-    xml_data += '\n  <id>%s</id>' %(path,)
-    xml_data += '\n  <type>%s</type>' %(prop_type,)
+    xml_data += '\n  <id>%s</id>' % escape(str(path))
+    xml_data += '\n  <type>%s</type>' % escape(str(prop_type))
     if prop_type in ('lines', 'tokens'):
       xml_data += '\n  <value>'
       for item in obj:
         if item != '':
-          xml_data += '\n   <item>%s</item>' %(item,)
+          xml_data += '\n   <item>%s</item>' % escape(str(item))
       xml_data += '\n  </value>'
     else:
-      xml_data += '\n  <value>%r</value>' %(('\n').join(obj),)
+      xml_data += '\n  <value>%s</value>' % escape(str(obj))
     xml_data += '\n </property>'
     return xml_data
 
diff --git a/product/ERP5/tests/testBusinessTemplate.py b/product/ERP5/tests/testBusinessTemplate.py
index 67c06973557c7c11d49158ff65a2d1af102a62b1..b6c7044397227556c217be2d0263da8432608b0f 100644
--- a/product/ERP5/tests/testBusinessTemplate.py
+++ b/product/ERP5/tests/testBusinessTemplate.py
@@ -5024,6 +5024,86 @@ class TestBusinessTemplate(ERP5TypeTestCase, LogInterceptor):
     sequence_list.addSequenceString(sequence_string)
     sequence_list.play(self, quiet=quiet)
 
+  def stepSetOldSitePropertyValue(self, sequence=None, sequence_list=None, **kw):
+    """Set the old value to a site property."""
+    sequence.set('site_property_value', 'old')
+
+  def stepSetNewSitePropertyValue(self, sequence=None, sequence_list=None, **kw):
+    """Set the new value to a site property."""
+    sequence.set('site_property_value', 'new')
+
+  def stepCreateSiteProperty(self, sequence=None, sequence_list=None, **kw):
+    """Create a site property."""
+    portal = self.getPortal()
+    portal._setProperty('a_property', sequence.get('site_property_value'))
+
+  def stepModifySiteProperty(self, sequence=None, sequence_list=None, **kw):
+    """Modify a site property."""
+    portal = self.getPortal()
+    portal._updateProperty('a_property', sequence.get('site_property_value'))
+
+  def stepCheckSiteProperty(self, sequence=None, sequence_list=None, **kw):
+    """Check a site property."""
+    portal = self.getPortal()
+    self.assertEquals(portal.getProperty('a_property'),
+                      sequence.get('site_property_value'))
+
+  def stepCheckSitePropertyRemoved(self, sequence=None, sequence_list=None, **kw):
+    """Check if a site property is removed."""
+    portal = self.getPortal()
+    self.failIf(portal.hasProperty('a_property'))
+
+  def stepAddSitePropertyToBusinessTemplate(self, sequence=None, sequence_list=None,
+                                            **kw):
+    """Add a site property into a business template."""
+    bt = sequence.get('current_bt', None)
+    self.failUnless(bt is not None)
+    bt.edit(template_site_property_id_list=('a_property',))
+
+  def test_39_CheckSiteProperties(self, quiet=quiet, run=run_all_test):
+    if not run: return
+    if not quiet:
+      message = 'Test Site Properties'
+      ZopeTestCase._print('\n%s ' % message)
+      LOG('Testing... ', 0, message)
+    sequence_list = SequenceList()
+    sequence_string = '\
+                       SetOldSitePropertyValue \
+                       CreateSiteProperty \
+                       CreateNewBusinessTemplate \
+                       UseExportBusinessTemplate \
+                       CheckModifiedBuildingState \
+                       CheckNotInstalledInstallationState \
+                       AddSitePropertyToBusinessTemplate \
+                       BuildBusinessTemplate \
+                       CheckBuiltBuildingState \
+                       CheckNotInstalledInstallationState \
+                       SaveBusinessTemplate \
+                       CheckBuiltBuildingState \
+                       CheckNotInstalledInstallationState \
+                       RemoveBusinessTemplate \
+                       RemoveAllTrashBins \
+                       SetNewSitePropertyValue \
+                       ModifySiteProperty \
+                       ImportBusinessTemplate \
+                       UseImportBusinessTemplate \
+                       CheckBuiltBuildingState \
+                       CheckNotInstalledInstallationState \
+                       InstallBusinessTemplate \
+                       Tic \
+                       CheckInstalledInstallationState \
+                       CheckBuiltBuildingState \
+                       SetOldSitePropertyValue \
+                       CheckSiteProperty \
+                       UninstallBusinessTemplate \
+                       CheckBuiltBuildingState \
+                       CheckNotInstalledInstallationState \
+                       SetOldSitePropertyValue \
+                       CheckSitePropertyRemoved \
+                       '
+    sequence_list.addSequenceString(sequence_string)
+    sequence_list.play(self, quiet=quiet)
+
 def test_suite():
   suite = unittest.TestSuite()
   suite.addTest(unittest.makeSuite(TestBusinessTemplate))