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)
-> + Use of before and after string (3) Sticky Topic
-> - How do I substitute element ty... (1)
-> + How does one add working days ... (4)
-> - Help, I have existing XLT and... (1)
-> + Need help on XSLT issue - (2)
-> + EDI to XML Conversion (7)
-> - XML To JSON Conversion using X... (1)
-> + Formatting Paragraphs to same ... (2)
-> - Grouping of records (1)
-> + Problems with xsd 1.1 (4)
-> + XML to HL7 mapping (3)
-> + XSLT 3 and Iterate (2)
-> + XSL-FO to PDF preview (3)
-> + java.lang.RuntimeException: Er... (2)
-> + Create Acroforms with Stylus X... (2)
-> + How to change XSLT parameter s... (3)
-> + how to change format of the da... (2)
-> + Search "Next 8 Results " doesn... (2)
-> - Support for Git (1)
-> + newbee (8)
-- [1-20] [21-40] [41-60] Next
+ XQuery Help and Discussion (2017)
+ Stylus Studio FAQs (159)
+ Stylus Studio Code Samples & Utilities (364)
+ Stylus Studio Announcements (113)
Topic  
Postnext
S RSubject: looping problem
Author: S R
Date: 18 Oct 2005 03:27 PM
Hi !

The xml file contains information of 3 students. I'm trying to display the firstname, lastname, id, exam, version and examdate. I'm able to display the information of the first student only. How do I get to display for all the 3 students?

Any suggestion or help is appreciated.

-SR


***************************************
xsl file ******************************
***************************************
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" />
<xsl:template match="/">
<html>
<body>
<h2>Student Responses</h2>


<table border="0" CELLSPACING="25" >
<xsl:for-each select="AIXRESULT/results">

<tr>
<td><b>FirstName:</b></td>
<td><xsl:value-of select="studentInfo/contact/firstname" /></td>
</tr>
<tr>
<td><b>LastName:</b></td>
<td><xsl:value-of select="studentInfo/contact/lastname" /></td>
</tr>

<tr>
<td><b>Id:</b></td>
<td><xsl:value-of select="studentInfo/contact/id" /></td>
</tr>


<xsl:for-each select="formInfo">

<tr>
<td><b>Exam:</b></td>
<td><xsl:value-of select="exam" /></td>
</tr>

<tr>

<td><b>Version:</b></td>
<td><xsl:value-of select="version" /></td>
</tr>

<tr>
<td><b>ExamDate: </b></td>
<td><xsl:value-of select="examDate" /></td>
</tr>

</xsl:for-each>

</xsl:for-each>

</table>
</body>
</html>


</xsl:template>
</xsl:stylesheet>




****************************************
xml file *******************************
****************************************

<?xml-stylesheet type="text/xsl" href="NameAns1.xsl" ?>

<AIXRESULT xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.00">
<results date_generated="10/17/05">
<studentInfo>
<contact>
<id>12345678</id>
<firstname>Robert</firstname>
<lastname>Fulton</lastname>
</contact>
</studentInfo>
<formInfo>
<exam>HS1</exam>
<version>Z1</version>
<lang>English (US)</lang>
<examDate>13-OCT-05</examDate>
<center>S9957</center>
<formId>25605</formId>
<quesCnt>150</quesCnt>
<pretestCnt>0</pretestCnt>
<asgnCnt>1</asgnCnt>
</formInfo>

<studentInfo>
<contact>
<id>44444444</id>
<firstname>Justin</firstname>
<lastname>Jacob</lastname>
</contact>
</studentInfo>
<formInfo>
<exam>HS3</exam>
<version>Z1</version>
<lang>English (US)</lang>
<examDate>13-OCT-05</examDate>
<center>S9957</center>
<formId>25606</formId>
<quesCnt>194</quesCnt>
<pretestCnt>0</pretestCnt>
<asgnCnt>1</asgnCnt>
</formInfo>

<studentInfo>
<contact>
<id>33333333</id>
<firstname>TURNER</firstname>
<lastname>DEANE</lastname>
</contact>
</studentInfo>
<formInfo>
<exam>HS1</exam>
<version>Z1</version>
<lang>English (US)</lang>
<examDate>29-AUG-05</examDate>
<center>S9957</center>
<formId>25605</formId>
<quesCnt>150</quesCnt>
<pretestCnt>0</pretestCnt>
<asgnCnt>1</asgnCnt>
</formInfo>
</results>
</AIXRESULT>

Postnext
(Deleted User) Subject: looping problem
Author: (Deleted User)
Date: 18 Oct 2005 03:51 PM
Assuming that <formInfo> following <studentInfo> corresponds to the same student:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml"/>
<xsl:template match="/">
<html>
<body>
<h2>Student Responses</h2>


<table border="0" CELLSPACING="25">
<xsl:for-each select="AIXRESULT/results/studentInfo">

<tr>
<td>
<b>FirstName:</b>
</td>
<td>
<xsl:value-of select="contact/firstname"/>
</td>
</tr>
<tr>
<td>
<b>LastName:</b>
</td>
<td>
<xsl:value-of select="contact/lastname"/>
</td>
</tr>

<tr>
<td>
<b>Id:</b>
</td>
<td>
<xsl:value-of select="contact/id"/>
</td>
</tr>



<tr>
<td>
<b>Exam:</b>
</td>
<td>
<xsl:value-of select="following-sibling::formInfo/exam"/>
</td>
</tr>

<tr>

<td>
<b>Version:</b>
</td>
<td>
<xsl:value-of select="following-sibling::formInfo/version"/>
</td>
</tr>

<tr>
<td>
<b>ExamDate:</b>
</td>
<td>
<xsl:value-of select="following-sibling::formInfo/examDate"/>
</td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

Posttop
S RSubject: looping problem
Author: S R
Date: 19 Oct 2005 02:59 PM
Thanks Yuriy.

I have been able to tackle this problem.

Also, how do I view the xml file in a word document, without the xml tags? The xml file also refers to an xsl.

In simple words, I would like to see my xml file in a word doc, in the same way as I see it being displayed in Internet Explorer.

thanks !
-SR

   
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.