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

Recursive Split

Subject: Recursive Split
From: Alice Ju-Hsuan Wei <ajwei@xxxxxxxxxxx>
Date: Wed, 14 Nov 2007 09:59:35 -0500
 Recursive Split
Hi,

Does anyone know if it is possible to do recursive splitting of strings and output them with appropriate ids? I tried using substring-before and substring-after, but I can only be applied once, so when I have multiple elements I wanted to split, it does not provide the accurate output.

Here is my XML:

             <listItem>
                  <to_do xml:id="cheese">Cheddar Cheese</to_do>
              </listItem>
               <listItem>
                  <to_do xml:id="beef">Chuck Steak</to_do>
              </listItem>
               <listItem>
                  <to_do xml:id="vegetables">Brocololi, Beans,
Carrots</to_do>
              </listItem>
              <listItem>
                  <to_do xml:id="milk">Dean's Low Fat Milk 2%</to_do>
              </listItem>

 <do>
 <date>2007-11-14</date>
 <list>milk cheese vegetables beef</list>
 <limit_price>20</limit_price>
 <do>

Current XSL:

<xsl:template name="do_list">
    <xsl:variable name="item" select="list"/>
    <xsl:variable name="tasks" select="substring-after($item, ' ')"/>
      <xsl:choose>
          <xsl:when test="contains($item,' '
                 <xsl:value-of select="id($item)"/>
                  </xsl:when>
          <xsl:otherwise>
              <xsl:apply-templates select="$item"/>
          </xsl:otherwise>
      </xsl:choose>
  </xsl:template>

Intended Output in HTML:

    <ul>
                  <li>Cheddar Cheese</li>
                 <li>Chuck Steak</li>
                 <li>Brocololi, Beans, Carrots</li>
                 <li>Dean's Low Fat Milk 2%</li></ul>

Is it possible to parse these elements in the XML recursively?

Thanks in advance.

Alice

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.