Solved

Need XSL Transformation

Posted on 2014-04-15
5
221 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
ID: 40001791
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
ID: 40001792
<?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
ID: 40001820
Perfect, good job  Geert Bormans.
0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 40001845
welcome
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

856 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