xsl-list
[Top] [All Lists]

removing characters from a node set

2005-03-29 09:05:53
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:
<refer>
 <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
well.
 
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:
 
...[SNIP]...
  <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"/>
  </xsl:for-each>
...[SNIP]...
 
_____________
Jonathan Schmidt (j(_dot_)schmidt(_at_)elsevier(_dot_)com) Senior Internet 
Developer,
Elsevier 314-453-4170

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>