Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register
Register | 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
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old February 26th, 2006, 11:36 PM
Authorized User
 
Join Date: Feb 2006
Location: Karur, Tamildau, India.
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default Choosing content depending on content of other ele

Hi all,

I have the following query regarding the search for a paticular node based upon the value present in a particular nodes attribute value.

Here is the example that I am working on.

<?xml version="1.0" encoding="UTF-8"?>
<Stores>
<Product id = "1">
    <name>Vegtables</name>
    <cost>10</cost>
</Product>
<Product id = "2">
    <name>Shirts</name>
    <cost>10</cost>
</Product>
<Sales>
 <Item Prodid="1">
   <Counts>23</Counts>
 </Item>
</Sales>
</Stores>


The output that i want is like this on applying a xslt over this

<?xml version="1.0" encoding="UTF-8"?>
<Sales>
 <Item>
   <name>Vegatables</name>
   <PerItemcost>10</PerItemCost>
    <Price>230</Price>
 </Item>
</Sales>

I am not able to select the product details based upon the item's Prodid. Can any one please help me with an xslt code. I tried with large number of possible ways but I am not able to search a particular node based upon the node value of another attribute.

__________________
Regards,
dsekar_nat
Reply With Quote
  #2 (permalink)  
Old February 27th, 2006, 05:58 AM
mhkay's Avatar
Wrox Author
Points: 18,274, Level: 58
Points: 18,274, Level: 58 Points: 18,274, Level: 58 Points: 18,274, Level: 58
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,932
Thanks: 0
Thanked 282 Times in 277 Posts
Default

If the context node is an Item, you can select the Product using

/Stores/Product[@id=current()/@Prodid]

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
Reply With Quote
Reply


Thread Tools
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
changing content depending on combo box value bewise PHP How-To 1 September 13th, 2006 12:57 PM
Content management Mike707 Dreamweaver (all versions) 1 September 1st, 2006 05:43 PM
Content management?? haggis82 Dreamweaver (all versions) 1 December 9th, 2004 03:11 AM
Importing Content eschillay Dreamweaver (all versions) 1 March 1st, 2004 05:10 PM



All times are GMT -4. The time now is 02:01 AM.


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