[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

removing characters from a node set

Subject: removing characters from a node set
From: "Schmidt, Jonathan" <J.Schmidt@xxxxxxxxxxxx>
Date: Tue, 29 Mar 2005 10:05:53 -0600
xsl removing characters
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.schmidt@xxxxxxxxxxxx) Senior Internet Developer,
Elsevier 314-453-4170

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.