?
Solved

Need XSL Transformation

Posted on 2014-04-15
5
Medium Priority
?
230 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL several years ago, it seemed like now was a good time to update it for object-oriented PHP.  This article does that, replacing as much as possible the pr…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

777 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