Subject: Re: [xsl] Using xsl:variable and replace() to remove specific characters. From: "Andrew Welch" <andrew.j.welch@xxxxxxxxx> Date: Mon, 28 Apr 2008 13:17:43 +0100 |
On 28/04/2008, Richard Corfield <richard.corfield@xxxxxxx> wrote: > <label>2</label>National Radio Astronomy Observatory, Chile<xref ref-type="fn" rid="aj266199afn4"><sup>9</sup></xref>; <ext-link ext-link-type="email" id="aj266199em4">email address here</ext-link> > </aff> > The problem is the trailing semi-colon between the <xref> & <ext-link> elements. If it's exactly that problem and those elements can occur anywhere you can do: <xsl:template match="text()[preceding-sibling::*[1][self::xref]] [following-sibling::*[1][self::ext-link] [normalize-space(.) eq ';'"]"/> ...which is a no-op template for text node that only occur between <xref> and <ext-link> elements with a value of a colon possibly nestled amongst some whitespace. You will have to ensure you always use <xsl:apply-templates/> instead of <xsl:value-of select="..."/> when outputting the value of an element otherwise the template won't get fired (that's always good practice anyway) If you only ever want to remove the colon from within certain elements (like <aff> above) then modify the match to be: match="aff/text()".... to prevent the text() matching template firing for all text() nodes, which might be expensive. -- Andrew Welch http://andrewjwelch.com Kernow: http://kernowforsaxon.sf.net/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Using xsl:variable and re, David Carlisle | Thread | RE: [xsl] Using xsl:variable and re, Michael Kay |
Re: [xsl] Using xsl:variable and re, David Carlisle | Date | RE: [xsl] Using xsl:variable and re, Michael Kay |
Month |