XSLTProcessor wrong output?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!


I have a question about the XSLTProcessor class (PHP Version 5.2.4, builtin
xls version 1.1.17):

I trying to generate a google kml file from a gpx file. I created an 1.0
XSLT with Altova Mapforce. This creates below xslt file. As you can see it
creates a namespace-alias tag, that should replace the "n:" namespace to the
default (no namespace) during the processing. However, when I execute the
xslt with a valid gpx file, it keeps the "n:" namespace. I need it without
any namespace.

Does anyone knows what went wrong or how I can avoid this. I cannot remove
the namespace-alias rule from the xslt or update or change my xslt processor
in php.


<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform "
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance "
xmlns:n="http://www.opengis.net/kml/2.2 "
xmlns:n2="http://www.topografix.com/GPX/1/1 "
xmlns:xs="http://www.w3.org/2001/XMLSchema "
xmlns:atom="http://www.w3.org/2005/Atom "
exclude-result-prefixes="n2 xs xsi xsl"
xmlns="http://www.opengis.net/kml/2.2 ">
 <xsl:namespace-alias stylesheet-prefix="n" result-prefix="#default"/>
 <xsl:output method="xml" encoding="UTF-8" indent="yes"/>
 <xsl:template match="/n2:gpx">


<?xml version="1.0" encoding="UTF-8"?>
<n:kml xmlns:n="http://www.opengis.net/kml/2.2 "
xmlns:atom="http://www.w3.org/2005/Atom "
xmlns="http://www.opengis.net/kml/2.2 "
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance "

I used the following php snippit to generate the kml:

    $xmlDoc = new DOMDocument();

   $xpath = new DOMXPath($xmlDoc);

    $xslDoc = new DOMDocument();
    $proc = new XSLTProcessor();


    echo $proc->transformToXML($xmlDoc);


Site Timeline