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
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
Alberto MassariSubject: looping an element
Author: Alberto Massari
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
Alberto MassariSubject: looping an element
Author: Alberto Massari
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!

 
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.