One technique that has never failed me, is to write the script, and check each line, and print something... so, your first script might be something like...
package require tdom 0.7.5
set xml {source: http://londynek.net/image/tools/test_xml.xml }
set doc [dom parse $xml]
# here, you can use puts if you're running this script from
# the shell... then you might see the problem right away:
puts "value of doc is $doc"
# or, if this is the .tcl part of an openacs templated page,
# you'd put this:
ad_page_contract {
doc goes here
} -properties {
doc : onevalue
}
# before everything in the script, then you'd put this
# in the corresponding .adp:
the value of $doc is: @doc@
# then load the page, and then see what happened. I would
# recommend that you start by running it from the shell,
# then you can clearly see the tcl error output if any.