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
Jeff  BerneySubject: Help a newbie
Author: Jeff Berney
Date: 06 Nov 2006 01:42 PM
Hello,
I kinda new to xslt, what i'm trying to do is place phone table inside the contacts table as a nested element based on the id. How can i do that in xslt?..any help is appreciated.

This is the xml i have
<Contact>
<PeopleId>3135</PeopleId>
<Title>Producer</Title>
<FirstName>John</FirstName>
<MiddleInitial>H </MiddleInitial>
<LastName>Rasmus</LastName>
<FullName>John H Rasmus</FullName>
<GoesBy>Jonny</GoesBy>
<Prefix>Mr.</Prefix>
</Contact>
<Contact>
<PeopleId>3133</PeopleId>
<Title>Account Manager</Title>
<FirstName>Rod</FirstName>
<MiddleInitial xml:space="preserve"> </MiddleInitial>
<LastName>Lemmon</LastName>
<FullName>Rod Lemmon</FullName>
<GoesBy>Rod</GoesBy>
<Prefix>Mr.</Prefix>
</Contact>
<Phone>
<PeopleId>3135</PeopleId>
<PhoneNumber>2145879632</PhoneNumber>
<Extension />
<Description>Home Phone</Description>
<PrimaryPhone>No</PrimaryPhone>
</Phone>
<Phone>
<PeopleId>3133</PeopleId>
<PhoneNumber>2145896547</PhoneNumber>
<Extension />
<Description>Cell Phone</Description>
<PrimaryPhone>No</PrimaryPhone>
</Phone>



This is the output i want
<Contact>
<PeopleId>3135</PeopleId>
<Title>Producer</Title>
<FirstName>John</FirstName>
<MiddleInitial>H </MiddleInitial>
<LastName>Rasmus</LastName>
<FullName>John H Rasmus</FullName>
<GoesBy>Jonny</GoesBy>
<Prefix>Mr.</Prefix>
<Phone>
<PeopleId>3135</PeopleId>
<PhoneNumber>2145879632</PhoneNumber>
<Extension />
<Description>Home Phone</Description>
<PrimaryPhone>No</PrimaryPhone>
</Phone
</Contact>
<Contact>
<PeopleId>3133</PeopleId>
<Title>Account Manager</Title>
<FirstName>Rod</FirstName>
<MiddleInitial xml:space="preserve"> </MiddleInitial>
<LastName>Lemmon</LastName>
<FullName>Rod Lemmon</FullName>
<GoesBy>Rod</GoesBy>
<Prefix>Mr.</Prefix>
</Contact>

Postnext
Tony LavinioSubject: Help a newbie
Author: Tony Lavinio
Date: 06 Nov 2006 02:38 PM
We're happy to offer free support to our users.

Based on the email address you used here, we don't recognize you as
one. Could you please tell us which version of Stylus Studio you are
using so we may best help you?

Postnext
Jeff  BerneySubject: Help a newbie
Author: Jeff Berney
Date: 07 Nov 2006 01:49 PM
Version 5.1

Postnext
James DurningSubject: Help a newbie
Author: James Durning
Date: 07 Nov 2006 04:56 PM
<xsl:template match="Contact">
<xsl:copy>
<xsl:copy-of select="*"/>
<xsl:copy-of select="//Phone[PeopleId = current()/PeopleId]"/>
</xsl:copy>

Posttop
Jeff  BerneySubject: Help a newbie
Author: Jeff Berney
Date: 08 Nov 2006 03:20 PM
yep..got it. Thanks so much Tony!!!

 
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.