Search

I'm using the Ninja Technique to output content from a textarea with a TinyMCE editor.

Some people are adding entries with inline styles, and rather than getting them to clean it up, I'm trying to strip them at the point of output.

I can remove them from the top-level elements, but not from nested ones with the following:

<xsl:template match="@style" mode="html">
</xsl:template>

I've tried //@style and */@style, but I'm still getting style attributes in nested elements.

Could anyone suggest an xpath expression that will strip them all?

Thanks, Fish

How does your complete template look like?

Nils, your question was the very spur I needed to find the solution!

I thought it was a problem with this template, but in fact it was being over-ridden by another, and it wasn't nesting that was the problem. In case it helps anyone else, I had this:

<xsl:template match="ul" priority="1" mode="html">
<ul class="list-unstyled">
<xsl:copy-of select="./node()" />
</ul>
</xsl:template>

So it needed to be changed to <xsl:apply-templates select="./node()" mode="html" /> for templates to apply to the ul contents, and now it's behaving as expected.

Thanks.

Glad you figured it out.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details