Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Need XSL Transformation

Posted on 2014-04-15
5
Medium Priority
?
233 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 2000 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
Suggested Courses

916 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