Search

Hey everyone. Here is what I am trying to end up with…

<li>
   <p>
     <a href="#">The Page Title</a> - Lorem ipsum dolor sit amet, consectetur adipisicing elit. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Lorem ipsum dolor sit amet, consectetur adipisicing elit. 
   </p>
</li>

"The Page Title" is in a regular text field called Title.

The "Lorem ipsum…" part is a text area field called Body.

What I'd like to do is put the <a href="#">The Page Title</a> - part and append it to the first part of the body (inside the paragraph tag)

Unfortunately, I've been working way overtime over the last few weeks without much sleep. I need some help on this one.

Thanks.

Assumed that you are using the Ninja technique to transform HTML, e.g.:

<xsl:template match="*" mode="html">
    <xsl:element name="{name()}">
        <xsl:apply-templates select="* | @* | text()" mode="html"/>
    </xsl:element>
</xsl:template>

you could simply create an overriding template like so:

<xsl:template match="body/*[1]" mode="html">
    <xsl:element name="{name()}">
        <xsl:value-of select="ancestor::entry/title"/>
        <xsl:text> - </xsl:text>
        <xsl:apply-templates select="* | @* | text()" mode="html"/>
    </xsl:element>
</xsl:template>

Exactly. Thank you! My mind has been mush lately. Thank you so very @michael-e. Very helpful!

You're welcome. Believe me, I know these days…

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