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 October 15th, 2007, 09:38 AM
Registered User
Join Date: Oct 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default xslt xpath

Hi everyone!

Maybe this is a little to simple, but here it goes:

im iterating in a node, lets say

<xsl:for-each select="a/b/c/x">

which each one of it has an attribute title.

Now each one of these x´s can have one or more y´s that have the title as an atrribute of the parent node.

I want to make a html table that looks like this:

Node titleA titleB titleC titleD
y1 X
y2 X
y3 X
y4 X
y5 X
y6 X
y7 X

so my code(pseudo) looks like:

//fill the first line(node and type)
//fill the second line which includes:
<xsl:for-each select="a/b/c/x">
    draw a column

//and then
<xsl:for-each select="a/b/c/x">
         <xsl:for-each select="y">
             - td for "node"
             - <xsl:for-each select="a/b/c/x">
                    draw a column(?)

?- How can I get the value of y here??

My explanation is a little confusing, but what i really want is to know how can i get the value of it in the context of the first iteration(the two fors) ignoring the second iteration.Is that possible.Is there another way of doing it?


Old October 15th, 2007, 11:49 AM
joefawcett's Avatar
Wrox Author
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts

I don't fully grasp what you want but you seem to be thinking along procedural lines rather than functional/declarative. Can you post a small example of the XML and the desired result?


Joe (Microsoft MVP - XML)
Old October 15th, 2007, 05:31 PM
mhkay's Avatar
Wrox Author
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts

Could you please show some real input and output? I can't figure out what these x's and y's are supposed to represent. Are you literally putting x's in the cells of your output table, or does x represent something else?

Michael Kay
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference

Similar Threads
Thread Thread Starter Forum Replies Last Post
Array like processing (Xpath 1 / XSLT 1) akentanaka XSLT 1 July 2nd, 2008 02:22 AM
JAXP and XSLT 2.0 / XPATH 2.0 ojasrege XSLT 2 November 27th, 2007 10:40 AM
XPath & XSLT problem Andy-7M XSLT 7 May 3rd, 2007 02:50 AM
XSLT -XPATH Error xslspy XSLT 1 October 27th, 2005 03:24 AM
XSLT/XPATH Help KombatKarl XSLT 3 September 2nd, 2004 07:35 AM

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