[xsl] removing characters from a node set

Subject: [xsl] removing characters from a node set
From: "Schmidt, Jonathan" <J.Schmidt@xxxxxxxxxxxx>
Date: Tue, 29 Mar 2005 10:05:53 -0600
I'm trying to figure out how I can clean up my bad source XML via XSLT (1.0)
rather than directly modifying the source (not especially practical under
the circumstances).
Here's my abbreviated source:
 <refdata>1. text text text.</refdata>
 <refdata>2. text text text <extref extdoc="web"
extloc="www.google.com">www.google.com</extref> text text</refdata> </refer>
I'm transforming this to xhtml and will be using an ordered list, which
means the "1. " and "2. " become extraneous, so I want to drop them.  This
is easily done in the first <refdata> entry with something like
substring-after="refdata,'. '"  I've recently discovered the second entry
appears about .1% of the time and need to apply-templates to the <extref> as
I tried setting xsl:variable with the output of xsl:apply-templates and then
using xsl:copy-of, but using substring-after retrieves just the text node
and omitting that retains the extra numbering.  See below the snippet of
both, assume I've already selected the <refer> node:
  <xsl:for-each select="refdata">
    <xsl:variable name="TEMP"><xsl:apply-templates/></xsl:variable>
    <xsl:copy-of select="substring-after(xsl:copy-of select="$TEMP",'. ')"/>
    <xsl:copy-of select="$TEMP"/>
Jonathan Schmidt (j.schmidt@xxxxxxxxxxxx) Senior Internet Developer,
Elsevier 314-453-4170

Current Thread