Search

@Brendo that sounds awesome. Can you point me to some examples, I can't find any (on Github).

Ugh sorry, it's still in the unstable branch. nudge @buzzomatic

Ah I see - So, basically, there will be another field added that points to an XSLT utility. Can this utility ouput new params to be used in the expression (e.g. {entry/title} ({$param-from-xslt-util}))?

From memory it's an all or nothing. The whole entry XML is generated though for the XSLT, so I'm not sure why you'd need both.

@Brendo I'm sorry but my previous question was not a feature request but simply me trying to figure out how this should be used. I feel thick but I'm not 'getting it' so far :/

If I understand your last reply you're saying that I could use either the 'normal' expression field or a xslt utility of choice (outputting some string), correct?

Sorry to take up your time: maybe I should just install the unstable branch and play around with it.

Oh sorry, I didn't mean to come across snappy!

You're on the right track, you use the XSLT utility to generate the markup that you want to run the expression over.

Check this out. That's my XSLT Utility which generates a 'human friendly' date from the Date/Time field for the Event Dates section, or generates a Timeslot for the Timeslots section.

My expression is then simply name/text() as that's the result from this XSLT.

The XSLT is passed a fake <params> array which includes the section-handle and the entry-id, and then output of the current entry in an <entry> node (this is the same as if you created a datasource and selected every field as an included element).

But yeah, best to give the unstable branch a run, it's actually been quite stable in my testing and like most of Rowan's extensions, just needs a gentle tap into the master branch :)

Hope that helps!

@brendo no need to apologize! I did not mean to imply that you came across 'snappy'. Sorry :) (ad infinitum)

Your example is exactly what I needed. I think I get it now. This allows us to attach an optional XSL utility that transforms the XML before running the expression.

In my case the XSL could simply check for the availability of a partner value and return a <combined-name/>. My expression could then also simply be {combined-name/text()}, correct?

Thanks a lot. Seems a nice addition to be merged in the Master branch.

Is it possible, using this field, to create the following a field that contains:

<year>_<month>

For example:

11_10

When I have this available: <factuurdatum time="10:07" weekday="2">2011-10-18</factuurdatum>

Thanks in advance!

Found it myself:

{translate(substring(entry/factuurdatum, 3, 5), '-', '_')}

Great extension :)

Having trouble getting the XSLT utility portion to work.

Here's my reflection utility...

<?xml version="1.0" encoding="UTF-8" ?>
<!--
    reflection-fullname-display

    {entry/last-name}, {entry/first-name} ({entry/spouse})

-->

<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xsl:template match="data">

        <xsl:apply-templates select="entry" mode="fullname-display"/>

    </xsl:template>

    <xsl:template match="entry" mode="fullname-display">
        <fullname-display>
            <xsl:if test="last-name!=''">
                <xsl:value-of select="last-name"/>
                <xsl:text>, </xsl:text>
            </xsl:if>
            <xsl:value-of select="first-name"/>
            <xsl:if test="spouse!=''">
                <xsl:text> (</xsl:text>
                    <xsl:value-of select="spouse"/>
                <xsl:text>)</xsl:text>
            </xsl:if>
        </fullname-display>
    </xsl:template>
</xsl:stylesheet>

Here's how I'm calling it the section editor...

{fullname-display/text()}

and I've also tried, {entry/fullname-display/text()},

alt text

Neither seems to be working.

Can anyone point me in the right direction?

I would hazard a guess that applying the template to entry not data would do it. The Entry Object would be a fragment of that entry only, not the full nodeset?

Give it a try...

@designermonkey - Thanks for the input. Unless, aren't I applying the template to entry in my xslt above?

I'm actually following Brendo's template above, but I'm not having the same luck. Any thoughts?

Didn't see that one! ;o)

Does it make a difference if there are spaces before and after your !=?

Does it make a difference if there are spaces before and after your !=?

No, it doesn't.

Dang. I'm at a loss too then... Sorry.

@designermonkey - No worries. Thanks for trying to help.

Has anyone had success using the new XSLT utility feature?

@davidhund, were you able to get it to work?

@brendo - any thoughts?

@bzerangue I decided to handle it in XSL. I forgot whether it was working in the end :/ (I was in a hurry)

@davidhund - Bummer! Thanks for replying.

[SOLVED]

It was something really simple.

Here's what I was trying to achieve. I had a People section. I was using the Reflection Field to achieve the following output...

Last-Name, First-Name (Spouse)

Then, if they didn't list their last name, I wanted to output the following...

First-Name (Spouse)

Or if they didn't have a spouse, I wanted to output the following...

Last-Name, First-Name

What I was missing was wrapping the output with a <data> element.

Here's my final xsl utility that WORKS...

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xsl:template match="data">
        <data>
            <xsl:if test="params[section-handle = 'people']">
                <xsl:apply-templates select="entry" mode="fullname-display"/>
            </xsl:if>
        </data>
    </xsl:template>

    <xsl:template match="entry" mode="fullname-display">
        <xsl:element name="fullname-display">
            <xsl:if test="last-name!=''">
                <xsl:value-of select="last-name"/>
                <xsl:text>, </xsl:text>
            </xsl:if>
            <xsl:value-of select="first-name"/>
            <xsl:if test="spouse!=''">
                <xsl:text> (</xsl:text>
                <xsl:value-of select="spouse"/>
                <xsl:text>)</xsl:text>
            </xsl:if>
        </xsl:element>
    </xsl:template>
</xsl:stylesheet>

Here's how my reflection field is filled out, see image below...

alt text

Thanks for these super improvements to a great extension.

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