Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

XSLT/XSL issue

Posted on 2012-03-22
3
Medium Priority
?
371 Views
Last Modified: 2012-03-22
I am trying to code this xsl stylesheet and not having done this before, I am lost. I do not have access to the actual xml being returned but do have access to the SQL Server procedure results that eventually ends up as the xml. The SQL Procedure returns several tables but I am really only concerned about two of them. LineItem and SubLineItem. What I need to do is filter the LineItem table down using a description.

<xsl:for-each select="//GetOrderDetailsInfoResults/LineItem[perf_desc != 'OPA Handling Fee']">

Now what I need to is to grab the value of an element (li_seq_no) out of these results. Use the returned "li_seq_no" to filter my SubLineItem and sum the due_amt element into a variable.

I have know idea how to do this. In sql server, this would be just a join such as

Select sum(sl.due_amt) from LineItem as l join SubLineItem sl on l.li_seq_no = sl.li_seq_no where l.perf_desc = 'OPA Handling Fee'

Any Ideas?
Thanks
0
Comment
Question by:DowntownIT
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 60

Accepted Solution

by:
Geert Bormans earned 2000 total points
ID: 37753764
what you should do is index the source (in order for us to help you a view on the source XML would really be nice)
indexing can be done with
<xsl:key>
give the key a random name, choose what element from the source should be returned and the index is the path to the li_seq_no
then you can get the indexed node back by calling the key function

inside the for-each for the LineItem, you can get the lis_seq_no
the key is for sublineitem
so
<xsl:key name="sli" match="SubLineItem" use="li_seq_no"/>

using the function inside the for-each
key('sli', li_seq_no) will return to you tyhe sublineitem nodes that match

XML source would help to be more precise

xsl:key is an index in the document
given two tables in one XML document, xsl:key is an enabler for joins
0
 
LVL 2

Author Closing Comment

by:DowntownIT
ID: 37753886
I was able to get the xsl:key to work. Thanks for the help!
0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 37754022
welcome
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question