Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 7th, 2006, 03:14 AM
Friend of Wrox
Points: 696, Level: 9
Points: 696, Level: 9 Points: 696, Level: 9 Points: 696, Level: 9
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jan 2006
Location: Ennis, Clare, Ireland.
Posts: 129
Thanks: 10
Thanked 0 Times in 0 Posts
Default Child Node Output


I'm trying to run my XSL code as efficiently as possible. I have an extract from my XML file (below):

<Test Code="0001">
    <Set No="1">
    <Set No="2">
    <Set No="3">
    <SampRes No="1">
<Test Code="0005">
    <Desc>Crude Protein</Desc>
    <Set No="1">
    <Set No="2">
    <Set No="3">
    <SampRes No="1">
How do I loop through each '<Test Code="xxxx">' and display each child node and the relevant fields? I understand the 'For Each' statement, but I wonder whether there is a more automated system.

<xsl:template name="Test">
    <xsl:for-each select="*//Test">
        <xsl:element name="Test">
            <xsl:attribute name="Code">
                <xsl:value-of select="@*"/>
The above obviously produces:

<Test Code="0001" />
<Test Code="0005" />
How do I retrieve and display each child node (and all other dependant fields) for each 'Test'?

For Example
How do I return the individual values for?
The <UOM> value
The <Set> Value
The <Target> value


A Northern Soul

A Northern Soul
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Process all nested child node tims XSLT 4 April 8th, 2008 07:45 AM
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
How to count the child node suri_1811 XSLT 6 November 10th, 2006 04:51 PM
Copying Source Node attributes to output node pvsat XSLT 2 November 3rd, 2005 09:46 AM

All times are GMT -4. The time now is 10:26 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.