miraclemaker
Programmer
Hi guys. I'm transforming an XML file using XSLT, I'm defining some namespaces in my XSL file to allow the document to be transformed.
Here's a cut down version of the two files:
XML:
XSL:
Now when I combine the the output is like:
As you can see the xmlns attributes of the XSL doc are being added to the html elements of the output for some reason. Can anyone tell mne why this is happening and how to stop it?
Thanks.
Here's a cut down version of the two files:
XML:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<allGamesWeb creationDate="2005-06-08" xmlns="allGamesWeb"
xmlns:xsi="[URL unfurl="true"]http://www.w3.org/2001/XMLSchema-instance"[/URL]
xsi:schemaLocation="allGamesWeb [URL unfurl="true"]http://games-preview.real.com/rnfeedgamesdl/XMLSchemas/allGamesWeb.xsd">[/URL]
<gameGroupList>
<gameGroup priority="1" title="Action/Adventure">
<gameItem gameID="hamsterball" gameType="web" priority="1"/>
<gameItem gameID="insaniquariumdeluxe" gameType="web" priority="2"/>
<gameItem gameID="shroomz" gameType="web" priority="3"/>
<gameItem gameID="atomaders" gameType="web" priority="1"/>
<gameItem gameID="feedingfrenzy" gameType="web" priority="2"/>
<gameItem gameID="freakoutgold" gameType="web" priority="3"/>
<gameItem gameID="atomicpongling" gameType="web" priority="4"/>
<gameItem gameID="varmintz" gameType="web" priority="5"/>
</gameGroup>
</gameGroupList>
</allGamesWeb>
XSL:
Code:
<?xml version='1.0'?>
<xsl:stylesheet
xmlns:xsl="[URL unfurl="true"]http://www.w3.org/1999/XSL/Transform"[/URL]
xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml"[/URL]
xmlns:game="game"
xmlns:allGamesWeb="allGamesWeb"
version="1.0">
<xsl:output method="html"/>
<xsl:template match="/allGamesWeb:allGamesWeb/allGamesWeb:gameGroupList">
<xsl:for-each select="allGamesWeb:gameGroup">
<p>
<xsl:value-of select="allGamesWeb:gameItem/@gameID" />
</p>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Now when I combine the the output is like:
Code:
<p xmlns:allGamesWeb="allGamesWeb" xmlns:game="game" xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml">hamsterball</p>[/URL]
<p xmlns:allGamesWeb="allGamesWeb" xmlns:game="game" xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml">insaniquariumdeluxe</p>[/URL]
<p xmlns:allGamesWeb="allGamesWeb" xmlns:game="game" xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml">shroomz</p>[/URL]
<p xmlns:allGamesWeb="allGamesWeb" xmlns:game="game" xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml">atomaders</p>[/URL]
<p xmlns:allGamesWeb="allGamesWeb" xmlns:game="game" xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml">feedingfrenzy</p>[/URL]
<p xmlns:allGamesWeb="allGamesWeb" xmlns:game="game" xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml">freakoutgold</p>[/URL]
<p xmlns:allGamesWeb="allGamesWeb" xmlns:game="game" xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml">atomicpongling</p>[/URL]
<p xmlns:allGamesWeb="allGamesWeb" xmlns:game="game" xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml">varmintz</p>[/URL]
As you can see the xmlns attributes of the XSL doc are being added to the html elements of the output for some reason. Can anyone tell mne why this is happening and how to stop it?
Thanks.