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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T18:28:17+00:00 2026-06-12T18:28:17+00:00

I have created a little application to convert XML which I get out of

  • 0

I have created a little application to convert XML which I get out of our system, to a new XML format needed for customers using XSLT. The problem is, I can’t seem to be able to retrieve the values of the XML nodes, they’re just all empty.

Here is my XSLT file:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
>
  <xsl:output method="xml" indent="yes" />

  <xsl:template match="/">
    <test>
      <xsl:apply-templates select="SourceEndpoint" />
    </test>
  </xsl:template>

  <xsl:template match="SourceEndpoint">
    <InvoiceAmount>
      <xsl:value-of select="." />
    </InvoiceAmount>
  </xsl:template>
</xsl:stylesheet>

My Original XML does have an node called SourceEndpoint so I’m not sure what I’m doing wrong here?

I also tried: <xsl:value-of select="Envelope/Header/SourceEndpoint" /> instead of a template but I got the same result

Edit

Here is a snippet my Original XML:

<Envelope xmlns="http://schemas.microsoft.com/dynamics/2008/01/documents/Message">
  <Header>
    <MessageId>{11EA62F5-543A-4483-B216-91E526AE2319}</MessageId> 
    <SourceEndpoint>Test</SourceEndpoint> 
    <DestinationEndpoint>TestInvoice</DestinationEndpoint> 
  </Header>
</Envelope>

Envelope is the root of the whole file

In the Transformed XML, test looks like: <test />

  • 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-06-12T18:28:18+00:00Added an answer on June 12, 2026 at 6:28 pm

    The XML file is in a default namespace — not in the “null” namespace. This makes a huge difference.

    Search for XPath and default namespace and you’ll find numerous good answers.

    In essence, you must define the same namespace in the XSLT transformation associating a prefix (say “x”) to it.

    Then in any XPath expression (a match pattern is a kind of XPath expression) use x:someName instead of someName.

    One additional issue with the provided code is that it attempts to access the element SourceEndpoint as the top element of the document — and the top element in this case has a different name.

    Correcting these two issues, we get the following transformation:

    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     xmlns:x="http://schemas.microsoft.com/dynamics/2008/01/documents/Message"
     exclude-result-prefixes="x">
        <xsl:output method="xml" indent="yes" />
    
        <xsl:template match="/">
            <test>
                <xsl:apply-templates select="/*/*/x:SourceEndpoint" />
            </test>
        </xsl:template>
    
        <xsl:template match="x:SourceEndpoint">
            <InvoiceAmount>
                <xsl:value-of select="." />
            </InvoiceAmount>
        </xsl:template>
    </xsl:stylesheet>
    

    When this transformation is applied on the provided XML document:

    <Envelope xmlns="http://schemas.microsoft.com/dynamics/2008/01/documents/Message">
        <Header>
            <MessageId>{11EA62F5-543A-4483-B216-91E526AE2319}</MessageId>
            <SourceEndpoint>Test</SourceEndpoint>
            <DestinationEndpoint>TestInvoice</DestinationEndpoint>
        </Header>
    </Envelope>
    

    the wanted, correct result is produced:

    <?xml version="1.0" encoding="utf-8"?>
    <test>
       <InvoiceAmount>Test</InvoiceAmount>
    </test>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

To get more familiar with the new Java EE 6 System I have created
Hi I have created a little application to move some files around and put
I have a page which contains a jQuery-UI horizontal slider, created using a little
For purposes of learning I have created an application which returns a computed output
I have created one application which contains several buttons to home page clicking on
I have programmed a little application in which you can register and edit your
I have written a little console application that uses s#arp. I can create an
I have created a little test project to try to resolve a problem I
I have created a little example,please have a look, http://jsfiddle.net/bWTwL/ I want to have
Ok, I have created a little utility with AppleScript and used Automator to turn

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.