Link to home
Start Free TrialLog in
Avatar of NAEDI2
NAEDI2Flag for United States of America

asked on

XSLT XPath Quantified Expression Help

I am trying to use a quantified expression to check every line item in a purchase order to see if the confirmed date and quantity (E2EDP20_EDATU, E2EDP20_WMENG) match the order date and quantity (E2EDP03_DATUM, E2EDP01_MENGE) within each G03 node..  

This is an SAP ORDERS IDOC.  If the E2EDP01 ordering data matches the E2EDP02 and E2EDP20 order confirmation the order is accepted unchanged.  If the E2EDP20_WMENG quanity is different than E2EDP01_MENGE we detect a change.  If the EDP20_EDATU  is different than E2EDP01_DATUM we also detect a change.

There  may be many G03 groups each with a new line item within to be checked.

When I enter this code below I get "Xpath is Invalid".  Am I not supposed to be able to use pos$ as a variable for each //G03 and use it as part of the Xpath to the E2EDP03 and E2EDP01?

<xsl:value-of select=" if (every $pos in //G03 satisfies (pos$/E2EDP20/E2EDP20_EDATU=pos$/E2EDP03[E2EDP03_IDDAT='002']/E2EDP03_DATUM and pos$/E2EDP20/E2EDP20_WMENG=pos$/E2EDP01/E2EDP01_MENGE)) then 'NOCHANGE' else 'CHANGE' "/>



<?xml version="1.0" encoding="UTF-8"?>
<!-- Based on format description: ordrsp_sr3_ord04 --><ACTIS>
  <Ein_IDOC>
  	  <G01>
  	  	...
  	  <G02>
				...
      <G03>
         <E2EDP01>
            <E2EDP01_POSEX>000010</E2EDP01_POSEX>
            <E2EDP01_ACTION>001</E2EDP01_ACTION>
            <E2EDP01_MENGE>960.000</E2EDP01_MENGE>
            <E2EDP01_MENEE>PCE</E2EDP01_MENEE>
            <E2EDP01_PMENE>PCE</E2EDP01_PMENE>
            <E2EDP01_VPREI>608.92</E2EDP01_VPREI>
            <E2EDP01_PEINH>100</E2EDP01_PEINH>
            <E2EDP01_NETWR>5845.63</E2EDP01_NETWR>
            <E2EDP01_NTGEW>624.000</E2EDP01_NTGEW>
            <E2EDP01_GEWEI>KGM</E2EDP01_GEWEI>
            <E2EDP01_CURCY>USD</E2EDP01_CURCY>
            <E2EDP01_MATKL>M35040</E2EDP01_MATKL>
            <E2EDP01_BRGEW>624.000</E2EDP01_BRGEW>
            <E2EDP01_PSTYV>ZTAN</E2EDP01_PSTYV>
            <E2EDP01_WERKS>0082</E2EDP01_WERKS>
            <E2EDP01_ROUTE>513K04</E2EDP01_ROUTE>
            <E2EDP01_ROUTE_BEZ>CR-US, TRUCK, AVERITT (EAST)</E2EDP01_ROUTE_BEZ>
            <E2EDP01_VSTEL>0051</E2EDP01_VSTEL>
         </E2EDP01>
         <E2EDP03>
            <E2EDP03_HLEVEL>03</E2EDP03_HLEVEL>
            <E2EDP03_IDDAT>002</E2EDP03_IDDAT>
            <E2EDP03_DATUM>20180503</E2EDP03_DATUM>
         </E2EDP03>
         <E2EDP03>
            <E2EDP03_IDDAT>022</E2EDP03_IDDAT>
            <E2EDP03_DATUM>20180409</E2EDP03_DATUM>
         </E2EDP03>
         <E2EDP20>
            <E2EDP20_WMENG>960.000</E2EDP20_WMENG>
            <E2EDP20_EDATU>20180503</E2EDP20_EDATU>
         </E2EDP20>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Gertone (Geert Bormans)
Gertone (Geert Bormans)
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of NAEDI2

ASKER

I was so focused on the Xpath part I couldn't see this obvious and embarrassing error.   Thank you.