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

Re: removing space in a text node

Subject: Re: removing space in a text node
From: Mukul Gandhi <mukul_gandhi@xxxxxxxxx>
Date: Wed, 16 Mar 2005 19:36:02 -0800 (PST)
remove text node
You have not said what is your desired output.. But
just guessing, you need the output to be exactly same
as input, except you want "to remove the leading space
from in front of the comma that sits between the
descriptiveWord nodes".

Probably you need an identity template.. And a
template to modify the text node. Please note the 2nd
template. It matches a text node which contains a
comma, and whose immediate preceding & immediate
following sibling nodes are descriptiveWord.

<?xml version="1.0"?> 
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
 
 <xsl:output method="xml" indent="yes" /> 

 <xsl:template match="@* | node()">
  <xsl:copy>
   <xsl:apply-templates select="@* | node()" />
  </xsl:copy> 
 </xsl:template>
 
 <xsl:template
match="text()[contains(.,',')][name(preceding-sibling::*[1])
= 'descriptiveWord'][name(following-sibling::*[1]) =
'descriptiveWord']">
   <xsl:value-of
select="concat(substring-before(.,','),',')" />
 </xsl:template>
 
</xsl:stylesheet>

Regards,
Mukul

--- Peter Charles <petefc@xxxxxxxxxxxxxxxxx> wrote:
> Hello,
> 
> If I have the following structure:
> 
> <field name="c14alias" displayName="Created By">
> 	<descriptiveWord> Malina </descriptiveWord> ,
>       <descriptiveWord> Mark </descriptiveWord>
> </field>
> 
> Is there an easy way to remove the leading space
> from in front of the comma
> that sits between the descriptiveWord nodes?
> 
> Thanks
> 
> Peter
> 
> 


		
__________________________________ 
Do you Yahoo!? 
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/ 

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.