Search

Hello,

Here you can find the relevant xml:

    <artikel-details> 
``<section id="1" handle="blog">Blog</section> 
<entry id="1"> 
<titel handle="zwanger">Zwanger ??</titel> 
      <datum time="23:00" weekday="5">2005-02-04</datum> 
``      <tekst mode="formatted"><p>Hoera, het is zover, eindelijk zwanger. De test laat niets te twijfelen over. Ik ben net een stuiterbal, blij en energie voor tien. Ondanks het prille begin, heb ik een goed gevoel over deze zwangerschap. Waarom? geen idee. Het voelt gewoon goed. Het is moeilijk om ’s middags mijn mond dicht te houden als ik met mijn zus in de stad ben. Het is maar goed dat er een carnavalsoptocht is, het geeft een beetje afleiding.</p> 
<tekst> 
<volgorde><span class="order">1</span></volgorde> 
</artikel-details> 
<next-artikel> 
<section id="1" handle="blog">Blog</section>
<entry id="2">
<datum time="22:00" weekday="1">2005-02-21</datum> 
</entry> 
</next-artikel>

So I thought this xslt would work :

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

<xsl:output method="xml"
    doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
    doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
    omit-xml-declaration="yes"
    encoding="UTF-8"
    indent="yes" />

<xsl:template match="/">
     <xsl:apply-templates select="/data/artikel-details/entry"/>
</xsl:template>

<xsl:template match="next-artikel">
    <xsl:apply-templates select="/data/next-artikel/entry"/>
</xsl:template>

<xsl:template match="next-artikel/entry">
    <xsl:value-of select="datum" /><br />
</xsl:template>

<xsl:template match="artikel-details/entry">
    <h1><xsl:value-of select="titel"/></h1><br />
    <xsl:value-of select="datum" /><br />

But no links are displayed. So Im wondering what I'm doing wrong here.

@roelof:

  • Please do not start discussions called "why does this not work ?" Use a descriptive title, so everybody can easily see what the thread is about.
  • Stop prepending "hello" or "Oke". That is annoying and unnecessary.
  • Read the forum guidelines, especially #2.

Judging from the XSLT- and XML-snippets you've provided I'd dare to say that you haven't yet understood what XSLT and especially apply-templates do.

I urge you to read up on the basics before trying out/copying more advanced features or Symphony-techniques. Also, make sure you understand what exactly you're trying to achieve with those advanced features and not just copy them blindly and let somebody else fix the problems afterwards.

I know exactly what I want to achieve and that's displaying a certain number of articles in a month. So I made two datasources. One for diaplaying the article (article details) and one for the displaying the next link (next artikel). I know how to display pages with one DS. And I thought that or displaying the second DS I could do the same but appertenly not. I will google how I can achieve this

This may lead you somewhere :

<xsl:template match="/">
 <xsl:apply-templates select="/data/artikel-details/entry"/> 
 <xsl:apply-templates select="/data/next-artikel/entry"/>
</xsl:template>

<xsl:template match="/"> matches the root element. this is starting point for your stylesheet.

inside the 'root template' we apply templates for particular child-nodes of xml tree, defined by xpath. once you learn a bit of xml/xslt theory, this things will never confuse you.

thanks, it worked. Now makimg a url of the datum field and im very happy

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