Search

In /param1/param2 data is filtered as planned. However I need access data from /param1.

I’ve tried:

<xsl:variable name="name" select="document('http://localhost/website/{$param1}/')"/> <xsl:copy-of select="$name/body/@*|node()"/>

but when in /param1/param2 it seems to be copying /param1/param2’s data.

Does anyone know if this is achievable or if there is a better approach? Thanks.

I created a new page to filter by param1 only called page2/param1. Then I applied a copy-of from page1/param1/param2 but with the same results as above.

What exactly are you trying to achieve?

Hi Nils thanks for asking, I hope the following helps:

AIM

I have to display different articles from different industries and cities.

CURRENT SETUP

* I have url parameters: city/industry/article
* url/city shows all industries and articles from that city
* url/city/industry/article shows just that particular article

These pages work exactly as planned, all from one a few datasources and one page.

THE PROBLEM

I have a sub-menu that shows all industries. Using XSLT matching, only those industries that have corresponding articles become links on url/city/industry. So if a user want to view all Shipping within Gothenburg, from url/Gothenburg they can simple click on the Shipping link and all the shipping articles for Gothenburg are displayed.

But when on city/industry/article, eg. gothenburg/shipping/article1, my XSLT logic performs a match and only highlights the one corresponding industry (shipping) in the sub-menu, as the data is filtered. A user then has to go back to url/city to see which industries have articles. It would desirable to have the sub-menu show all industries that have articles when a user is on url/city/industry and url/city/industry/article.

As far as I understand the easiest way would be to create a second unfiltered data source or to do the filtering in your XSL template entirely.

Could you post your XML and your current XSL template?

The way I do it is to use two datasources, one with limited field output (for listings), and the other with full field output (for full article).

You would add two datasource filters to the first one for the url parameters, $city and $industry and make sure the datasource isn’t requiring one of these. Therefore, having no url parameters outputs a full list, having $city set would filter the list a little, then adding $industry would filter it even more.

The second data source has a required parameter of $article that will make the output only happen when it is in the url, to save on excessive data output.

To get the menu working, and to display only industries relating to the $city parameter, you would use the first datasource, as it only filters on $city and $industry. This means you can use xslt to highlight the respective $industry, and still have all the other ones visible, as the datasource still lists them! To have counts of articles in the $city and $industry, there is an option in the datasource editor to output that info (it’s near the bottom right).

I hope this helps!?

Cheers guys, it seems obvious once one knows how! I will give the second datasource a shot and if I end up tearing even more hair out then I will post my code.

Glad to help!

The other mthod is datasource chaining, which is very similar to the above, but that’s another story… ;)

Good luck…

Ow do, I changed my datasource and param setup as instructed and created a new datasource with a required parameter of $article. This worked but by chance I applied a ‘city’ datasource filter to this from the city-industry datasource. Now in city/industry/article, the XHTML shows just the one article whilst the XML shows all articles for that city (I’m not sure why but without the datasource filtering all articles for all cities were displayed in the XML). Perhaps I could filter some more of the other articles so that only the industry is shown but I will do that in phase 2. Thanks guys, much appreciated.

Can you do screenshots of your datasources? I could see what’s happening…

Hmmm my city/industry/article1’s XML contains all articles from city/industry…eg. article2 and article3 etc. I’m not sure why but I could filter using XSLT. The good think is that from city/industry/article1, the XML shows all the other $industry categories that have articles from city/*

I’m still getting my head around the datasources and datachaining…Here are the screenshots, cheers.

Attachments:
industry-ds.gif and city-industry-ds.gif

Are your articles coming from more than one source, i.e. articles for city and articles for industry? I mean, can an article belong to a city and not an industry?

If so, I think you may need a third data source, or if not, I may not be fully understanding what you need…

I have an article section, a cities section and industry section. The article section has select box links from cities and industry. An article has to belong to a city and industry. For the page, under Page Settings I have URL Parameters of city/industry/article. Just to sum up, it’s all working as planned just that in the XML for city/industry/article1, I can see XML data for article2 and article3 too. FIXED - I readded the third filter of ‘article’ within the city-ds.

Phew time for a deserved cuppa!

Glad you got it working…

Cuppa’s a good idea. I may have one myself, being a Yorkshire man that’s a given though.

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