Re: removing space in a 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::*) = 'descriptiveWord'][name(following-sibling::*) = '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/
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format