Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7676947
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T17:18:50+00:00 2026-05-31T17:18:50+00:00

I have the following simplified XML: <?xml version="1.0" encoding="UTF-8" ?> <MATMAS05> <IDOC BEGIN="1"> <E1MARAM

  • 0

I have the following simplified XML:

<?xml version="1.0" encoding="UTF-8" ?>
<MATMAS05>
<IDOC BEGIN="1">
    <E1MARAM SEGMENT="1">
        <MSGFN>005</MSGFN>
        <MATNR>000000000000401436</MATNR>
        <E1MARCM SEGMENT="1">
            <MSGFN>005</MSGFN>
            <WERKS>A120</WERKS>
            <MMSTA>01</MMSTA>
        </E1MARCM>
        <E1MVKEM SEGMENT="1">
            <VKORG>0120</VKORG>
            <VMSTA>04</VMSTA>
        </E1MVKEM>
    </E1MARAM>
</IDOC>
</MATMAS05>

If <WERKS>=A120 and <MMSTA> is NOT '01' or '02' or '03' OR if <VKORG>=0120 and <VMSTA> is NOT '01' or '02' or '03' then the <MATNR> should be mapped to the target XML.

I came up with the following XSLT:

<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output encoding="UTF-8" method="xml" indent="yes"/>

<xsl:template match="/*">
    <xsl:for-each
        select="IDOC[(E1MARAM/E1MVKEM[VKORG='0120'][not(VMSTA='01' or VMSTA='02' or VMSTA='03')])
            or (E1MARAM/E1MARCM[WERKS = 'A120'][not(MMSTA='01' or MMSTA='02' or MMSTA='03')])]">
        <Item>
            <ITEM_CODE>
                <xsl:value-of select="E1MARAM/MATNR"/>
            </ITEM_CODE>
        </Item>
    </xsl:for-each>
</xsl:template>
</xsl:stylesheet>

But if I apply that XSLT I get the following unwanted output (because <MMSTA>='01'):

<?xml version="1.0" encoding="UTF-8"?>
<Item>
<ITEM_CODE>000000000000401436</ITEM_CODE>
</Item>

How can I solve this? I have tried around with that XPATH expression but I can’t get the wanted result. What am I doing wrong in my XPATH?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T17:18:51+00:00Added an answer on May 31, 2026 at 5:18 pm

    This is what I did:

    //IDOC[(E1MARAM/E1MVKEM[VKORG='0120' and not(VMSTA='01' or VMSTA='02' or VMSTA='03')]) or (E1MARAM/E1MARCM[WERKS='A120' and not(MMSTA='01' or MMSTA='02' or MMSTA='03')])]
    

    I tried yours as well, and it works if you add the root to IDOC, since MATMAS05 is the actual root:

    //IDOC[(E1MARAM/E1MVKEM[VKORG='0120'][not(VMSTA='01' or VMSTA='02' or VMSTA='03')])             or (E1MARAM/E1MARCM[WERKS = 'A120'][not(MMSTA='01' or MMSTA='02' or MMSTA='03')])]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following simplified XML: <?xml version="1.0" encoding="UTF-8"?> <ExportData> <Rows> <R> <companyCodestringtrue>101</companyCodestringtrue> <transactionQualifierstring>Sales</transactionQualifierstring>
I have the following simplified XML structure: <?xml version="1.0" encoding="UTF-8"?> <ExportData> <TransportHeader> <Timestamp>2011-01-16 06:00:33</Timestamp>
I have the following simplified XML source: <?xml version=1.0 encoding=UTF-8?> <MVKE> <item> <MANDT>025</MANDT> <MATNR>000000000000000551</MATNR>
I have the following (simplified XML): <?xml version=1.0 encoding=UTF-8 ?> <products> <product> <artnr>xxx1</artnr> </product>
I have a simple xml file that looks like this: <?xml version=1.0 encoding=UTF-8 standalone=yes
So I have an xml file with the following simplified xml file contents: <CollectionItems>
I have the following (highly simplified) XML document that I am reading into my
I have the following XML (it is simplified and most attributes are omitted): <Document>
I have a document which when simplified looks like this: <?xml version=1.0?> <document> <br/>
I have the following XML (simplified): <node1> <node2> <node3> </node3> </node2> </node1> And I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.