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 (http://www.dpawson.co.uk/xsl/sect2/textnode.html), if only I'd ended up there. Thanks again. -Jonathan -----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 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] removing characters from , David Carlisle | Thread | Re: [xsl] disable-output-escaping d, karl Rajangam |
RE: [xsl] Cross reference question, Fredrik | Date | RE: [xsl] Cross reference question, Michael Kay |
Month |