XSLT : Some rubbish in html output

Post Reply
michel.weber
Posts: 256
Joined: Sat Oct 08, 2005 12:40 pm

XSLT : Some rubbish in html output

Post by michel.weber »

After transforming the XML rsult stream via XSLT, the resulting HTML contains some rubbish XML which is not in the initial XML stream.

<ResultTitle xmlns:u="http://www.thunderstone.com/ParametricSearch/1.0/" xmlns:gml="http://www.opengis.net/gml">
<Abstract xmlns:u="http://www.thunderstone.com/ParametricSearch/1.0/" xmlns:gml="http://www.opengis.net/gml">
<UrlDisplay xmlns:u="http://www.thunderstone.com/ParametricSearch/1.0/" xmlns:gml="http://www.opengis.net/gml">

Although common browsers don't seem to have a problem with this, could this be cleaned up?
User avatar
jason112
Site Admin
Posts: 347
Joined: Tue Oct 26, 2004 5:35 pm

XSLT : Some rubbish in html output

Post by jason112 »

Both the extra elements and extra namespaces will be removed with an XSL update. If you've customized your XSL, the following changes will need to be made manually:

For the places where ResultTtile, Abastract, and UrlDisplay are shown, they should be changed from this

<xsl:copy-of select="ResultTitle"/>

to this

<xsl:apply-templates select="ResultTitle/child::node()"/>

That gets rid of the elements, but it pushes the namespaces to the <b> tags. Those can be gotten rid of by overriding the default template so it doesn't output the namespaces. Add this additional template:

<xsl:template match="*">
<xsl:element name="{name()}" namespace="{namespace-uri()}">
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</xsl:element>
</xsl:template>

That should get rid of all the extraneous output.
Post Reply