Search

I'm not yet that flexible with XSLT to find out it by myself :)

Example use case:

User comments on a blog post, inserts newlines (hits enter in a textarea) and optionally adds his/her plain text URL(s).

In output I'd like to preserve those newlines (replace them with BR tags) and parse urls to build appropriate A tags.

There are utilities to do both of those - nl2br for newlines and I adopted twitter format utility to work with urls in comments (no probs here).

So the Q: Is it possible to invoke nl2br before url parser and output the single combined result?

Thanks in advance, k.

Why don't you apply a text-formatter to the users comment so you don't have to care in the XSL template?

I've thought of that in this particular context, but then I realised that it is a good xslt challenge with more than a single use case (thus very healthy to know for the sake of the future projects).

Especially, when using Ninja utility, which exhausts all capabilities to do something else "utility-wise" with your content.

So the question was meant more targeted to the root level of xslt capabilities; less connected to this concrete comments case.

Sorry for my messy writings - I don't normally speak english, so it's sometimes quite hard to express some subtle nuances.

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