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
Rinni VermaSubject: Need to loop through the an xml file to display content in a particular format
Author: Rinni Verma
Date: 19 Jul 2005 09:39 AM
Originally Posted: 19 Jul 2005 09:37 AM
Hello All, I need to loop through the following xml to display content in the format specified below. The following is an example xml file: <Employees> <Employee> <Field Name="empName" Value="x"/> <Field Name="empSSN" Value="123456789"/> </Employee> <Employee> <Field Name="empName" Value="u"/> <Field Name="empSSN" Value="987654321"/> </Employee> </Employees> I need to transform the above xml file using XSLT to display in the following format: Employee Name is x and SSN is 123456789 Enployee Name is y and SSN is 987654321 I tried using <xsl: foreach/> loop, but it does not help. Thanks. Rinni

Postnext
Tony LavinioSubject: Need to loop through the an xml file to display content in a particular format
Author: Tony Lavinio
Date: 19 Jul 2005 11:57 AM
<?xml version='1.0'?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:apply-templates select="Employees/Employee"/>
</xsl:template>
<xsl:template match="Employee">
<xsl:text>Name is </xsl:text>
<xsl:value-of select="Field[@Name = 'empName'][1]/@Value"/>
<xsl:text> and SSN is </xsl:text>
<xsl:value-of select="Field[@Name = 'empSSN'][1]/@Value"/>
<xsl:text>&#10;</xsl:text>
</xsl:template>
</xsl:stylesheet>

Posttop
Rinni VermaSubject: Need to loop through the an xml file to display content in a particular format
Author: Rinni Verma
Date: 19 Jul 2005 12:21 PM
Thanks for the prompt response. I'll try this out.

Rinni

 
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.