I am trying to use Pythons LXML library to create a GPX file that can be read by Garmin\'s Mapsource Product. The header on their GPX files looks like this
The problem is with your attribute name.
attrib={"{xsi}schemaLocation" : schemaLocation},
puts schemaLocation in the xsi namespace.
I think you meant
attrib={"{" + xsi + "}schemaLocation" : schemaLocation}
to use the URL for xsi. This matches your uses of namespace variables in the element name. It puts the attribute in the http://www.w3.org/2001/XMLSchema-instance
namespace
That gives the result of
<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<gpx xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.topografix.com/GPX/1/1"
xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd"
version="1.1"
creator="My Product"/>