Re: [xsl] removing characters from a node set

Subject: Re: [xsl] removing characters from a node set
From: "Schmidt, Jonathan" <J.Schmidt@xxxxxxxxxxxx>
Date: Wed, 30 Mar 2005 11:52:58 -0600
Duh.  As soon as you said "text node" I realized I'd been thinking of this
as a string and forgotten all about the text node.  Thanks bunches for the
mental slap.

I searched the FAQ again and still didn't find anything directly addressing
this, but it can be extrapolated from the text node entries
(, if only I'd ended up

Thanks again.


-----Original Message-----
Date: Tue, 29 Mar 2005 17:19:31 +0100
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
From: David Carlisle <davidc@xxxxxxxxx>
Subject: Re: [xsl] removing characters from a node set
Message-Id: <200503291619.RAA21919@xxxxxxxxxxxxxxxxx>

This is (or was) a faq, I think there may even be an entry in the faq
list although I haven't checked.

If you use a string function like substring-before on a node it converts
the node to a string first. If you do that on the source node you lose
any child nodes, if you first apply-templates into a variable and then
apply the string function to teh variable you lose the generated html

The solution is not to apply the string function to to an element node
nbut just to its first text child:

<xsl:template match="refdata">

<xsl:template match="refdata/text()[1]">
  <xsl:value-of select="substring-after(.,'.')"/>


This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:

Current Thread