Search

Hey All -

Technically, I'm still running 1.7, since there's no simple upgrade. So this is technically a S1.7 question, but I'm hoping that there are enough similarities to S2 to make this applicable in this forum.

I'm in the middle of a redesign, and I'm getting stuck calling a template that prints out a simple tag line for my site.

The XSL (in my default stylesheet),

<span class="tagline"> &#8212; <xsl:call-template name="tagline"/></span>

And the XSL in the tagline document:

<xsl:template name="tagline">
    <xsl:copy-of select="taglines/entry[0]/fields/tag-line" />
</xsl:template>

XML:

<data>
    <taglines section="taglines" section-id="7">
        <entry id="164" handle="maintenance" linked-count="0">
            <fields>
                <tag-line word-count="5"><p>Currently undergoing maintenance &#38; stuff</p></tag-line>
            </fields>
        </entry>
   </taglines>
</data>

Can anyone tell me what I'm doing wrong?

Is the context for the call template at /data? If it's not then you'll need to add it in to your copy-of tag: <xsl:copy-of select="/data/taglines/entry[0]/fields/tag-line" />.

I tried that, earlier... and just now as well. It didn't seem to take. Maybe I've got some caching going on that I don't know about.

this seems to work. Although I'm pretty sure that's not supposed to.

<xsl:copy-of select="/data/taglines/entry/fields/tag-line" />

It could be that positions in XPath start at 1 not 0:

taglines/entry[1]/fields/tag-line

really? I did not know that.

true story.

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