diff --git a/generator/classes/propel/phing/AbstractPropelDataModelTask.php b/generator/classes/propel/phing/AbstractPropelDataModelTask.php
index <HASH>..<HASH> 100644
--- a/generator/classes/propel/phing/AbstractPropelDataModelTask.php
+++ b/generator/classes/propel/phing/AbstractPropelDataModelTask.php
@@ -536,7 +536,8 @@ abstract class AbstractPropelDataModelTask extends Task {
 	 **/
 	protected function includeExternalSchemas(DomDocument $dom, $srcDir) {
 		$databaseNode = $dom->getElementsByTagName("database")->item(0);
-		foreach ($dom->getElementsByTagName("external-schema") as $externalSchema) {
+		$externalSchemaNodes = $dom->getElementsByTagName("external-schema");
+		while ($externalSchema = $externalSchemaNodes->item(0)) {
 			$include = $externalSchema->getAttribute("filename");
 			$externalSchema->parentNode->removeChild($externalSchema);
 			$externalSchemaFile = new PhingFile($srcDir, $include);
Iterating over DOM nodes gets messed up when you remove nodes that are in the collection. This lead to skipping the next external-schema reference and thus missing definitions in schema-transformed.xml.