Re: [xsl] String extraction

Subject: Re: [xsl] String extraction
From: Sven Waibel <sven.waibel@xxxxxxxx>
Date: Thu, 30 Sep 2004 09:07:52 +0200
Hi Mukul,

that's a very good example, but i don't know how many p exist. So i don't know how many variables i have to create.

Sven

Mukul Gandhi wrote:

> Hi Sven,
>   Please try this XSL -
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
> <xsl:output method="html" indent="yes"/>
> 	
> <xsl:template match="/top">
>   <xsl:variable name="str1"
> select="substring-before(., '(')"/>
>   <xsl:variable name="str2"
> select="substring-before(substring-after(., '('),
> ',')"/>
>   <xsl:variable name="str3"
> select="substring-before(substring-after(substring-after(.,
> '('), ','), ',')"/>
>   <xsl:variable name="str4"
> select="substring-before(substring-after(substring-after(substring-after(.,
> '('), ','), ','), ')')"/>
>   <html>
>     <head>
>       <title/>
>     </head>
>     <body>
>       <table>
> 	<tr>
> 	 <td><xsl:value-of select="$str1" /></td>
> 	 <td><xsl:value-of select="$str2" /></td>
> 	</tr>
> 	<tr>
> 	 <td/>
> 	 <td><xsl:value-of select="$str3" /></td>
> 	</tr>
> 	<tr>
> 	 <td/>
> 	 <td><xsl:value-of select="$str4" /></td>
> 	</tr>
>       </table>
>     </body>
>   </html>
> </xsl:template>
> 	
> </xsl:stylesheet>
> 
> When the above XSL is applied to XML -
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <top>person(p1,p2,p3)</top>
> 
> it produces the desired output.
> 
> Regards,
> Mukul
> 
> --- Sven Waibel <sven.waibel@xxxxxxxx> wrote:
> 
> 
>>Hello,
>>
>>how can i extract a string from a string:
>>
>>person(p1,p2,p3)
>>
>>I need a table:
>>
>>person p1
>>	 p2
>>	 p3
>>
>>I don't know anything about length of p1,p2 or p3.
>>
>>Is is possible?
>>
>>Regards
>>Sven
> 
> 
> 
> 
> 		
> _______________________________
> Do you Yahoo!?
> Declare Yourself - Register online to vote today!
> http://vote.yahoo.com

Current Thread