Author:
nickdunn
Version:
0.9.0
Released:
1 June 2011
Category:
Other

Closed#3: Indexing chokes on HTML

The indexing of entries with HTML stops right after the first child node. Changing the XSL from

<xsl:template match="/">
    <xsl:apply-templates select="//entry"/>
</xsl:template>

<xsl:template match="*">
    <xsl:value-of select="concat(text(), ' ')"/>
    <xsl:apply-templates select="*"/>
</xsl:template>

to

<xsl:template match="/">
    <xsl:for-each select="//entry/*">
        <xsl:value-of select="concat(., ' ')"/>
    </xsl:for-each>
</xsl:template>

helped.

Could you provide the HTML that didn’t work? With the original XSLT I have some test content such as:

<div markdown="1">

* aaa1
* aaa2
* aaa3

## test h2

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

<pre>TEST CODE</pre>

</div>

In a Markdown Extra field (which gets converted to the expected HTML) and all content is correctly indexed.

So I’m not sure what’s causing problems.

I’m including some (multilingual) textbox fields and a normal input field to build the search index. One multilingual textbox has a markdown formatter. (The multilingual stuff should not cause the problem, because it just adds some @attr to the XML.) The $entry_xml->asXML() for an entry looks like (it’s not indented)

<entry id="15"><interests mode="normal" word-count="3" handle="" handle-de="" handle-en="">Liste von Interessen</interests><location mode="normal" word-count="2" handle="sydney-australien" handle-de="sydney-australien" handle-en="sydney-australia">Sydney / Australien</location><name mode="normal" handle="lukas-coch" word-count="2">Lukas Coch</name><vita mode="normal" word-count="71"><p>Jahrgang 1981 ist <strong>Student</strong> der Dipl. Regionalwissenschaften Lateinamerika [...] Seit Anfang 2006 bei Zeitenspiegel.</p></vita></entry>

The broken output is (it stops just after the closing strong tag)

Liste von Interessen Sydney / Australien Lukas Coch  Jahrgang 1981 ist  Student

and with my XSLT the output is

Liste von Interessen Sydney / Australien Lukas Coch Jahrgang 1981 ist Student der Dipl. Regionalwissenschaften Lateinamerika [...] Seit Anfang 2006 bei Zeitenspiegel.

I’ve resolved this in 0.4 I think. Thanks for the assistance.

This issue is closed.

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