Re: [xsl] searching and replacing

Subject: Re: [xsl] searching and replacing
From: normbishop1@xxxxxxxxxxxx
Date: Fri, 31 May 2002 14:11:58 -0400
Thank you all for your reply....

2. are trying to produce an exact copy of your input. That is,
<sub>foo</sub> in becomes <sub>foo</sub> out;
Not true.  I don't have <sub> as a node in the document.  What I have is & lt; sup & gt; (separated with a space to avoid the email system to convert it to <sub>).  The xslt is not treating that as a <sub> node.  This is why I did what I did.  I am sure there might be a better way to do it.  If so, pls point me to the write link?  Thank you 
4. think there are 'address' elements in your source tree, when there are
in fact none;
This was a typo.  I was testing something else and did a copy and past of a wrong one.  
<xsl:template match="document//*">
    <xsl:call-template name="supsubstring">
                   <xsl:with-param name="Text" select="."/>
is what I intended to send.  

I AM REATTACHING THE FILES WITH some changes.  ('& lt; sub & gt;'  space is intentional)


<!-- XML file -->
<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet type='text/xsl' href='test.xsl'?>
<document id="test">
        <name>Testing sup/sub</name>    
        <name>test superscript & lt; sup & gt; L & lt; /sup & gt; ***</name>  
        <name>testing agian & lt; sup & gt;L & lt;/sup & gt; AFTER ***</name>
                           testing lines subscript & lt; sub & gt; & lt; /sub & gt; ***        
        <name>last one & lt; sub & gt; L & lt; / sub & gt; AFTER***</name>

<!-- XSL file -->
<?xml version="1.0" encoding="iso-8859-1" ?>
<xsl:stylesheet version="1.0"
    xmlns:xsl=""; >
            <!-- SUBSCRITPT -->
 <xsl:template name="supsubstring">
             <xsl:param name="Text"/>
                    <xsl:when test="contains($Text, '& lt; sub & gt;')">
                          <xsl:value-of select="substring-before($Text,  '& lt; sub & gt;')" />
                           <xsl:variable name="stringaftersub" select="substring-after($Text, '& lt; sub & gt;')" />
                                <xsl:value-of select="substring-before($stringaftersub,  '& lt; /sub & gt;')" />
                            <xsl:value-of select="substring-after($stringaftersub, '& lt; /sub & gt;')" />
                    <!-- SUPERSCRIPT -->
                    <xsl:when test="contains($Text, '& lt; sup & gt;')">
                          <xsl:value-of select="substring-before($Text,  '& lt; sup & gt;')" />
                           <xsl:variable name="stringaftersup" select="substring-after($Text, '& lt; sup & gt;')" />
                                <xsl:value-of select="substring-before($stringaftersup,  '& lt; /sup & gt;')" />
                         <xsl:value-of select="substring-after($stringaftersup, '& lt; /sup & gt;')" />
                     <xsl:otherwise><xsl:value-of select="$Text" /></xsl:otherwise>    
<xsl:template match="address//*">
    <xsl:call-template name="supsubstring">
                   <xsl:with-param name="Text" select="."/>


Your favorite stores, helpful shopping tools and great gift ideas. Experience the convenience of buying online with Shop@Netscape!

Get your own FREE, personal Netscape Mail account today at

 XSL-List info and archive:

Current Thread