Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 22nd, 2006, 07:10 AM
TPP TPP is offline
Authorized User
 
Join Date: Mar 2006
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default ignoring/skipping returns (linebreaks)

Hi!

I have a <note></note> node in XML file and in this node there is a text which a user of a webpage enters through a multiline memo field. I use xslt to transform xml to a common txt file. When i use value-of for <note> it writes a whole text including returns (=linebreaks). How do i make it to ignore/skip returns?

Thanks alot!

Best regards.

 
Old November 22nd, 2006, 10:28 AM
TPP TPP is offline
Authorized User
 
Join Date: Mar 2006
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

This is a recipe using a node from an xml document called text to replace a string within it.

<xsl:choose>

  <xsl:when test="contains(text, 'xyz')">

    <xsl:element name="text">
      <xsl:value-of select="substring-before(text, 'xyz')"/>
      abc
      <xsl:value-of select="substring-after(text, 'xyz')"/>
    </xsl:element>
  </xsl:when>
</xsl:choose>

...is it possible to detect linebreak insted of 'xyz' like this?

 
Old November 22nd, 2006, 02:59 PM
Friend of Wrox
 
Join Date: Jul 2006
Posts: 430
Thanks: 28
Thanked 5 Times in 5 Posts
Send a message via Yahoo to bonekrusher
Default

Try the tokenize() function.(I did not test)

fn:tokenize(string,pattern) Example: tokenize("XPath is fun", "\s+")
Result: ("XPath", "is", "fun")






Similar Threads
Thread Thread Starter Forum Replies Last Post
GridView - Skipping a Row gothael ASP.NET 2.0 Basics 1 July 18th, 2008 10:02 AM
skipping sunday when adding data Vince_421 Access VBA 2 March 6th, 2007 11:22 AM
skipping records while looping stealthdevil Access VBA 3 October 26th, 2006 10:22 AM
Linebreaks GabrielMobius Pro JSP 0 March 20th, 2006 03:23 PM
System.Web.Mail - linebreaks possible? RPG SEARCH ASP.NET 1.0 and 1.1 Basics 9 January 29th, 2005 10:54 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.