Search

Hey ho, just trying to reference a part of my XML for it's id and handle in another part of my XML.. it's a multilingual thing... is something like this even possible?

<a href="{$root}/{$url-language}/{appear-on-pages/page[@handle !='hafan']/[/data/navigation/page/@id = current()/id]/item/@handle}?title={title/@handle}" title="llun o/image of - {title}">

I get an error so I know what I have isn't working, but is it possible that I have the syntax in the wrong place? Can I have predicates within predicates in html links?

<a href="{$root}/{$url-language}/{appear-on-pages/page[@handle !='hafan' and @id = current()/id]/item/@handle}?title={title/@handle}" title="llun o/image of - {title}">

you can use 'AND' and 'OR' in xpath predicates. i'm not sure if what i gave you is the exact functionality you needed but it at least illustrates the ability to match multiple predicates.

I was thinking of AND in my sleep. will try today, thanks.

EDIT

I created a variable in the entry matching template in the end.. matching ID's and switching the XPATH was the way to go.

so {/data/navigation/page[@id = $appear]/item/@handle} and the variable was called appear with this xpath: "/data/video-list/entry/appear-on-pages/page[@handle !='hafan']/@id"

This matches the first page that is selected in the selectbox link that isn't the home page (Hafan is welsh for Home).

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