Search

Hey, I'm using the widon't xslt template from the non-beta forum... (below)

But it just outputs the normal title without the non-breaking space

 <xsl:template name="widont-title">
     <xsl:param name="temp"/>
    <xsl:param name="text"/>
    <xsl:param name="maxlen" select="35"/>

    <xsl:choose>
        <xsl:when test="contains($text, ' ')">
            <xsl:variable name="prev" select="substring-before($text,' ')"/>
            <xsl:variable name="before" select="concat($temp,' ',$prev)"/>
            <xsl:variable name="after" select="substring-after($text, ' ')"/>

            <xsl:choose>
                <xsl:when test="contains($after, ' ')">
                    <xsl:call-template name="widont-title">
                        <xsl:with-param name="temp" select="$before"/>
                        <xsl:with-param name="text" select="$after"/>
                    </xsl:call-template>
                </xsl:when>
                <xsl:when test="not(contains($after, ' ')) and string-   length(concat($prev,$after)) &lt; $maxlen">    
                    <xsl:value-of select="concat($before, '&#160;', $after)" />
                </xsl:when>
                <xsl:otherwise>
                    <xsl:value-of select="concat($before, ' ', $after)" />
                </xsl:otherwise>
            </xsl:choose>
        </xsl:when>

        <xsl:otherwise>
            <xsl:value-of select="$text"/>
        </xsl:otherwise>
    </xsl:choose>
 </xsl:template>

I believe I'm calling the template correctly...

        <h3><a href="{$root}/entry/{title/@handle}/">
            <xsl:call-template name="widont-title">
                <xsl:with-param name="text" select="normalize-space(title)" />
            </xsl:call-template>
        </a></h3>

Without your page XML, it's hard to tell. Please post your XML.

I know with my default install of Symphony 1.7 the Xpath is different than what you have. Mine looks like this:

    <h3><a href="{$root}/entry/{title/@handle}/">
        <xsl:call-template name="widont-title">
            <xsl:with-param name="text" select="normalize-space(fields/title)" />
        </xsl:call-template>
    </a></h3>

Check your Xpath in line 3 to make sure you are selecting the correct node to apply the widon't template.

Here's the link to the source of this template, if it helps: http://www.2sheds.ru/blog/2007/06/widont-in-xslt-dont-be-a-widow-maker/

i believe my xpath is correct.. (and that is where i got my xslt template from)

<blog>
  <section id="6" handle="blog">Blog</section>
  <entry id="109" comments="0" images="0">
    <fancy-date handle="published-on-the-26th-of-january-in-the-year-of-20">Published on the 26th of January in the year of 2008.</fancy-date>
    <title handle="a-primer-to-symphony-2s-default-theme">A primer to Symphony 2's default theme</title>
    <body word-count="485">very long post</body>
    <date time="05:25" weekday="6">2008-01-26</date>
  </entry>
</blog>

Should this:

            <xsl:when test="not(contains($after, ' ')) and string-   length(concat($prev,$after)) &lt; $maxlen">

Be this?

            <xsl:when test="not(contains($after, ' ')) and string-length(concat($prev,$after)) &lt; $maxlen">

I just thought of this...

Where are you looking for the non-breaking space? It might be hiding in the ?debug mode.

You won't see it in Symphony's ?debug mode because the browser will not display the character entity. It will render it as a literal non-breaking space. Be sure to view source in your browser on the page to make sure that the non-breaking space is indeed there.

UPDATE: I also noticed that firefox doesn't show the non-breaking space HTML entity unless I highlight the headline, right-click and click on "View Selection Source." It doesn't show them in Firebug either. Odd, I don't know why it does this. The encoded entities show up on my Wordpress sites with plain-old view source. What's the diff?

i dont know how that tab got there, it's fine in my xsl file

weird i guess it works, but it doesnt show the entity :O

Yeah, if you have the XSLT set the Doctype to output as HTML instead of XML (in the master.xsl) you'll get the entities, but no indenting in the output. I think that's the way XSLT outputs. Bah! XML, namespaces and doctypes make my head spin!

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