Solved

Basic Question

Posted on 2002-07-20
5
197 Views
Last Modified: 2008-01-09
Hello
How can i transform this XML document ?

"<INV INvID="1" INVNO="inv1" CustName="sdsd" CustNo="0909"><INVDT ItemCode="12" Pack="12" Descr="12"/></INV>"

to this format

<data>
<JF_JOB_CARD>PACKING -afpD:\JetForm\Central\Samples\Exprint\forms -alpD:\JetForm\Central\Samples\Exprint\logos </JF_JOB_CARD>
<INVID>1</INVID>
<InvNO>abc2</InvNO>
<CustName>abc3</CustName>
<CustNo>abc4</CustName>
<ITEMCODE>12</ItemCODE>
<PACK>12</Pack>
..

</data>
any help,sugesstion,clue is reuired
thanks in advance
.
0
Comment
Question by:shahbax
  • 2
5 Comments
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 7166847
This would be simpler if elements were spelled the same:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
     <xsl:output method="xml" encoding="UTF-8" indent="yes"/>

     <xsl:template match="/INV">
          <data>
               <JF_JOB_CARD>PACKING -afpD:\JetForm\Central\Samples\Exprint\forms -alpD:\JetForm\Central\Samples\Exprint\logos </JF_JOB_CARD>
               <INVID>
                    <xsl:value-of select="@INvID"/>
               </INVID>
               <InvNO>
                    <xsl:value-of select="@INVNO"/>
               </InvNO>
               <CustName>
                    <xsl:value-of select="@CustName"/>
               </CustName>
               <CustNo>
                    <xsl:value-of select="@CustNo"/>
               </CustNo>
               <ITEMCODE>
                    <xsl:value-of select="INVDT/@ItemCode"/>
               </ITEMCODE>
               <PACK>
                    <xsl:value-of select="INVDT/@Pack"/>
               </PACK>
          </data>
     </xsl:template>
</xsl:stylesheet>

Anthony
0
 

Author Comment

by:shahbax
ID: 7167523
Hi,

Thanks for the help..but my problem is that i hv to the source XML file is generated from SQL server andi hv to put this XML file for another location for some processing ,how can automatically convert the source XML file format to target format..i can embed my own tag in the source XML file for examlple <JF_JOB_CARD>..and i can give the path of XML in ..but there is no browser involement so how can i transfrom it to target XML format
Thanks in advance

Ragrads,
Shahbaz
0
 
LVL 75

Accepted Solution

by:
Anthony Perkins earned 50 total points
ID: 7168149
>>that i hv to the source XML file is generated from SQL server<<
Try posting this code and perhaps we can coerce it into the format:
<data>
<JF_JOB_CARD>PACKING -afpD:\JetForm\Central\Samples\Exprint\forms -alpD:\JetForm\Central\Samples\Exprint\logos </JF_JOB_CARD>
<INVID>1</INVID>
<InvNO>abc2</InvNO>
<CustName>abc3</CustName>
<CustNo>abc4</CustName>
<ITEMCODE>12</ItemCODE>
<PACK>12</Pack>
..

</data>
Without transforming it after SQL Server returns the XML document.

Anthony
0

Featured Post

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

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

Suggested Solutions

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, …
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

860 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