Blaeze Posted May 18, 2010 Share Posted May 18, 2010 I am using XSL to display my Twitter feed on my info page:[url="http://zonkzone.net/xls_test/mobile_info.html"]http://zonkzone.net/xls_test/mobile_info.html[/url]I've followed the tutorials on w3schools and it's all working very well but I am getting stuck trying to detect/replace strings with XSL.Basically I need to detect any string starting with 'http://...' and replace with '<a href="http://...">http://...</a>' to make them active links in HTML.The XLS file I am using is located here:[url="http://zonkzone.net/xls_test/xsl/twitter_mobile.xsl"]http://zonkzone.net/xls_test/xsl/twitter_mobile.xsl[/url](Just hit view source)Is that something that can be easily achieved with XSL and if not what is the alternative?Any suggestions well appreciated. Link to comment Share on other sites More sharing options...
boen_robot Posted May 18, 2010 Share Posted May 18, 2010 Not in XSLT 1.0. Maybe with regular expressions in XSLT 2.0 or with EXSLT's reges:replace() if your XSLT processor suppors it.Either way, doing this is just as hard in XSLT 2.0 as it would be in any language. Doing it in XSLT 1.0 is harder. Link to comment Share on other sites More sharing options...
Blaeze Posted May 19, 2010 Author Share Posted May 19, 2010 Not in XSLT 1.0. Maybe with regular expressions in XSLT 2.0 or with EXSLT's reges:replace() if your XSLT processor suppors it.Either way, doing this is just as hard in XSLT 2.0 as it would be in any language. Doing it in XSLT 1.0 is harder.Thanks for checking out. So for an XSL novice like me probably no easy way round? Link to comment Share on other sites More sharing options...
Martin Honnen Posted May 19, 2010 Share Posted May 19, 2010 Do you use an XSLT 2.0 or 1.0 processor? With XSLT 2.0 you could use analyze-string http://www.w3.org/TR/xslt20/#analyze-string Link to comment Share on other sites More sharing options...
rsundare Posted May 20, 2010 Share Posted May 20, 2010 Do you use an XSLT 2.0 or 1.0 processor? With XSLT 2.0 you could use analyze-string http://www.w3.org/TR/xslt20/#analyze-string I am also a novice in xsl. Can't we use the contains function. I have used it to enclose the value with double quotes like below.<xsl:when test="contains(current(),',')">"<xsl:value-of select="."/>"</xsl:when> Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.