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
Conferences Close Tree View
+ Stylus Studio Feature Requests (1192)
+ Stylus Studio Technical Forum (14621)
+ Website Feedback (249)
- XSLT Help and Discussion (7625)
-> + Remove leading Zeros from a st... (4)
-> + how to parse a html element fo... (2)
-> + Add namespaces to target messa... (2)
-> + XSLT Transformation - insertin... (3)
-> + Convert binary xml (9)
-> + XSLT Transformation (4)
-> + Generating hyperlinks (3)
-> + XSLT to PDF problem (with JAVA... (2)
-> + how to add onclick_ with try/c... (2)
-> + Keep table in one page. xsl-fo... (4)
-> + Cannot find a matching 2-argum... (3)
-> + Creating one string from a sub... (2)
-> + XSLT: Traversing XML twice for... (6)
-> + Copy element without namespace... (5)
-> + Create dynamic elemant name (2)
-> + XSLT: Traversing XML twice for... (3)
-> + Problem including Javascript (2)
-> + Looping through attributes (4)
-> + Transform values into elements... (4)
-> + Problem with deep node copy an... (2)
-> + Comparing Dates With ASP.NET 2... (3)
-> + Converting tree structure to h... (4)
-> + Attributes to element transfor... (2)
-> + XSLT transformation (2)
-> + XSLT transformation (5)
-> + xsl:character-map not working (2)
-> + Removing duplicates entries. (2)
-> + Image issues. (2)
-> + xsl transformation (4)
-> + XSL Question (5)
-> + how to insert xml file as an n... (2)
-> + Document Function (2)
-> + convert seconds to hh:mm:ss (5)
-> + how to remove attribute while ... (3)
-> + XSL-FO question (2)
-> + EDI 997 creation. (7)
-> + Line break within a tag in XML... (2)
-> + Contact Help Needed (2)
-> + ACK 997 (2)
-> + XSLT to output XML( which conf... (11)
-> + Retrieving all nodes where a c... (6)
-> + Verifying XML and XSD within X... (4)
-> + How to validate date format in... (3)
-> + XSLT question (2)
-> + Muenchian grouping (2)
-> + How to remove specific text en... (8)
-> + If Else Condition along with L... (2)
-> + SAXON Problem (2)
-> + comapring global variable valu... (2)
-> + copying the value of xsl in va... (2)
-> + Urgent:XSLT element value sel... (2)
-> + Ignoring first element using f... (2)
-> + EDI X12 to XML (4)
-> + XSLT FOR-EACH HELP (2)
-> + Sorting Help Needed (3)
-> + XSLT help with linking (2)
-> + selecting data into node set b... (2)
-> + Watch and Variable in Debug no... (4)
-> + Transforming XML to XML - grou... (2)
-> + Saxon 9.0 B support in debug m... (2)
-> + Repeating element question (2)
-> + Newly Purchased Version Not La... (2)
-> + xsl:include not finding file (5)
-> + JAXP and XSLT 2.0 / XPATH 2.0 (2)
-> + ASP:DropDownList trigger in Xs... (2)
-> + Auto-Skip empty values (2)
-> + retrieving a javascript functi... (2)
-> + need help (2)
-> + html tag ignored (2)
-> + Quick reply needed (8)
-> + xslt to remove namespaces but ... (2)
-> - Using a WSDL definition in an ... (1)
-> + XSL logic issue for simple inp... (6)
-> + Regarding XML namespace prefix... (4)
-> + Mapper reoganizes itself. (8)
-> + XSL Substring Removal (2)
-> + Regarding XSLT logic for a sim... (3)
-> + XSLT Transform documentation (2)
-> + XSLT stack trace in case of er... (3)
-> + No New Line (2)
-> - No New Line (1)
-> + howto loop through a sequence (2)
-> + xml and xsl and whitespace in... (2)
-> + XSL Date formatting (4)
-> + XSL to XSL Mapping using custo... (4)
-> + flat xml to nested xml comvers... (4)
-> + Including schema in scenario (2)
-> + DTDs and traversing (2)
-> + Help with transformation (2)
-> + Problem running XSLT against X... (2)
-> + Carriage return in the output (5)
-> + Generating XSLT to match a sch... (3)
-> + WYSIWYG editor (2)
-> + Grouping without For-Each (3)
-> + output XML using XSLT (8)
-> + Help configuring Xalan-j proce... (8)
-> + Convert Existing HTML pages to... (2)
-> + Generating Transformation - XS... (4)
-> + DOCTYPE public and system info... (2)
-> + Using EXSLT str:tokenize funct... (5)
-- Previous [661-680] [681-700] [701-720] Next
+ XQuery Help and Discussion (2017)
+ Stylus Studio FAQs (159)
+ Stylus Studio Code Samples & Utilities (364)
+ Stylus Studio Announcements (113)
Topic  
Postnext
carl miltonSubject: looping an element
Author: carl milton
Date: 11 Oct 2007 08:48 AM
i am trying to loop the image element in my target document. i need to to get image 1, image2 image 3, etc to display as below:

<images>
&#8722;
<image id="1">
&#8722;
<url>
http://www.property-net-malaga.com/images/medium/38121_1.jpg
</url>
<primary>1</primary>
</image>
&#8722;
<image id="2">
&#8722;
<url>
http://www.property-net-malaga.com/images/medium/38121_2.jpg
</url>
</image>
&#8722;
<image id="3">
&#8722;
<url>
http://www.property-net-malaga.com/images/medium/38121_3.jpg
</url>
</image>
&#8722;
<image id="4">
&#8722;
<url>
http://www.property-net-malaga.com/images/medium/38121_4.jpg
</url>
</image>
&#8722;
<image id="5">
&#8722;
<url>
http://www.property-net-malaga.com/images/medium/38121_5.jpg
</url>
</image>
&#8722;
<image id="6">
&#8722;
<url>
http://www.property-net-malaga.com/images/medium/38121_6.jpg
</url>
</image>
</images>

my source document looks like this:

<root xsi:noNamespaceSchemaLocation="hiperprop%20schema.xsd">
&#8722;
<property>
<id>MDQAAP5132</id>
<Reference>CBS1194</Reference>
<price_freq>sale</price_freq>
<price>98,580</price>
<type>Townhouse</type>
<town>Dehesa de Campoamor</town>
<province>Malaga</province>
<beds>2</beds>
<baths>1</baths>
&#8722;
<desc>
Las Ocas, Campoamor. Little Bungalow with 1 Bedroom and 1 Guestroom. Olderly house needs renovatio, but with possibilty of extention to 3 Bedrooms, with small private garden and wonderful seaviews from the roof terrace.
</desc>
<plotsize>150</plotsize>
<builtsize>60</builtsize>
<features>@874@969@53@871@875@427@893@162@164@</features>
<areaid>1357</areaid>
<fulldesc></fulldesc>
&#8722;
<image1>
http://mlsdata.mercuryin.es/thumb/stream.asp?width=150&pic=MDQAAP5132_2266.JPG
</image1>
<image1_description>front</image1_description>
&#8722;
<image2>
http://mlsdata.mercuryin.es/thumb/stream.asp?width=150&pic=MDQAAP5132_2267.JPG
</image2>
<image2_description>living room</image2_description>
&#8722;
<image3>
http://mlsdata.mercuryin.es/thumb/stream.asp?width=150&pic=MDQAAP5132_2268.JPG
</image3>
<image3_description>kitchen</image3_description>
&#8722;
<image4>
http://mlsdata.mercuryin.es/thumb/stream.asp?width=150&pic=MDQAAP5132_2269.JPG
</image4>
<image4_description>upstairs bedroom</image4_description>
&#8722;
<image5>
http://mlsdata.mercuryin.es/thumb/stream.asp?width=150&pic=MDQAAP5132_2270.JPG
</image5>
<image5_description>bedroom</image5_description>
<date>04/06/2007 12:14:22</date>
</property>
&#8722;
<property>

my target document looks like this:

<root>
&#8722;
<propertyshowrooms>
<feed_version>2</feed_version>
</propertyshowrooms>
&#8722;
<property>
<date>2006-10-26 15:31:51</date>
<ref>MER563</ref>
<price>225500</price>
<currency>EUR</currency>
<price_freq>sale</price_freq>
<part_ownership>0</part_ownership>
<leasehold>0</leasehold>
<isnewdevelopment>1</isnewdevelopment>
&#8722;
<type>
<en>Townhouse</en>
</type>
<town>Torrevieja</town>
<province>Alicante</province>
<country>Spain</country>
<location_detail>Crevillente</location_detail>
<beds>3</beds>
<baths>2</baths>
<pool>1</pool>
&#8722;
<surface_area>
<built>200</built>
<plot>3000</plot>
<terrace>60</terrace>
<garden>500</garden>
</surface_area>
<distancetobeach>100</distancetobeach>
<distancetoshops>2000</distancetoshops>
<orientation>East</orientation>
<views>Sea, Mountains</views>
<carpark>1</carpark>
<waterconnection>1</waterconnection>
<electricityconnection>1</electricityconnection>
<telephoneconnection>1</telephoneconnection>
<elevator>0</elevator>
<fireplace>1</fireplace>
<solarium>0</solarium>
<storage>1</storage>
<watertank>1</watertank>
<safe>1</safe>
<airconditioning>1</airconditioning>
<centralheating>1</centralheating>
<floorheating>1</floorheating>
<fittedkitchen>1</fittedkitchen>
<doubleglazing>1</doubleglazing>
<irrigationsystem>1</irrigationsystem>
<jacuzzi>1</jacuzzi>
<sauna>1</sauna>
<gymnasium>1</gymnasium>
<tenniscourt>1</tenniscourt>
<alarm>1</alarm>
<security>1</security>
<gatedcommunity>1</gatedcommunity>
&#8722;
<desc>
<en>English description here</en>
</desc>
&#8722;
<images>
&#8722;
<image id="1">
&#8722;
<url>
http://go.alphashare.com/photos/full_31542_310398.jpg
</url>
<primary>1</primary>
&#8722;
<title>
<en>Front view</en>
</title>
</image>
&#8722;
<image id="2">
&#8722;
<url>
http://go.alphashare.com/photos/full_31542_310399.jpg
</url>
<primary>0</primary>
&#8722;
<title>
<en>Side entrance</en>
</title>
</image>
</images>
</property>
</root>


Documentdata249.xml
source document

UnknownPropertyshowrooms.com_Feed_XML_Sample_V1Standard.xml

Postnext
(Deleted User) Subject: looping an element
Author: (Deleted User)
Date: 11 Oct 2007 09:12 AM
Hi Carl,
could you tell us which version of Stylus Studio are you using, and which XSLT processor have you selected in the scenario dialog?

Thanks,
Alberto

Postnext
carl miltonSubject: looping an element
Author: carl milton
Date: 12 Oct 2007 07:19 AM
i am using the 'built in' processor and the version is 2006 release 2.

thanks

Postnext
(Deleted User) Subject: looping an element
Author: (Deleted User)
Date: 12 Oct 2007 11:22 AM
Hi Carl,
one way you can use to create the 'images' tags is by using Mapper, right clicking on the 'image' node in the target schema, selecting 'Duplicate node', setting the 'id' attribute to be a literal value of '1' and dragging a link from image1 and image1_description; then, repeat the same operation other 4 times, building links from the image2, image3, image4 and image5 nodes.

Hope this helps,
Alberto


Unknowndata249.xsl
The stylesheet generated by mapper

Posttop
carl miltonSubject: looping an element
Author: carl milton
Date: 12 Oct 2007 01:11 PM
thanks you soooo much. it works a treat!

   
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.