xsl-list
[Top] [All Lists]

[xsl] XSLT 2.0 replace()

2008-09-02 09:19:28
Just learning XSLT 2.0 (and regex), and I'm stumped on the replace() function.

I have XML that looks like this:

<toc>
   <category title="Structure">
<item title="&amp;lt;attribute&amp;gt;" href="tag.attribute.html" />
       <item title="&amp;lt;handler&amp;gt;" href="LzDelegate.html" />
       <item title="&amp;lt;event&amp;gt;" href="LzEvent.html" />
        .
        .
        .

And I want to replace the &amp; with just &, so the HTML that looks like this:

 <body>
     <h1>nav toc</h1>
     <ol>
        <li>Structure</li>
        <ol>
           <li>&lt;lattribute&gt;</li>
           <li>&lt;handler&gt;</li>
           <li>&lt;event&gt;</li>

The closed I've been able to get is this:

  <body>
     <h1>nav toc</h1>
     <ol>
        <li>Structure</li>
        <ol>
           <li>&lt;attribute&amp;gt;</li>
           <li>&lt;handler&amp;gt;</li>
           <li>&lt;event&amp;gt;</li>

So I can change the first &amp;, but not the second. Any ideas? I feel like I
must be missing a fundamental concept here.

Here's a fragment of my XSLT:

       <ol>
         <xsl:for-each select="category">
           <li>
             <xsl:value-of select="@title"/>
           </li>
           <ol>
             <xsl:for-each select="item">
               <li>
<xsl:value-of select="replace(@title, '&amp;lt;', '&lt;')"/>
               </li>
             </xsl:for-each>
           </ol>
         </xsl:for-each>
       </ol>

thanks,

Lou

--~------------------------------------------------------------------
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>