xsl-list
[Top] [All Lists]

Re: New to XSL

2005-12-20 09:58:33
On 12/20/05, Richard Zhang <richard_zhang(_at_)anabus(_dot_)com> wrote:
Hi,

I am new to XSLT and want to do the following but do not know if it is
possible or not. Any help or references to sources would be greatly
appreciated.

I have an XML file with the following element:

<textarea sep=" &#x000A; &#x000D:"
  10 20 30 40 50
</textarea>

GMail is mangling this a bit, so let me make sure I'm guessing right. 
For each token delimited by spaces you want to to create a new element
containing the token and the contents of the sep attribute.

The first part (splitting the string) is an faq:
http://www.dpawson.co.uk/xsl/sect2/N7240.html#d9312e343.

Second part would merely be <xsl:value-of select="@sep" />

Of course, a more interesting variation is using sep to indicate the
deliminator,

So if I had <textarea sep=",">10,20,30,40,50</textarea>
I'd get something like <datanum>10</datanum><datanum>20</datanum>.

That's just a variation of the faq that should be pretty easy to
figure out from the above faq reference.

Is this possible with XSLT?

Yup, and frequently done.  Like many things, I'm sure it's easier in XSLT 2.0.

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>