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

Whitespace seperated values into HTML table

Subject: Whitespace seperated values into HTML table
From: "Rajput, Ashish S" <ashish.s.rajput@xxxxxxxx>
Date: Thu, 30 May 2002 10:49:47 -0500
html table whitespace
Hello Joerg, thank you for your response.  

I'm a newbie to XSL, and I've been unable to get this to work yet with the
suggested recursive template using the MSXML4 parser.  Once again, I'm
trying to normalize whitespace between Strings, and to also display each
individual string in it's own column.  Is there some sort of a tutorial
available for Dimitre's FXSL?  All other suggestions are most welcome.
Kindly include some code as well.  Thank you!

Part of XML File:
<parameter name="Sensors">
<valueList size="4">sensorAAA sensorBBB sensorCCC sensorDDD</valueList>
</parameter>


Target Output:
___________________________________________________________
|Sensors		|sensorAAA|sensorBBB|sensorCCC|sensorDDD|
-----------------------------------------------------------



Ashish Rajput


-----Original Message-----
From: Joerg Heinicke [mailto:joerg.heinicke@xxxxxx]
Sent: Thursday, May 23, 2002 2:02 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re:  How to format Whitespace seperated values into HTML
table


Hello,

you can use a recursive template, an extension function tokenize (has 
MSXML such a function?) or the FXSL of Dimitre.

The recursive template:

<xsl:template match="valueList">
   <xsl:call-template name="tokenize">
     <xsl:with-param name="string" select="."/>
     <xsl:with-param name="delimiter" select=" "/>
   </xsl:call-template>
</xsl:template>

<xsl:template name="tokenize">
   <xsl:param name="string"/>
   <xsl:param name="delimiter"/>
   <xsl:choose>
     <xsl:when test="contains($string, $delimiter)">
       <option>
         <xsl:value-of select="substring-before($string, $delimiter)"/>
       </option>
       <xsl:call-template name="tokenize">
         <xsl:with-param name="string" select="substring-after($string, 
$delimiter)"/>
         <xsl:with-param name="delimiter" select=" "/>
       </xsl:call-template>
     </xsl:when>
     <xsl:otherwise>
       <option>
         <xsl:value-of select="$string"/>
       </option>
     </xsl:otherwise>
   </xsl:choose>
</xsl:template>

Regards,

Joerg

Rajput, Ashish S schrieb:
> I'm a newbie to XSL, so kindly excuse my lack of experience.  I'm using
the
> MSXML4 parser.
> 
> I have a Whitespace seperated list of values for a certain parameter that
I
> need to display into a HTML table format... ie, the "valueList" data
should
> be in seperate columns.  Below is part of the XML file being used.  Any
> ideas, alongwith some sample code, would be appreciated.  Thanks!
> 
> Ashish
> 
> 
> <parameter name="Sensors">
> 	<units>
> 		<unitless/>
> 	</units>
> 	<dataFormat>
> 		<string/>
> 	</dataFormat>
> 	<valueList size="4">sensorAAA sensorBBB sensorCCC
> sensorDDD</valueList>
> </parameter>


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.