I'm using Tridion 2011 SP1 HR1 and have created a new schema with one RTF field and have applied the following filtering XSLT:
<stylesheet xmlns="http://www.w3.org/1999/XSL/Transform" version="1.0">
<output omit-xml-declaration="yes" method="xml" cdata-section-elements="script"/>
<template match="/ | node() | @*">
<copy>
<apply-templates select="node() | @*"/>
</copy>
</template>
<template match="*[ (self::br or self::p or self::div) and normalize-space(translate(., ' ', '')) = '' and not(@*) and not(processing-instruction()) and not(comment()) and not(*[not(self::br) or @* or * or node()]) and not(following::node()[not( (self::text() or self::br or self::p or self::div) and normalize-space(translate(., ' ', '')) = '' and not(@*) and not(processing-instruction()) and not(comment()) and not(*[not(self::br) or @* or * or node()]) )]) ]">
<!-- ignore all paragraphs and line-breaks at the end that have nothing but (non-breaking) spaces and line breaks -->
</template>
<template match="br[parent::div and not(preceding-sibling::node()) and not(following-sibling::node())]">
<!-- Chrome generates <div><br/></div>. Renders differently in different browsers. Replace it with a non-breaking space -->
<text> </text>
</template>
<!-- remove disallowed elements but keep its children -->
<template match="li/p">
<apply-templates/>
</template>
<template match="h1">
<element name="p">
<apply-templates/>
</element>
</template>
<template match="head | title | meta | base | style | scriptlink | font | ilayer | layer | small | u | span">
<apply-templates/>
</template>
<!-- remove dissallowed attributes -->
<template match="@style" />
<template match="@bordercolor" />
<template match="@class[.='MsoNormal' or .='MsoNormalCxSpMiddle' or .='MsoNormalCxSpLast' or .='MsoTableGrid' or .='MsoListParagraphCxSpFirst' or .='MsoListParagraphCxSpMiddle' or .='MsoListParagraphCxSpLast']" />
<!--<template match="@align | @valign | @border | @cellpadding | @cellspacing"/>-->
<!-- remove all style attributes except those for a table cel to allow center alignment -->
<!--<template match="*[not(local-name() = 'td')]/@style"/>
<template match="td/@style">
<if test="contains(.,'text-align')">
<attribute name="style">
<text>text-align:center;</text>
</attribute>
</if>
</template>-->
<!-- remove rowspan and collspan when set to 1 -->
<template match="@colspan[.='1'] | @rowspan[.='1']"/>
</stylesheet>
This works fine except for this match:
<template match="h1">
<element name="p">
<apply-templates/>
</element>
</template>
Whenever the input is:
<h1>Test</h1>
I expect the following output:
<p>Test</p>
but instead, I'm getting a copy of the full xmlns as an attribute:
<p xmlns="http://www.w3.org/1999/XSL/Transform">Test</p>
From the research I've done so far, it has to do with the <copy>
element from the XSLT transformation. How should I modify my filtering XSLT to fix this?