Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 1st, 2007, 11:15 AM
Registered User
 
Join Date: Apr 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default get node reverse loop

OK , This is a very hard ? and very complex. Is there any professional out there that can help me out.

this is my xml file:

<?xml-stylesheet type="text/xsl" href="bhfeedSchema.xsl"?>
<berkeleyhomes>
<generated>Wed, 02 May 2007 06:00:45</generated>
<developments>
<development sitecode="a999" name="Gunwharf Quays - Crescent Penthouses" status="Available" region="Hampshire" URL="http://www.berkeleyhomes.co.uk/index.cfm?articleid=1332" developmentimage="media/development_images/g/d/a999_devpic_1.jpg" URLprefix="http://www.berkeleyhomes.co.uk/">
<contact> <address1>Portsmouth Harbour</address1>
<address2></address2> <town>Portsmouth</town> <postcode>PO1 3TA</postcode>
<phone>023 9285 1800</phone>
<email>[email protected]</email>
<regionaloffice>Southern</regionaloffice>
</contact>
<pricerange>
<from>380000</from>
<to>380000</to>
</pricerange>
<plots>
<plot> <plotnumber>171</plotnumber> <type>Penthouse</type> <floorplan url="http://floorplans.berkeleyhomes.co.uk/a999/a999_171_2_Eleventh_Floor.gif" title="Eleventh Floor"></floorplan>
<bedrooms>2</bedrooms> <price>380000</price> <completion>Spring 07</completion>
<availability>AVAILABLE</availability>
</plot>
<plot> <plotnumber>172</plotnumber>
<type>Penthouse</type>
<floorplan url ://floorplans.berkeleyhomes.co.uk/a999/a999_172_2_Eleventh_Floor_(Mirrored).gif" title="Eleventh Floor (Mirrored)"></floorplan>
                            <bedrooms>2</bedrooms> <price>380000</price> <completion>Spring 07</completion>
<availability>AVAILABLE</availability>
</plot>
</plots>
<information>&lt;p&gt;&lt;span&gt;Experience the high life</information>
</information>
<specification>Individually Designed Kitchens</specification>
<media></media>
</development>
</developments>
</berkeleyhomes>

I'm trying to creat an xsl file to produce an text file that should look like this.

171|Penthouse|http://floorplans.berkeleyhomes.co.uk/a999/a999_171_2_Eleventh_Floor.gif|Eleventh Floor|2|380000|Spring 07|AVAILABLE|a999|Gunwharf|||||||||||||||||

I need to create a loop to get nodes from the plot and then get the development nodes added to each plot.

HELP ME
 
Old June 1st, 2007, 11:58 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Sorry, your XML has come out as a complete mess. Could you format it so that people can read it please? And preferably remove the parts that are irrelevant to the problem (which probably means most of it).

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old June 1st, 2007, 12:02 PM
Friend of Wrox
 
Join Date: Jul 2006
Posts: 430
Thanks: 28
Thanked 5 Times in 5 Posts
Send a message via Yahoo to bonekrusher
Default

This is basic XSLT. This should get you started. I suggest that you pick up some books to help you along. Check out the books section on this site on XML and XSLT.



<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="text" version="1.0" encoding="UTF-8" indent="yes"/>
    <xsl:template match="/">
        <xsl:for-each select="//plot">
            <xsl:value-of select="plotnumber"/> |
            <xsl:value-of select="type"/> |
            <xsl:value-of select="floorplan/@title"/> |
            <xsl:value-of select="price"/> |
            <br/>
        </xsl:for-each>
    </xsl:template>
</xsl:stylesheet>


 
Old June 1st, 2007, 12:05 PM
Friend of Wrox
 
Join Date: Jul 2006
Posts: 430
Thanks: 28
Thanked 5 Times in 5 Posts
Send a message via Yahoo to bonekrusher
Default

MHkay - opps I didnt see your post.





Similar Threads
Thread Thread Starter Forum Replies Last Post
The reference node is not a child of this node.XSL XMLUser XSLT 2 February 25th, 2008 05:22 AM
how to append child node after an node in XML + C# vishnu108mishra XML 5 November 13th, 2007 05:30 AM
Reverse Engineering abdul_owiusa General .NET 0 July 18th, 2006 10:22 AM
reverse engineering? druid95 Pro VB 6 1 May 5th, 2006 10:48 AM
Copying Source Node attributes to output node pvsat XSLT 2 November 3rd, 2005 09:46 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.