Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
| 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 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
Location: , , .
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:



                 Type
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">
         <tr>
             - td for "node"
             - <xsl:for-each select="a/b/c/x">
                    draw a column(?)
         </tr>

?- 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?

Thanks

 
Old October 15th, 2007, 11:49 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

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
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

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
http://www.saxonica.com/
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.