RE: [xsl] Recursive Split

Subject: RE: [xsl] Recursive Split
From: Alice Ju-Hsuan Wei <ajwei@xxxxxxxxxxx>
Date: Wed, 14 Nov 2007 20:28:07 -0500

Looks like now I am trying to use the tokenize function, but it appears that it does not allow me to use id() with it. When I ran the XSLT, it tells me this: F Cannot select a node here: the context item is an atomic value, with the errors pointing to the line where it says id(.).

Here is my XML:

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

 <list>milk cheese vegetables beef</list>
 Current XSL:

 <xsl:template name="do_list">
  <xsl:variable name="do" select="list">
  <xsl:variable name="item" select="tokenize($item, '\s+')"/>
   <xsl:for-each select="$item">
  <xsl:value-of select="id(.)"/>

Intended Output in HTML:

                  <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 with the id()? I do not want to print out the attributes only, but I want it to print out the id of the attribute.

Thanks in advance.


Current Thread