[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

substring-before doesn't copy node

Subject: substring-before doesn't copy node
From: Marco <spinmar@xxxxxxxxx>
Date: Fri, 12 Jan 2007 10:35:51 +0100
 substring-before doesn't copy node
Hi,
I'm writing a recursive template and I have some problems with subtring-before.
I'm trying to write a words highlighter.
In my template if my text contains the word I'm looking for, I write:


<xsl:variable name="before" select="substring-before($test-text, .)" />
<xsl:variable name="after" select="substring-after($test-text, .)"/>
<xsl:variable name="real-before" select="substring($text, 1, string-length($before))"/>
<xsl:variable name="real-after" select="substring($text, string-length($before) + string-length(.) + 1)"/>


The problem is that my test-text contains for example http://dominio.com/&lt;b&gt;pippo&lt;/b&gt;/pluto.html and I'm looking for pluto, the before string is http://dominio.com/pippo/. It seems that substring-before deletes my tag <b></b>. I suppose that the problem is in the substring-after too.
I tried to write:
<xsl:variable name="before"><xsl:copy-of select="substring-before($test-text, .)" /></xsl:variable>
but the problem remains.
How could I solve my problem?
Best regards
Marco


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.