Search

I’m mostly using XSLT from Bauhouse’s calendar ensemble to create an appointment booking system whereby “tomorrow” is always blocked and as such appointments can not be made on that day. “Today” is easy enough to get, but it doesn’t seem easy to determine “tomorrow”. Does Symphony support date:add-duration()?

Any help would be greatly appreciated!

@elixai - you should be able to use the EXSLT function date:add-duration. Make sure to include the EXSLT namespaces for any template that may use this code.

<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:date="http://exslt.org/dates-and-times"
                extension-element-prefixes="date">

Hopefully, this helps.

On that EXSLT-thing. Does my server have to support EXSLT in order to use it or is that xmlns-declaration all it takes?

I think the declaration is all it takes.

So, wouldn’t I then be able to do something like so:

xsl:value-of select=”xs:date($today) + xs:duration(‘P0Y0M6DT0H00M’)”

This errors out though, so clearly I’m missing something:

XSLTProcessor::transformToXml(): xmlXPathCompOpEval: function date not found
XSLTProcessor::transformToXml(): Unregistered function
XSLTProcessor::transformToXml(): XPath evaluation returned no result.

@elixai - do you mind posting your xsl and xml?

@phoque - yes. your server needs to support EXSLT. I’m sure it does. If you make a php page calling the phpinfo() function it will say if your server supports it or not.

@elixai - try this

<xsl:value-of select="date:add($today,'P0Y0M1DT0H00M')"/>

This should add an extra day, therefore giving you tomorrow.

or the shortcut way… instead of typing out ‘P0Y0M1DT0H00M’, use ‘P1D’ like so…

<xsl:value-of select="date:add($today,'P1D')"/>

I should have known Bauhouse’s XSLT would already have this, I checked another of his pages in his calendar ensemble, and he has XSLT that does exactly what I need.

@bzerangue: When I have a bit more time I’ll try your suggestion, thank you!

Bauhouse’s XSL looks a little something like this.

I am having a similar problem. I am trying to use EXSLTs regexp:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:regexp="http://exslt.org/regular-expressions"
    extension-element-prefixes="regexp">

    <xsl:template name="video">
        <xsl:param name="url" />

        <xsl:variable name="id" select="regexp:match($url, 'v=([^&amp;]+)')" />
    </xsl:template>
</xsl:stylesheet>

All i get is

XSLTProcessor::transformToXml(): xmlXPathCompOpEval: function match not found
XSLTProcessor::transformToXml(): Unregistered function
XSLTProcessor::transformToXml(): xmlXPathCompiledEval: 1 object left on the stack
XSLTProcessor::transformToXml(): Evaluating variable id failed

Looking at the implementations section of the documentation, it looks as though libxsl doesn’t support this function.

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