Mani Pazhana
asked on
XSLT - process pipe delimiter file
i am using XSLT to process pipe delimited text file to xml output...
Here is my Input file (Pipe delimited)
CLIENTID|PAYMENTID|PAYEEID |PAYEEDESC RIPTION|PA YMENTDATE| PAYMENTNUM BER|PAYMEN TMETHODCOD E|PAYMENTM ETHODDESCR IPTION|TOT ALPAYMENTA MOUNT|CURR ENCYCODE|I SVOID|PAYM ENTLINENUM BER|ORIGIN ATINGINVOI CENUMBER|O RIGINATING INVOICELIN ENUMBER|IN VOICEDATE| PONUMBER|P OLINENUMBE R|DOCUMENT TYPE|DOCUM ENTCOMPANY |DOCUMENTN UMBER|PAYM ENTAMOUNT| REMARK|COM PANYID|GLA CCOUNTCODE |SUBSIDIAR Y|SUBLEDGE R|SUBLEDGE RTYPE|LEDG ERTYPE|COS TCENTER|AC COUNTBLOCK |GLACCOUNT DESCRIPTIO N|CLIENTAC COUNTCODE| WBSCODE|OR IGINATINGP ROJECTNUMB ER|ORIGINA TINGPROJEC TSYSTEM|CL IENTPONUMB ER|WORKORD ERNUMBER|W ORKORDERCO MPLETEDDAT E|WORKORDE RCREATEDDA TE|CODINGB LOCK1|CODI NGBLOCK2|C ODINGBLOCK 3|CODINGBL OCK4|CODIN GBLOCK5|CO DINGBLOCK6 |CODINGDAT E1|CODINGD ATE2
JCP|460732|237936|24 7 GLASS STOREFRONT CORP|2013-08-12T00:00:00 |1000|PK|C|-100.0|USD|0|1| INV 1 JCP|001|2013-01-01T00:00:0 0 ||0.0|PV|03200|2161050|-10 0.0|Invoic e 1 Rema |03200|50490 |001|PRO|C|AA| JCP00001M|001.50490|Cust - Lamp Replacement|J1|||||work ord 1 ||||||||||
JCP|460733|237937|A-OK SECURITY|2013-08-12T00:00: 00 |1001|PK|C|-200.0|USD|0|1| INV 2 JCP|001|2013-01-01T00:00:0 0 ||0.0|PV|03200|2161051|-20 0.0|Invoic e 2 Rema |03200|50490 |001|PRO|C|AA| JCP00004M|001.50490|Cust - Lamp Replacement|J1|||||work ord 2 ||||||||||
JCP|460734|237938|ACTION DOOR COMPANY|2013-08-12T00:00:0 0 |1002|PK|C|-300.0|USD|0|1| INV 3 JCP|001|2013-01-01T00:00:0 0 ||0.0|PV|03200|2161052|-30 0.0|Invoic e 3 Rema |03200|50490 |001|PRO|C|AA| JCP00005M|001.50490|Cust - Lamp Replacement|J1|||||work ord 3 ||||||||||
JCP|460735|237939|ALADDIN ELECTRIC INC MI|2013-08-12T00:00:00 |1003|PK|C|-400.0|USD|0|1| INV 4 JCP|001|2013-01-01T00:00:0 0 ||0.0|PV|03200|2161053|-40 0.0|Invoic e 4 Rema |03200|50490 |001|PRO|C|AA| JCP00005T|001.50490|Cust - Lamp Replacement|J1|||||work ord 4 ||||||||||
JCP|460736|237940|ALPINE ELECTRIC LODI|2013-08-12T00:00:00 |1004|PK|C|-500.0|USD|0|1| INV 5 JCP|001|2013-01-01T00:00:0 0 ||0.0|PV|03200|2161054|-50 0.0|Invoic e 5 Rema |03200|50490 |001|PRO|C|AA| JCP00007M|001.50490|Cust - Lamp Replacement|J1|||||work ord 5 ||||||||||
JCP|460737|237941|ANTHONY ROOFING A TECTA AM CO|2013-08-12T00:00:00 |1005|PK|C|-600.0|USD|0|1| INV 6 JCP|001|2013-01-01T00:00:0 0 ||0.0|PV|03200|2161055|-60 0.0|Invoic e 6 Rema |03200|50490 |001|PRO|C|AA| JCP00012M|001.50490|Cust - Lamp Replacement|J1|||||work ord 6 ||||||||||
-------------------------- ---------- -------
Here is my XSLT:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://integration.cbre.com/schemas/gcs/remittance/v1">
<xsl:output method="xml" indent="yes" omit-xml-declaration="yes" />
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<Remittance>
<xsl:for-each select="//batch/row">
<xsl:element name="ClientId">
<xsl:value-of select="CLIENTID" disable-output-escaping="y es"/>
</xsl:element>
<xsl:element name="PaymentId">
<xsl:value-of select="PAYMENTID" disable-output-escaping="y es"/>
</xsl:element>
<xsl:element name="PayeeId">
<xsl:value-of select="PAYEEID" disable-output-escaping="y es"/>
</xsl:element>
<xsl:element name="PayeeDescription">
<xsl:value-of select="PAYEEDESCRIPTION" disable-output-escaping="y es"/>
</xsl:element>
<xsl:element name="PaymentDate">
<xsl:value-of select="normalize-space(PA YMENTDATE) " disable-output-escaping="y es"/>
</xsl:element>
<xsl:element name="PaymentNumber">
<xsl:value-of select="PAYMENTNUMBER" disable-output-escaping="y es"/>
</xsl:element>
<xsl:element name="PaymentMethodCode">
<xsl:value-of select="PAYMENTMETHODCODE" disable-output-escaping="y es"/>
</xsl:element>
<xsl:element name="PaymentMethodDescrip tion">
<xsl:value-of select="PAYMENTMETHODDESCR IPTION" disable-output-escaping="y es"/>
</xsl:element>
<xsl:element name="TotalPaymentAmount">
<xsl:value-of select="TOTALPAYMENTAMOUNT " disable-output-escaping="y es"/>
</xsl:element>
<xsl:element name="CurrencyCode">
<xsl:value-of select="CURRENCYCODE" disable-output-escaping="y es"/>
</xsl:element>
<xsl:element name="IsVoid">
<xsl:value-of select="ISVOID" disable-output-escaping="y es"/>
</xsl:element>
<!-- Payment Details -->
<PaymentDetails>
<PaymentDetail>
<xsl:element name="PaymentLineNumber">
<xsl:value-of select="PAYMENTLINENUMBER" disable-output-escaping="y es"/>
</xsl:element>
<xsl:element name="OriginatingInvoiceNu mber">
<xsl:value-of select="ORIGINATINGINVOICE NUMBER" disable-output-escaping="y es"/>
</xsl:element>
<xsl:element name="OriginatingInvoiceLi neNumber">
<xsl:value-of select="ORIGINATINGINVOICE LINENUMBER " disable-output-escaping="y es"/>
</xsl:element>
<xsl:element name="InvoiceDate">
<xsl:value-of select="normalize-space(IN VOICEDATE) " disable-output-escaping="y es"/>
</xsl:element>
<xsl:element name="PONumber">
<xsl:value-of select="PONUMBER" disable-output-escaping="y es"/>
</xsl:element>
<xsl:element name="POLineNumber">
<xsl:value-of select="POLINENUMBER" disable-output-escaping="y es"/>
</xsl:element>
<xsl:element name="DocumentType">
<xsl:value-of select="DOCUMENTTYPE" disable-output-escaping="y es"/>
</xsl:element>
<xsl:element name="DocumentCompany">
<xsl:value-of select="DOCUMENTCOMPANY" disable-output-escaping="y es"/>
</xsl:element>
<xsl:element name="DocumentNumber">
<xsl:value-of select="DOCUMENTNUMBER" disable-output-escaping="y es"/>
</xsl:element>
<xsl:element name="PaymentAmount">
<xsl:value-of select="PAYMENTAMOUNT" disable-output-escaping="y es"/>
</xsl:element>
<xsl:element name="Remark">
<xsl:value-of select="normalize-space(RE MARK)" disable-output-escaping="y es"/>
</xsl:element>
<!-- GL Account -->
<GLAccount>
<xsl:element name="CompanyId">
<xsl:value-of select="COMPANYID" disable-output-escaping="y es"/>
</xsl:element>
<xsl:element name="GLAccountCode">
<xsl:value-of select="GLACCOUNTCODE" disable-output-escaping="y es"/>
</xsl:element>
<xsl:element name="Subsidiary">
<xsl:value-of select="SUBSIDIARY" disable-output-escaping="y es"/>
</xsl:element>
<xsl:element name="SubLedger">
<xsl:value-of select="SUBLEDGER" disable-output-escaping="y es"/>
</xsl:element>
<xsl:element name="SubLedgerType">
<xsl:value-of select="SUBLEDGERTYPE" disable-output-escaping="y es"/>
</xsl:element>
<xsl:element name="CostCenter">
<xsl:value-of select="normalize-space(CO STCENTER)" disable-output-escaping="y es"/>
</xsl:element>
<xsl:element name="AccountBlock">
<xsl:value-of select="ACCOUNTBLOCK" disable-output-escaping="y es"/>
</xsl:element>
<xsl:element name="GLAccountDescription ">
<xsl:value-of select="GLACCOUNTDESCRIPTI ON" disable-output-escaping="y es"/>
</xsl:element>
<xsl:element name="ClientAccountCode">
<xsl:value-of select="CLIENTACCOUNTCODE" disable-output-escaping="y es"/>
</xsl:element>
</GLAccount>
<!-- Additional Coding -->
<AdditionalCoding>
<xsl:element name="WBSCode">
<xsl:value-of select="WBSCode" disable-output-escaping="y es"/>
</xsl:element>
<xsl:element name="OriginatingProjectNu mber">
<xsl:value-of select="ORIGINATINGPROJECT NUMBER" disable-output-escaping="y es"/>
</xsl:element>
<xsl:element name="OriginatingProjectSy stem">
<xsl:value-of select="ORIGINATINGPROJECT SYSTEM" disable-output-escaping="y es"/>
</xsl:element>
<xsl:element name="ClientPONumber">
<xsl:value-of select="CLIENTPONUMBER" disable-output-escaping="y es"/>
</xsl:element>
<xsl:element name="WorkOrderNumber">
<xsl:value-of select="WORKORDERNUMBER" disable-output-escaping="y es"/>
</xsl:element>
<xsl:element name="WorkOrderCompletedDa te">
<xsl:value-of select="normalize-space(WO RKORDERCOM PLETEDDATE )" disable-output-escaping="y es"/>
</xsl:element>
<xsl:element name="WorkOrderCreatedDate ">
<xsl:value-of select="normalize-space(WO RKORDERCRE ATEDDATE)" disable-output-escaping="y es"/>
</xsl:element>
<xsl:element name="CodingBlock1">
<xsl:value-of select="CODINGBLOCK1" disable-output-escaping="y es"/>
</xsl:element>
<xsl:element name="CodingBlock2">
<xsl:value-of select="CODINGBLOCK2" disable-output-escaping="y es"/>
</xsl:element>
<xsl:element name="CodingBlock3">
<xsl:value-of select="CODINGBLOCK3" disable-output-escaping="y es"/>
</xsl:element>
<xsl:element name="CodingBlock4">
<xsl:value-of select="CODINGBLOCK4" disable-output-escaping="y es"/>
</xsl:element>
<xsl:element name="CodingBlock5">
<xsl:value-of select="CODINGBLOCK5" disable-output-escaping="y es"/>
</xsl:element>
<xsl:element name="CodingBlock6">
<xsl:value-of select="CODINGBLOCK6" disable-output-escaping="y es"/>
</xsl:element>
<xsl:element name="CodingDate1">
<xsl:value-of select="normalize-space(CO DINGDATE1) " disable-output-escaping="y es"/>
</xsl:element>
<xsl:element name="CodingDate2">
<xsl:value-of select="normalize-space(CO DINGDATE2) " disable-output-escaping="y es"/>
</xsl:element>
</AdditionalCoding>
</PaymentDetail>
</PaymentDetails>
</xsl:for-each>
</Remittance>
</xsl:template>
</xsl:stylesheet>
-------------------------- ----------
i am getting this error:
XmlException
------------
Data at the root level is invalid. Line 1, position 1.
Any Idea?
Thanks
Here is my Input file (Pipe delimited)
CLIENTID|PAYMENTID|PAYEEID
JCP|460732|237936|24 7 GLASS STOREFRONT CORP|2013-08-12T00:00:00 |1000|PK|C|-100.0|USD|0|1|
JCP|460733|237937|A-OK SECURITY|2013-08-12T00:00:
JCP|460734|237938|ACTION DOOR COMPANY|2013-08-12T00:00:0
JCP|460735|237939|ALADDIN ELECTRIC INC MI|2013-08-12T00:00:00 |1003|PK|C|-400.0|USD|0|1|
JCP|460736|237940|ALPINE ELECTRIC LODI|2013-08-12T00:00:00 |1004|PK|C|-500.0|USD|0|1|
JCP|460737|237941|ANTHONY ROOFING A TECTA AM CO|2013-08-12T00:00:00 |1005|PK|C|-600.0|USD|0|1|
--------------------------
Here is my XSLT:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://integration.cbre.com/schemas/gcs/remittance/v1">
<xsl:output method="xml" indent="yes" omit-xml-declaration="yes"
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<Remittance>
<xsl:for-each select="//batch/row">
<xsl:element name="ClientId">
<xsl:value-of select="CLIENTID" disable-output-escaping="y
</xsl:element>
<xsl:element name="PaymentId">
<xsl:value-of select="PAYMENTID" disable-output-escaping="y
</xsl:element>
<xsl:element name="PayeeId">
<xsl:value-of select="PAYEEID" disable-output-escaping="y
</xsl:element>
<xsl:element name="PayeeDescription">
<xsl:value-of select="PAYEEDESCRIPTION" disable-output-escaping="y
</xsl:element>
<xsl:element name="PaymentDate">
<xsl:value-of select="normalize-space(PA
</xsl:element>
<xsl:element name="PaymentNumber">
<xsl:value-of select="PAYMENTNUMBER" disable-output-escaping="y
</xsl:element>
<xsl:element name="PaymentMethodCode">
<xsl:value-of select="PAYMENTMETHODCODE"
</xsl:element>
<xsl:element name="PaymentMethodDescrip
<xsl:value-of select="PAYMENTMETHODDESCR
</xsl:element>
<xsl:element name="TotalPaymentAmount">
<xsl:value-of select="TOTALPAYMENTAMOUNT
</xsl:element>
<xsl:element name="CurrencyCode">
<xsl:value-of select="CURRENCYCODE" disable-output-escaping="y
</xsl:element>
<xsl:element name="IsVoid">
<xsl:value-of select="ISVOID" disable-output-escaping="y
</xsl:element>
<!-- Payment Details -->
<PaymentDetails>
<PaymentDetail>
<xsl:element name="PaymentLineNumber">
<xsl:value-of select="PAYMENTLINENUMBER"
</xsl:element>
<xsl:element name="OriginatingInvoiceNu
<xsl:value-of select="ORIGINATINGINVOICE
</xsl:element>
<xsl:element name="OriginatingInvoiceLi
<xsl:value-of select="ORIGINATINGINVOICE
</xsl:element>
<xsl:element name="InvoiceDate">
<xsl:value-of select="normalize-space(IN
</xsl:element>
<xsl:element name="PONumber">
<xsl:value-of select="PONUMBER" disable-output-escaping="y
</xsl:element>
<xsl:element name="POLineNumber">
<xsl:value-of select="POLINENUMBER" disable-output-escaping="y
</xsl:element>
<xsl:element name="DocumentType">
<xsl:value-of select="DOCUMENTTYPE" disable-output-escaping="y
</xsl:element>
<xsl:element name="DocumentCompany">
<xsl:value-of select="DOCUMENTCOMPANY" disable-output-escaping="y
</xsl:element>
<xsl:element name="DocumentNumber">
<xsl:value-of select="DOCUMENTNUMBER" disable-output-escaping="y
</xsl:element>
<xsl:element name="PaymentAmount">
<xsl:value-of select="PAYMENTAMOUNT" disable-output-escaping="y
</xsl:element>
<xsl:element name="Remark">
<xsl:value-of select="normalize-space(RE
</xsl:element>
<!-- GL Account -->
<GLAccount>
<xsl:element name="CompanyId">
<xsl:value-of select="COMPANYID" disable-output-escaping="y
</xsl:element>
<xsl:element name="GLAccountCode">
<xsl:value-of select="GLACCOUNTCODE" disable-output-escaping="y
</xsl:element>
<xsl:element name="Subsidiary">
<xsl:value-of select="SUBSIDIARY" disable-output-escaping="y
</xsl:element>
<xsl:element name="SubLedger">
<xsl:value-of select="SUBLEDGER" disable-output-escaping="y
</xsl:element>
<xsl:element name="SubLedgerType">
<xsl:value-of select="SUBLEDGERTYPE" disable-output-escaping="y
</xsl:element>
<xsl:element name="CostCenter">
<xsl:value-of select="normalize-space(CO
</xsl:element>
<xsl:element name="AccountBlock">
<xsl:value-of select="ACCOUNTBLOCK" disable-output-escaping="y
</xsl:element>
<xsl:element name="GLAccountDescription
<xsl:value-of select="GLACCOUNTDESCRIPTI
</xsl:element>
<xsl:element name="ClientAccountCode">
<xsl:value-of select="CLIENTACCOUNTCODE"
</xsl:element>
</GLAccount>
<!-- Additional Coding -->
<AdditionalCoding>
<xsl:element name="WBSCode">
<xsl:value-of select="WBSCode" disable-output-escaping="y
</xsl:element>
<xsl:element name="OriginatingProjectNu
<xsl:value-of select="ORIGINATINGPROJECT
</xsl:element>
<xsl:element name="OriginatingProjectSy
<xsl:value-of select="ORIGINATINGPROJECT
</xsl:element>
<xsl:element name="ClientPONumber">
<xsl:value-of select="CLIENTPONUMBER" disable-output-escaping="y
</xsl:element>
<xsl:element name="WorkOrderNumber">
<xsl:value-of select="WORKORDERNUMBER" disable-output-escaping="y
</xsl:element>
<xsl:element name="WorkOrderCompletedDa
<xsl:value-of select="normalize-space(WO
</xsl:element>
<xsl:element name="WorkOrderCreatedDate
<xsl:value-of select="normalize-space(WO
</xsl:element>
<xsl:element name="CodingBlock1">
<xsl:value-of select="CODINGBLOCK1" disable-output-escaping="y
</xsl:element>
<xsl:element name="CodingBlock2">
<xsl:value-of select="CODINGBLOCK2" disable-output-escaping="y
</xsl:element>
<xsl:element name="CodingBlock3">
<xsl:value-of select="CODINGBLOCK3" disable-output-escaping="y
</xsl:element>
<xsl:element name="CodingBlock4">
<xsl:value-of select="CODINGBLOCK4" disable-output-escaping="y
</xsl:element>
<xsl:element name="CodingBlock5">
<xsl:value-of select="CODINGBLOCK5" disable-output-escaping="y
</xsl:element>
<xsl:element name="CodingBlock6">
<xsl:value-of select="CODINGBLOCK6" disable-output-escaping="y
</xsl:element>
<xsl:element name="CodingDate1">
<xsl:value-of select="normalize-space(CO
</xsl:element>
<xsl:element name="CodingDate2">
<xsl:value-of select="normalize-space(CO
</xsl:element>
</AdditionalCoding>
</PaymentDetail>
</PaymentDetails>
</xsl:for-each>
</Remittance>
</xsl:template>
</xsl:stylesheet>
--------------------------
i am getting this error:
XmlException
------------
Data at the root level is invalid. Line 1, position 1.
Any Idea?
Thanks
ASKER
can you please provide me sample code?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
google for " pipe delimited to xml converter "
or import in excel and export as xml
or import in excel and export as xml
ASKER
Thanks.
ASKER
Here is my issue:
Remark tag is having some issue by wrapping into two lines... (we are seeing CR LF in the output)
Here is the Input XMl:
<root xmlns="http://integration.cbre.com/schemas/gcs/batchinvoice/v2">
<Invoice xmlns:common="http://integration.cbre.com/schemas/gcs/common/v1">
<ClientId>ATT</ClientId>
<OriginatingInvoiceId>1970 </Originat ingInvoice Id>
<VendorId>242354</VendorId >
<AlternativeVendorId>PRV-1 3-1307</Al ternativeV endorId>
<VendorInvoiceNumber>13-80 41</Vendor InvoiceNum ber>
<InvoiceDate>2013-08-08T00 :00:00</In voiceDate>
<InvoiceReceiveDate>2013-0 8-15T00:00 :00</Invoi ceReceiveD ate>
<GLDate>2013-08-21T20:53:0 3.81-05:00 </GLDate>
<Remark>Please repair torn and worn carpet squares on the sales floor.
972-409-0026</Remark>
<TotalInvoiceAmount>239.23 </TotalInv oiceAmount >
<CurrencyCode>USD</Currenc yCode>
<StatusCode>
<common:Code>Authorized</c ommon:Code >
<common:Description>Author ized</comm on:Descrip tion>
</StatusCode>
<ClientApprovalNumber>1000 119702</Cl ientApprov alNumber>
<InvoiceSource>COR</Invoic eSource>
<NumberOfLines>3</NumberOf Lines>
<InvoiceLineItems>
<InvoiceLineItem>
<OriginatingInvoiceLineID> 4637</Orig inatingInv oiceLineID >
<POLineNumber>34</POLineNu mber>
<LineItemDescription>Repla ce case of carpet tiles on sales floor. 1 tech 2 hrs 2013-08-08T00:00:00</LineI temDescrip tion>
<LocationId>ATR002037</Loc ationId>
<BuildingName>7800 N MACARTHUR BLVD SPACE#17</BuildingName>
<LineItemAmount>76.000000< /LineItemA mount>
<GLAccount>
<CompanyId>51765</CompanyI d>
<GLAccountCode>51765</GLAc countCode>
<AccountBlock>51765</Accou ntBlock>
<GLAccountDescription>5176 5</GLAccou ntDescript ion>
</GLAccount>
<AdditionalCoding>
<ClientPONumber />
<WorkOrderNumber>203700000 1</WorkOrd erNumber>
<WorkOrderCompletedDate>20 13-08-19T1 6:12:38</W orkOrderCo mpletedDat e>
<WorkOrderCreatedDate>2013 -08-01T12: 49:00</Wor kOrderCrea tedDate>
<CodingBlock1>Labor</Codin gBlock1>
<CodingBlock2>Carpet Replace</CodingBlock2>
<CodingBlock4>Replace case of carpet tiles on sales floor. 1 tech 2 hrs</CodingBlock4>
<CodingBlock5>Flooring</Co dingBlock5 >
</AdditionalCoding>
</InvoiceLineItem>
<InvoiceLineItem>
<OriginatingInvoiceLineID> 4638</Orig inatingInv oiceLineID >
<POLineNumber>35</POLineNu mber>
<LineItemDescription>carpe t, glue</LineItemDescription>
<LocationId>ATR002037</Loc ationId>
<BuildingName>7800 N MACARTHUR BLVD SPACE#17</BuildingName>
<LineItemAmount>145.000000 </LineItem Amount>
<GLAccount>
<CompanyId>51765</CompanyI d>
<GLAccountCode>51765</GLAc countCode>
<AccountBlock>51765</Accou ntBlock>
<GLAccountDescription>5176 5</GLAccou ntDescript ion>
</GLAccount>
<AdditionalCoding>
<ClientPONumber />
<WorkOrderNumber>203700000 1</WorkOrd erNumber>
<WorkOrderCompletedDate>20 13-08-19T1 6:12:38</W orkOrderCo mpletedDat e>
<WorkOrderCreatedDate>2013 -08-01T12: 49:00</Wor kOrderCrea tedDate>
<CodingBlock1>Materials</C odingBlock 1>
<CodingBlock2>Carpet Replace</CodingBlock2>
<CodingBlock4>carpet, glue</CodingBlock4>
<CodingBlock5>Flooring</Co dingBlock5 >
</AdditionalCoding>
</InvoiceLineItem>
<InvoiceLineItem>
<OriginatingInvoiceLineID> 4636</Orig inatingInv oiceLineID >
<POLineNumber>36</POLineNu mber>
<LineItemDescription>Tax</ LineItemDe scription>
<LocationId>ATR002037</Loc ationId>
<BuildingName>7800 N MACARTHUR BLVD SPACE#17</BuildingName>
<LineItemAmount>18.230000< /LineItemA mount>
<GLAccount>
<CompanyId>51765</CompanyI d>
<GLAccountCode>51765</GLAc countCode>
<AccountBlock>51765</Accou ntBlock>
<GLAccountDescription>5176 5</GLAccou ntDescript ion>
</GLAccount>
<AdditionalCoding>
<ClientPONumber />
<WorkOrderNumber>203700000 1</WorkOrd erNumber>
<WorkOrderCompletedDate>20 13-08-19T1 6:12:38</W orkOrderCo mpletedDat e>
<WorkOrderCreatedDate>2013 -08-01T12: 49:00</Wor kOrderCrea tedDate>
<CodingBlock1>Tax</CodingB lock1>
<CodingBlock2>Carpet Replace</CodingBlock2>
<CodingBlock4>Tax</CodingB lock4>
<CodingBlock5>Flooring</Co dingBlock5 >
</AdditionalCoding>
</InvoiceLineItem>
</InvoiceLineItems>
</Invoice>
</root>
-------------------------- ---------- ---------- ------
XSLT:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://integration.cbre.com/schemas/gcs/batchinvoice/v2">
<!--Client: AT&T V1
Corrigo XML File to Invoice CIM format.
Version 1.0 Amy Force Initial Version of the file based on batch/row/ nodes in file
7/9/2013 Amy Force Pickup and compare against invoice (root)
7/23/2013 Amy Force REST of batch of Invoices-->
<xsl:output method="xml" indent="yes" />
<xsl:variable name="new-root-node">
<xsl:text>root</xsl:text>
</xsl:variable>
<!-- ITP is expecting multiple rows to be wrapped with batch -->
<xsl:template match="/*">
<!-- Create a new element with new node name. -->
<xsl:element name="{$new-root-node}">
<!-- Copy all children of the root node. -->
<xsl:copy-of select="*" />
</xsl:element>
</xsl:template>
</xsl:stylesheet>
-------------------------- ----
can we fix the wrapping issue <Remark> </Remark> in the XSLT?
Thanks
Remark tag is having some issue by wrapping into two lines... (we are seeing CR LF in the output)
Here is the Input XMl:
<root xmlns="http://integration.cbre.com/schemas/gcs/batchinvoice/v2">
<Invoice xmlns:common="http://integration.cbre.com/schemas/gcs/common/v1">
<ClientId>ATT</ClientId>
<OriginatingInvoiceId>1970
<VendorId>242354</VendorId
<AlternativeVendorId>PRV-1
<VendorInvoiceNumber>13-80
<InvoiceDate>2013-08-08T00
<InvoiceReceiveDate>2013-0
<GLDate>2013-08-21T20:53:0
<Remark>Please repair torn and worn carpet squares on the sales floor.
972-409-0026</Remark>
<TotalInvoiceAmount>239.23
<CurrencyCode>USD</Currenc
<StatusCode>
<common:Code>Authorized</c
<common:Description>Author
</StatusCode>
<ClientApprovalNumber>1000
<InvoiceSource>COR</Invoic
<NumberOfLines>3</NumberOf
<InvoiceLineItems>
<InvoiceLineItem>
<OriginatingInvoiceLineID>
<POLineNumber>34</POLineNu
<LineItemDescription>Repla
<LocationId>ATR002037</Loc
<BuildingName>7800 N MACARTHUR BLVD SPACE#17</BuildingName>
<LineItemAmount>76.000000<
<GLAccount>
<CompanyId>51765</CompanyI
<GLAccountCode>51765</GLAc
<AccountBlock>51765</Accou
<GLAccountDescription>5176
</GLAccount>
<AdditionalCoding>
<ClientPONumber />
<WorkOrderNumber>203700000
<WorkOrderCompletedDate>20
<WorkOrderCreatedDate>2013
<CodingBlock1>Labor</Codin
<CodingBlock2>Carpet Replace</CodingBlock2>
<CodingBlock4>Replace case of carpet tiles on sales floor. 1 tech 2 hrs</CodingBlock4>
<CodingBlock5>Flooring</Co
</AdditionalCoding>
</InvoiceLineItem>
<InvoiceLineItem>
<OriginatingInvoiceLineID>
<POLineNumber>35</POLineNu
<LineItemDescription>carpe
<LocationId>ATR002037</Loc
<BuildingName>7800 N MACARTHUR BLVD SPACE#17</BuildingName>
<LineItemAmount>145.000000
<GLAccount>
<CompanyId>51765</CompanyI
<GLAccountCode>51765</GLAc
<AccountBlock>51765</Accou
<GLAccountDescription>5176
</GLAccount>
<AdditionalCoding>
<ClientPONumber />
<WorkOrderNumber>203700000
<WorkOrderCompletedDate>20
<WorkOrderCreatedDate>2013
<CodingBlock1>Materials</C
<CodingBlock2>Carpet Replace</CodingBlock2>
<CodingBlock4>carpet, glue</CodingBlock4>
<CodingBlock5>Flooring</Co
</AdditionalCoding>
</InvoiceLineItem>
<InvoiceLineItem>
<OriginatingInvoiceLineID>
<POLineNumber>36</POLineNu
<LineItemDescription>Tax</
<LocationId>ATR002037</Loc
<BuildingName>7800 N MACARTHUR BLVD SPACE#17</BuildingName>
<LineItemAmount>18.230000<
<GLAccount>
<CompanyId>51765</CompanyI
<GLAccountCode>51765</GLAc
<AccountBlock>51765</Accou
<GLAccountDescription>5176
</GLAccount>
<AdditionalCoding>
<ClientPONumber />
<WorkOrderNumber>203700000
<WorkOrderCompletedDate>20
<WorkOrderCreatedDate>2013
<CodingBlock1>Tax</CodingB
<CodingBlock2>Carpet Replace</CodingBlock2>
<CodingBlock4>Tax</CodingB
<CodingBlock5>Flooring</Co
</AdditionalCoding>
</InvoiceLineItem>
</InvoiceLineItems>
</Invoice>
</root>
--------------------------
XSLT:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://integration.cbre.com/schemas/gcs/batchinvoice/v2">
<!--Client: AT&T V1
Corrigo XML File to Invoice CIM format.
Version 1.0 Amy Force Initial Version of the file based on batch/row/ nodes in file
7/9/2013 Amy Force Pickup and compare against invoice (root)
7/23/2013 Amy Force REST of batch of Invoices-->
<xsl:output method="xml" indent="yes" />
<xsl:variable name="new-root-node">
<xsl:text>root</xsl:text>
</xsl:variable>
<!-- ITP is expecting multiple rows to be wrapped with batch -->
<xsl:template match="/*">
<!-- Create a new element with new node name. -->
<xsl:element name="{$new-root-node}">
<!-- Copy all children of the root node. -->
<xsl:copy-of select="*" />
</xsl:element>
</xsl:template>
</xsl:stylesheet>
--------------------------
can we fix the wrapping issue <Remark> </Remark> in the XSLT?
Thanks
ASKER
Gertone,
do you want me to post as new question?
Thanks
do you want me to post as new question?
Thanks
I saw the new question first,
you might need to explain what exactly you want
you might need to explain what exactly you want
ASKER
Thanks
welcome
ASKER
try to pass it in as a parameter