XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Paulo GomesSubject: Two line output by breaking one string...
Author: Paulo Gomes
Date: 26 Oct 2008 09:34 AM
Heya guys,

I'm a noob when it comes to XSLT and i need hints to solve the following problem:

I have the equivalent to this XML:

<animal>
<mamal type="Dog" eyecolor="Brown"/>
<mamal type="Human" eyecolor="Blue / Green / Brown"/>
<mamal ........ />
</animal>

Well, i need to get every mamal and output it like this:

The mamals of the specie Dog have Blue eyes
The mamals of the specie Human have Blue eyes
The mamals of the specie Human have Green eyes
The mamals of the specie Human have Brown eyes
...

So basically i have to split the eyecolor attribute according to the slashes a have one line for every eye color.

Can this be done?


P.S.: I'm no biologist so forgive me the errors in the example. :)

Postnext
(Deleted User) Subject: Two line output by breaking one string...
Author: (Deleted User)
Date: 27 Oct 2008 07:05 AM
Hi Paulo,
if you are using XSLT 2.0 you can use tokenize(); with XSLT 1.0, you will have to build a recursive template that uses substring-before. Have a look at this post for an example: http://www.stylusstudio.com/SSDN/default.asp?action=9&fid=48&read=6767

Alberto

Posttop
Paulo GomesSubject: Two line output by breaking one string...
Author: Paulo Gomes
Date: 27 Oct 2008 07:27 AM
Grazie Alberto. ;)

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.