diff --git a/src/xmlout.c b/src/xmlout.c
index d90e046..26994a0 100644
--- a/src/xmlout.c
+++ b/src/xmlout.c
@@ -676,6 +676,30 @@ xmlRoleEventlist (const System sys, Roledef rd, int index)
   xmlPrint ("");
 }
 
+//! Output a protocol description
+void
+xmlProtocol (const System sys, Protocol p)
+{
+  Role r;
+
+  xmlPrint ("");
+  xmlindent++;
+  xmlOutTerm ("name", p->nameterm);
+  r = p->roles;
+  while (r != NULL)
+    {
+      xmlPrint ("");
+      xmlindent++;
+      xmlRoleTermPrint (r->nameterm);
+      xmlRoleEventlist (sys, r->roledef, 0);
+      xmlindent--;
+      xmlPrint ("");
+      r = r->next;
+    }
+  xmlindent--;
+  xmlPrint ("");
+}
+
 //! Show all protocol roles that are in the attack.
 void
 xmlInvolvedProtocolRoles (const System sys)
@@ -687,24 +711,7 @@ xmlInvolvedProtocolRoles (const System sys)
     {
       if (isProtocolInvolved (sys, p))
 	{
-	  Role r;
-
-	  xmlPrint ("");
-	  xmlindent++;
-	  xmlOutTerm ("name", p->nameterm);
-	  r = p->roles;
-	  while (r != NULL)
-	    {
-	      xmlPrint ("");
-	      xmlindent++;
-	      xmlRoleTermPrint (r->nameterm);
-	      xmlRoleEventlist (sys, r->roledef, 0);
-	      xmlindent--;
-	      xmlPrint ("");
-	      r = r->next;
-	    }
-	  xmlindent--;
-	  xmlPrint ("");
+	  xmlProtocol (sys, p);
 	}
       p = p->next;
     }