Search

Hello Gentleman!

I'm new at Symphony, so - at first - I want to say that I'm amazed with this CMS capabilities. It's quite easy to use and the forum has helped me beforme in other issues, even without needing to log in for some doubts. So I thank all of you in advance for issues you already helped me out and for issues you're about to help.

Now I have this stuborn issue with xsl:apply-templates (at least everything indicates it). For a clearer explanation, here follows the code:

XML: http://pastie.org/4271363 XSL: http://pastie.org/4271364 Result: http://pastie.org/4271368

I have shorten the codes for a better viewing.

So the problem is this line (line 2) on Result:

<div id="main">Inicio<h1>yyy...</div>

What is generating this "Inicio" text? I think is some attribute I forgot in the xsl:apply-templates. I don't want it to show up in my Result code.

Did you guys understand the problem? If so, can you help me?

Thanks in advance (again).

Hi and welcome to Symphony :)

in your xsl you apply everything inside or below inicio which consists of two childnodes section and entry. You do specify how to handle the entry node but not for the section node. so this one just outputs its text-content.

You either need to explicitly specify a template fpr section or be more restrictive with what you include in your template call. e.g. <xsl:apply-templates select="inicio/entry"/>

Hope that clears it up a bit.

cheers
daniel

You could for example define these two templates:

<xsl:template match="inicio/section"></xsl:template>
<xsl:template match="inicio/entry">  
  <h1><xsl:value-of select="titulo"/></h1>  
  <p><xsl:value-of select="texto"/></p>
</xsl:template>

I knew it was something a bit stupid, lol.

Thanks a lot. It really clears my vision.

@azzagazz

I've just tested and your solution didn't work. Although it directed me for this:

<xsl:template match"=inicio/entry"></xsl:template>
<xsl:template match="entry"> 
 <h1><xsl:value-of select="titulo"/></h1>
 <p><xsl:value-of select="texto"/></p>
</xsl:template>

Hmm, azzagazz's solution is actually correct. So I'm not sure why it's not working for you. Your code on the other hand states that:

If element matched is under inicio/entry, display nothing.

If element matched is entry (i.e. any entry as long as it's not inicio/entry) then process the containing instructions (h1, p, etc.).

If your code is working, then you may have another XSLT template elsewhere that is matching and outputting content to the result tree.

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