Subject: Re: [xsl] Split Strings with multiple spaces From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Wed, 14 Nov 2007 11:51:13 -0500 |
Cheers, Wendell
Hi,
I am really new to this, and I understand that in Tennison (2004) and Kay (2004), there is a function called substring-before and after to extract information before or after a certain element.
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 reparse these elements in the XML recursively?
Thanks in advance.
Alice
====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Split Strings with multiple s, Alice Ju-Hsuan Wei | Thread | Re: [xsl] Split Strings with multip, Alice Ju-Hsuan Wei |
Re: [xsl] Spread a ul/li list in se, Steve | Date | Re: [xsl] Split Strings with multip, Alice Ju-Hsuan Wei |
Month |