Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Basic Question

Posted on 2002-07-20
5
Medium Priority
?
201 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
[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 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 200 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

PowerShell Core for Advanced Linux Administrators

Understand advanced principals around Powershell Core with a focus on the Linux Administrator.  This course covers how to administer numerous environments across multiple platforms including Linux, Azure, AWS, and Google Cloud from a single shell instance.

Question has a verified solution.

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

The Problem How to write an Xquery that works like a SQL outer join, providing placeholders for absent data on the outer side?  I give a bit more background at the end. The situation expressed as relational data Let’s work through this.  I’ve …
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.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

730 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