Search

Does this look right?

<xsl:copy-of select="content/p[3]"/>

I would have thought that would display 3 paragraphs, or is that just displaying the 3rd paragraph?

This is the third one. You need:

<xsl:copy-of select="content/p[position() &lt; 3]"/>

But this is not very bullet-proof. What about lists or code blocks, whatever? So I would go with:

<xsl:copy-of select="content/*[position() &lt; 3]"/>

But if you want 3, then I think it would be:

 <xsl:copy-of select="content/p[position() &lt;= 3]"/>

Grrrrr, czheng is right, of course!

cheers michael.

and Czheng. :)

Yes, it was a lot of work to add that = ;)

You are a funny guy, Craig. :-)

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