Solved

XSLT/XSL issue

Posted on 2012-03-22
3
359 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
  • 2
3 Comments
 
LVL 60

Accepted Solution

by:
Geert Bormans earned 500 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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
AngularJS directive issue 6 54
use of cookies and regulations 1 52
API Soap Calls 4 59
microsoft access - xml 10 24
Browsing the questions asked to the Experts of this forum, you will be amazed to see how many times people are headaching about monster regular expressions (regex) to select that specific part of some HTML or XML file they want to extract. The examp…
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

706 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now