On Fri, 2008-02-29 at 07:53 -0800, dkropotova wrote: > Dear all, > > I am using SOLR to store my xml files, that have been xml-escaped beforehand > (so that now they are simply treated as text).
Did you see http://wiki.apache.org/solr/SolrForrest? > > When a search is performed and results are back, I now would like to restore > my “escaped” xml. I created a simple transformer, but now I'm stuck on how > to solve my problem. I got all escaped xml in a field, but now I need to > convert it to xml or SAX events. <xsl:template match="arr"> <xsl:for-each select="str"> <p> <xsl:call-template name="unescapeEm"> <xsl:with-param name="val" select="text()"/> </xsl:call-template> </p> </xsl:for-each> </xsl:template> <xsl:template name="unescapeEm"> <xsl:param name="val" select="''"/> <xsl:variable name="preEm" select="substring-before($val, '<')"/> <xsl:choose> <xsl:when test="$preEm or starts-with($val, '<')"> <xsl:variable name="insideEm" select="substring-before($val,'</')"/> <xsl:value-of select="$preEm"/> <span class="palabrabuscada"> <xsl:value-of select="substring($insideEm, string-length($preEm)+5)"/> </span> <xsl:variable name="leftover" select="substring($val,string-length($insideEm) + 6)"/> <xsl:if test="$leftover"> <xsl:call-template name="unescapeEm"> <xsl:with-param name="val" select="$leftover"/> </xsl:call-template> </xsl:if> </xsl:when> <xsl:otherwise> <xsl:value-of select="$val"/> </xsl:otherwise> </xsl:choose> </xsl:template> Hope that helps. salu2 > I've searched, but couldn't find any method > that would accept string and try to do something useful with it – like > converting in SAX events or DOM objects. > > Does anyone have any tips how to solve this problem?? > > Many thanks in advance, > Dasha -- Thorsten Scherler thorsten.at.apache.org Open Source Java consulting, training and solutions --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]