Solved

Need XSL Transformation

Posted on 2014-04-15
5
222 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
XML & .net 5 52
Get the parent node - XMLTYPE 9 117
migrating to phpbb forum from vBulletin 4.2 3 35
ASP Classic - Read XML File inner content 10 46
Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
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, …
The viewer will learn how to count occurrences of each item in an array.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

749 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