Search

Recently, one of my websites hosting providers switched systems, and everything except one thing compiled/worked fine for XSLT.

The statement in question is

<xsl:template match="/data/schedule*" mode="events">

That throws an error that’s corrected once I take out the asterisk. While I can manually type in all of the data sources it could match, it’d be tedious. I’m inclined to believe the problem was in the upgrade somewhere, but I’m fairly sure I use the asterisk in many other places.

Any ideas?

Try <xsl:template match="/data/schedule/*" mode="events">

I’m trying to match all data source schedule*, /data/schedule, /data/schedule-etc, /data/schedule-etc-etc

then you’ll have to use something like

<xsl:template match="/data/*[substring(name(),1,8) = 'schedule']" mode="events">

Needless to say, nobody will understand what you did there so I suggest you use something like

<xsl:template match="/data/schedule | /data/schedule-etc | /data/schedule-etc-etc" mode="events">

instead.

Or something equally complex:

match="/data/*[starts-with(name(),'schedule')]"

I’d go with phoque’s second suggestion. Matching a dynamic node name is going to be slightly more processor-intensive, and it feels like it ought to be good practice to code the exact nodes that you are matching against.

As a fix to get it working, I did what phoque suggested. But I imagine you’re right, I imagine it will be faster, especially on a shared host.

Thanks guys.

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