Solved

Need XSL Transformation

Posted on 2014-04-15
5
208 Views
Last Modified: 2014-04-15
I opened up this question and had a good answer(see the xsl file):

"Trying to merge the fields OrderField1 and JobType into the OrderField1 field.  
So if
OrderField1="PW" and jobType="Generic"

The end result would be OrderField1="PW-Generic"    "

Now what I need is for the transformation to be in jobType field instead of the OrderField1 field.
orderexport-126-719347066.xml
MergeOrderField1AndJobType.xsl
0
Comment
Question by:Knight905416
  • 2
5 Comments
 
LVL 52

Expert Comment

by:Carl Tawn
Comment Utility
Do you mean you want the attribute that is output to be called "jobType" rather than "OrderField1"?
0
 
LVL 60

Accepted Solution

by:
Geert Bormans earned 500 total points
Comment Utility
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    
    <xsl:template match="node()">
        <xsl:copy>
            <xsl:apply-templates select="@*"/>
            <xsl:apply-templates select="node()"/>
        </xsl:copy>
    </xsl:template>
    
    <xsl:template match="job">
        <xsl:copy>
            <xsl:apply-templates select="@*"/>
            <xsl:attribute name="jobType">
                <xsl:value-of select="ancestor::order/@OrderField1"/>
                <xsl:text>-</xsl:text>
                <xsl:value-of select="@jobType"/>
            </xsl:attribute>
            <xsl:apply-templates select="node()"/>
        </xsl:copy>
    </xsl:template>
    
    <xsl:template match="@*">
        <xsl:copy-of select="."/>
    </xsl:template>
    
</xsl:stylesheet>

Open in new window

0
 

Author Comment

by:Knight905416
Comment Utility
Perfect, good job  Geert Bormans.
0
 
LVL 60

Expert Comment

by:Geert Bormans
Comment Utility
welcome
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
how to extract window origin in spring 2 57
AngularJS directive issue 6 53
XSL-FO - show results in 2 columns 5 23
XML & .net 5 16
What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now