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 6340307
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T19:48:38+00:00 2026-05-24T19:48:38+00:00

I have the following (simplified) XML that I get in a system environment: <?xml

  • 0

I have the following (simplified) XML that I get in a system environment:

<?xml version="1.0" encoding="UTF-8"?>
<root>
<IS_LOG>
    <USER>19291</USER>
    <DATE>2011-08-15</DATE>
    <TIME>15:36:36</TIME>
    <SYST>sy1</SYST>
    <MATERIALS>
        <item>
            <sy>100</sy>
            <mat>000000000000310000</mat>
        </item>
        <item>
            <sy>100</sy>
            <mat>000000000000491078</mat>
        </item>
    </MATERIALS>
</IS_LOG>
</root>

The system that I work with passes me a variable at runtime that is not included in the XML structure above.

I have the following XSLT:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl" version="1.0">

<!-- System variable whose value I normally only get only at runtime;
for test purposes set locally -->
<xsl:variable name="SenderService" select="'AT'"/>

<xsl:template match="@*|node()">
    <xsl:choose>
        <xsl:when test="$SenderService='AT'">
            <xsl:copy>
                <xsl:apply-templates mode="AT" select="@*|node()"/>
            </xsl:copy>
        </xsl:when>
        <xsl:otherwise>
        <xsl:copy>
            <xsl:apply-templates select="@*|node()"/>
        </xsl:copy>
        </xsl:otherwise>
   </xsl:choose> 
</xsl:template>


<xsl:template mode="AT" match="item[mat &gt; 000000000000299999 and mat &lt; 000000000000399999]"/>

</xsl:stylesheet>

Now I need to copy all elements item excluding the ones where mat is in the number range of 300000 to 399999 and SenderService is ‘AT’.
If to test it locally I change the SenderService in my XSLT to e.g. ‘Z’, the output looks fine, all items get copied:

<?xml version="1.0" encoding="UTF-8"?>
<root>
<IS_LOG>
    <USER>19291</USER>
    <DATE>2011-08-15</DATE>
    <TIME>15:36:36</TIME>
    <SYST>sy1</SYST>
    <MATERIALS>
        <item>
            <sy>100</sy>
            <mat>000000000000310000</mat>
        </item>
        <item>
            <sy>100</sy>
            <mat>000000000000491078</mat>
        </item>
    </MATERIALS>
</IS_LOG>
</root>

But if I set SenderService to ‘AT’ the output looks like this:

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

    19291
    2011-08-15
    15:36:36
    sy1
    
        
        
            100
            000000000000491078
        
    

</root>

The correct item gets copied but without the tags. How can I change the XSLT?

  • 1 1 Answer
  • 3 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-24T19:48:39+00:00Added an answer on May 24, 2026 at 7:48 pm
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
        <xsl:output method="xml" indent="yes"/>
    
        <xsl:variable name="SenderService" select="'AT'"/>
    
        <xsl:template match="@*|node()">
            <xsl:copy>
                <xsl:apply-templates select="@*|node()"/>
            </xsl:copy>
        </xsl:template>
    
    
        <xsl:template match="item[mat &gt; 000000000000299999 and mat &lt; 000000000000399999]">
            <xsl:if test="$SenderService != 'AT'">
                <xsl:copy-of select="."/>
            </xsl:if>
        </xsl:template>
    
    </xsl:stylesheet>
    
    • 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" ?> <MATMAS05> <IDOC BEGIN="1"> <E1MARAM
I have the following simplified XML structure: <?xml version="1.0" encoding="UTF-8" ?> <INVOIC02> <IDOC BEGIN="1">
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
I have the following (highly simplified) XML document that I am reading into my
So I have an xml file with the following simplified xml file contents: <CollectionItems>
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/>

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.