Search

Hello, I'm still a learning Symphony user,

I've been getting around with it, but now I've run into a problem I really don't understand.

Lets say I have made a section Projects and a section Persons. In Projects I have some fields and a Select Box Link to Persons. Now I make a template for one of entries in Project with the Utility get-project.xsl. I've also included the Persons section in the XML of the page. Now I want to take the name of the Person in the Select Box Link field, and use it to filter the desired content (name, images) from the section Persons in the XML..

But I can't figure it out. Sounds like something that would be easy to make. I've been reading up, trying to use something that resembles a variable. I'm used to scripting like Action Script, maybe I don't fully grasp the idea of templating.

Could someone please help me out in some way? I would really appreciate some explaining. Earlier someone pointed me at session monster for this, but I don't understand it either.

I believe that you could do something like:

<xsl:call-template name="get-project">
    <xsl:with-param name="person-name" select="person/name" />
    <xsl:with-param name="person-images" select="person/images" />
</xsl:call-template>

And then in the get-project.xsl template:

<xsl:template name="get-project">
    <xsl:with-param name="person-name" />
    <xsl:with-param name="person-images" />
    <p><xsl:value-of select = "$person-name" /></p>
    <div><xsl:value-of select = "$person-images" /></div>
</xsl:template>

But I am a XSLT noob my self, maybe this is way off, if it makes sense go ahead and try it ;)

Take a look at this example on how to use the <xsl:param /> and <xsl:with-param />

Firstly I'll assume your data sources are chained so that just the correct Person entries are being pulled into your page XML:

http://getsymphony.com/learn/concepts/view/data-source-chaining/

You'll see that the XML output for the SBL field includes the entry ID number, which corresponds to an ID of a Person entry. From within the "context" of a project entry, you can get a relevant person like:

/data/persons-datasource-name/entry[@id = current()/person/@id]

This says: look at the persons datasource and find an entry where its ID attribute matches the ID attribute of the person element (the SBL field) in the current context. So in this case current() refers to the project entry.

Try a search (Google may be better than this site search!) for "datasource chaining Xpath" for more examples.

Here's a good thread with an example:

http://getsymphony.com/discuss/thread/56693/

Thanks both of you, I will definitely check it out when I get home!

Hey it worked! Classic!

Thanks, you've helped me finally understand data source chaining. I think I can now utilize Symphony to the fullest.

Also, I will look into that technique petsagouris, I've come across some use of that before. Great example, thanks.

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