Re: [xsl] removing characters from a node set

Subject: Re: [xsl] removing characters from a node set
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 29 Mar 2005 17:19:31 +0100
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
nodes. 

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">
  <li>
  <xsl:apply-templates/>
  </li>
</xsl:template>

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

David



________________________________________________________________________
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:
http://www.star.net.uk
________________________________________________________________________

Current Thread