Solved

XSLT/XSL issue

Posted on 2012-03-22
3
368 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 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa…
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

752 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