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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T08:33:21+00:00 2026-06-03T08:33:21+00:00

I need xslt to transform, My Xml is as below <OrderReferences> <OrderRef> <OrderRef>OrderRef1</OrderRef> <Type>ERP</Type>

  • 0

I need xslt to transform, My Xml is as below

 <OrderReferences>
            <OrderRef>
              <OrderRef>OrderRef1</OrderRef>
              <Type>ERP</Type>
            </OrderRef>
            <OrderRef>
              <OrderRef>OrderRef2</OrderRef>
              <Type>CUSTOMER</Type>
            </OrderRef>
            <OrderRef>
              <OrderRef>OrderRef3</OrderRef>
              <Type>EXT</Type>
            </OrderRef>
          </OrderReferences>

My Output from this should be

<OrderReference> (OrderReference for ERP should appear here) </OrderReference>
<OrderReferenceCustomer> (CustomerReference for Customer should appear here) </OrderReferenceCustomer>
<OrderReferenceExternal> (ExtReference for EXT should appear here) </OrderReferenceExternal>

Let me know if this is achievable. XSLT 1.0 version preferrable as i want this for .Net. Thanks.

  • 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-03T08:33:23+00:00Added an answer on June 3, 2026 at 8:33 am

    This short and simple transformation:

    <xsl:stylesheet version="1.0"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
     <xsl:output omit-xml-declaration="yes" indent="yes"/>
     <xsl:strip-space elements="*"/>
    
     <xsl:template match="OrderRef[Type='ERP']">
         <OrderReference><xsl:value-of select="OrderRef"/></OrderReference>
     </xsl:template>
    
     <xsl:template match="OrderRef[Type='CUSTOMER']">
         <OrderReferenceCustomer><xsl:value-of select="OrderRef"/></OrderReferenceCustomer>
     </xsl:template>
    
     <xsl:template match="OrderRef[Type='EXT']">
         <OrderReferenceExternal><xsl:value-of select="OrderRef"/></OrderReferenceExternal>
     </xsl:template>
    </xsl:stylesheet>
    

    when applied on the provided XML document:

    <OrderReferences>
        <OrderRef>
            <OrderRef>OrderRef1</OrderRef>
            <Type>ERP</Type>
        </OrderRef>
        <OrderRef>
            <OrderRef>OrderRef2</OrderRef>
            <Type>CUSTOMER</Type>
        </OrderRef>
        <OrderRef>
            <OrderRef>OrderRef3</OrderRef>
            <Type>EXT</Type>
        </OrderRef>
    </OrderReferences>
    

    produces the exact wanted, correct result (unlike the currently accepted answer):

    <OrderReference>OrderRef1</OrderReference>
    <OrderReferenceCustomer>OrderRef2</OrderReferenceCustomer>
    <OrderReferenceExternal>OrderRef3</OrderReferenceExternal>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing an XSLT template that need to output a valid xml file for
I need to transform XML using xslt. Logic: Split the parent if the parent
For XSLT transformation I need a javax.xml.transform.stream.StreamSource object representing xml file being transformed. I
i need help in getting the below output from shops.xml file( where incity=yes and
I need to transform one XML document into another using XSLT (for now from
I need to transform an xml-structure into a text string using xslt. I have
I need to transform an XML string using XSLT in Javascript. While the XSLT
I need to transform an XML file to another XML file, where the source
I need to transform the following xml doc: <a> <b/> <c/> myText </a> into
I need to transform a piece of XML, so that the value of every

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.