XML Tools question

This is for anyone using the XML Tools scripting additions. I am attempting to generate an XML file with a list of data. The list may be any length so I am trying to dynamically add the elements in the list to the generate XML command.

This works (with hard-wired data) and gives me the XML format I want.

set theXML to {class:XML element, XML tag:"colors", XML contents:{{class:XML element, XML tag:"color", XML contents:{{class:XML element, XML tag:"findColor", XML contents:"Pantone 300 Variable"}, {class:XML element, XML tag:"replaceColor", XML contents:"Pantone 300"}}}}}
generate XML theXML

But for a list of colors, if I try to add them with a repeat loop, I basically am trying to modify a properties list as if it is a text string and it is not able to compile. Has anyone tried to do anything like this before??

set theList to {{find:"Pantone 300 Variable", replace:"Pantone 300"}, {find:"White Variable", replace:"Paper"}, {find:"FPO Variable Color", replace:"Black"}, {find:"Legally Approved", replace:"Black"}}

set theParameters4XML to ""
repeat with colorRecordCount from 1 to (count of theList)
	set theParameters4XML to theParameters4XML & "{class:XML element, XML tag:\"color\", XML contents:{{class:XML element, XML tag:\"findColor\", XML contents:\"" & (find of (item colorRecordCount of theList)) & "\"}, {class:XML element, XML tag:\"replaceColor\", XML contents:\"" & (replace of (item colorRecordCount of theList)) & "\"}}"
	--if colorRecordCount is not (count of theList) then set theParameters4XML to theParameters4XML & ", "
end repeat

set theXML to {class:XML element, XML tag:"colors", XML contents:{theParameters4XML}}

theXML

If you run this, you will see that the quotes that I am trying to escape out with a backslash actually show up as " instead of compiling to just a quote. I am at a loss as to how to do this.

Thanks.

Well, after much banging my head on the keyboard, I finally got it to work. Here it is in case someone might find it helpful:

set theList to {{find:"Pantone 300 Variable", replace:"Pantone 300"}, {find:"White Variable", replace:"Paper"}, {find:"FPO Variable Color", replace:"Black"}, {find:"Legally Approved", replace:"Black"}}

set theFinalXMLParamsList to {}
repeat with thisColorRecord in theList
	set theFinalXMLParamsList to theFinalXMLParamsList & {{class:XML element, XML tag:"color", XML contents:{{class:XML element, XML tag:"findColor", XML contents:(find of thisColorRecord)}, {class:XML element, XML tag:"replaceColor", XML contents:(replace of thisColorRecord)}}}}
end repeat

set theXML to {class:XML element, XML tag:"colors", XML contents:theFinalXMLParamsList}

generate XML theXML --saving as file ((path to desktop as text) & "TestXML.xml")

result:

<?xml version="1.0\?> Pantone 300 Variable Pantone 300 White Variable Paper FPO Variable Color Black Legally Approved Black

Model: PowerPC G5 Tower OS 10.4.8
AppleScript: XCode 2.5
Browser: Safari 419.3
Operating System: Mac OS X (10.4)