Mani Pazhana
asked on
XSLT - Attributes not getting data
XSLT - Attributes not getting data...
Here is my Input XML:
<Remittance xmlns="http://integration.cbre.com/schemas/gcs/remittance/v1">
<ClientId>HTZ</ClientId>
<PaymentId>157376</Payment Id>
<PayeeId>100296</PayeeId>
<PayeeDescription>"A&A MAINTENANCE ENTERPRISE INC"</PayeeDescription>
<PaymentDate>2006-01-04T00 :00:00</Pa ymentDate>
<PaymentNumber>35653</Paym entNumber>
<PaymentMethodCode>PK</Pay mentMethod Code>
<PaymentMethodDescription> C</Payment MethodDesc ription>
<TotalPaymentAmount>-10705 .35</Total PaymentAmo unt>
<CurrencyCode>USD</Currenc yCode>
<IsVoid>0</IsVoid>
<PaymentDetails>
<PaymentDetail>
<PaymentLineNumber>1</Paym entLineNum ber>
<OriginatingInvoiceNumber> 43538</Ori ginatingIn voiceNumbe r>
<OriginatingInvoiceLineNum ber>001</O riginating InvoiceLin eNumber>
<InvoiceDate>2005-12-01T00 :00:00</In voiceDate>
<PONumber></PONumber>
<POLineNumber>0.0</POLineN umber>
<DocumentType>PV</Document Type>
<DocumentCompany>00100</Do cumentComp any>
<DocumentNumber>138181</Do cumentNumb er>
<PaymentAmount>-10705.35</ PaymentAmo unt>
<Remark>"DECEMBER JANITORIAL CONTRACT "</Remark>
<GLAccount>
<CompanyId>00100</CompanyI d>
<GLAccountCode>50200 </GLAccountCode>
<Subsidiary></Subsidiary>
<SubLedger>1056</SubLedger >
<SubLedgerType>C</SubLedge rType>
<CostCenter>560090-06</Cos tCenter>
<AccountBlock>.50200</Acco untBlock>
<GLAccountDescription>"Con tract Cleaning Service"</GLAccountDescrip tion>
<ClientAccountCode>6628</C lientAccou ntCode>
</GLAccount>
<AdditionalCoding>
<WBSCode></WBSCode>
<OriginatingProjectNumber> </Originat ingProject Number>
<OriginatingProjectSystem> </Originat ingProject System>
<ClientPONumber></ClientPO Number>
<WorkOrderNumber>444343</W orkOrderNu mber>
<WorkOrderCompletedDate></ WorkOrderC ompletedDa te>
<WorkOrderCreatedDate></Wo rkOrderCre atedDate>
<CodingBlock1></CodingBloc k1>
<CodingBlock2></CodingBloc k2>
<CodingBlock3></CodingBloc k3>
<CodingBlock4></CodingBloc k4>
<CodingBlock5></CodingBloc k5>
<CodingBlock6></CodingBloc k6>
<CodingDate1></CodingDate1 >
<CodingDate2></CodingDate2 >
</AdditionalCoding>
</PaymentDetail>
</PaymentDetails>
</Remittance>
-------------------------- ---------- -
XSLT:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://corrigo.com/wonpay.xsd">
<xsl:output method="xml" indent="yes" />
<!-- ITP is expecting multiple rows to be wrapped with batch -->
<xsl:template match="/">
<!-- Create new root -->
<root>
<!-- Copy all children of the root node. -->
<WONPAY>
<xsl:attribute name="WorkOrderNumber">
<xsl:value-of select="Remittance/Payment Details/Pa ymentDetai l/Addition alCoding/W orkOrderNu mber" />
</xsl:attribute>
<xsl:attribute name="AmountPaid">
<xsl:value-of select="Remittance/Payment Details/Pa ymentDetai l/PaymentA mount" />
</xsl:attribute>
<xsl:attribute name="CheckNumber">
<xsl:value-of select="Remittance/Payment Number" />
</xsl:attribute>
<xsl:attribute name="PaidDate">
<xsl:value-of select="Remittance/Payment Date" />
</xsl:attribute>
</WONPAY>
</root>
</xsl:template>
</xsl:stylesheet>
-------------------------- -----
My output:
<?xml version="1.0" encoding="utf-8"?>
<root xmlns="http://corrigo.com/wonpay.xsd">
<WONPAY WorkOrderNumber="" AmountPaid="" CheckNumber="" PaidDate="" />
</root>
-------------------------- ---
in my ouptu i am not seeing data in the attributes...
any idea?
Thanks
Here is my Input XML:
<Remittance xmlns="http://integration.cbre.com/schemas/gcs/remittance/v1">
<ClientId>HTZ</ClientId>
<PaymentId>157376</Payment
<PayeeId>100296</PayeeId>
<PayeeDescription>"A&A
<PaymentDate>2006-01-04T00
<PaymentNumber>35653</Paym
<PaymentMethodCode>PK</Pay
<PaymentMethodDescription>
<TotalPaymentAmount>-10705
<CurrencyCode>USD</Currenc
<IsVoid>0</IsVoid>
<PaymentDetails>
<PaymentDetail>
<PaymentLineNumber>1</Paym
<OriginatingInvoiceNumber>
<OriginatingInvoiceLineNum
<InvoiceDate>2005-12-01T00
<PONumber></PONumber>
<POLineNumber>0.0</POLineN
<DocumentType>PV</Document
<DocumentCompany>00100</Do
<DocumentNumber>138181</Do
<PaymentAmount>-10705.35</
<Remark>"DECEMBER JANITORIAL CONTRACT "</Remark>
<GLAccount>
<CompanyId>00100</CompanyI
<GLAccountCode>50200 </GLAccountCode>
<Subsidiary></Subsidiary>
<SubLedger>1056</SubLedger
<SubLedgerType>C</SubLedge
<CostCenter>560090-06</Cos
<AccountBlock>.50200</Acco
<GLAccountDescription>"Con
<ClientAccountCode>6628</C
</GLAccount>
<AdditionalCoding>
<WBSCode></WBSCode>
<OriginatingProjectNumber>
<OriginatingProjectSystem>
<ClientPONumber></ClientPO
<WorkOrderNumber>444343</W
<WorkOrderCompletedDate></
<WorkOrderCreatedDate></Wo
<CodingBlock1></CodingBloc
<CodingBlock2></CodingBloc
<CodingBlock3></CodingBloc
<CodingBlock4></CodingBloc
<CodingBlock5></CodingBloc
<CodingBlock6></CodingBloc
<CodingDate1></CodingDate1
<CodingDate2></CodingDate2
</AdditionalCoding>
</PaymentDetail>
</PaymentDetails>
</Remittance>
--------------------------
XSLT:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://corrigo.com/wonpay.xsd">
<xsl:output method="xml" indent="yes" />
<!-- ITP is expecting multiple rows to be wrapped with batch -->
<xsl:template match="/">
<!-- Create new root -->
<root>
<!-- Copy all children of the root node. -->
<WONPAY>
<xsl:attribute name="WorkOrderNumber">
<xsl:value-of select="Remittance/Payment
</xsl:attribute>
<xsl:attribute name="AmountPaid">
<xsl:value-of select="Remittance/Payment
</xsl:attribute>
<xsl:attribute name="CheckNumber">
<xsl:value-of select="Remittance/Payment
</xsl:attribute>
<xsl:attribute name="PaidDate">
<xsl:value-of select="Remittance/Payment
</xsl:attribute>
</WONPAY>
</root>
</xsl:template>
</xsl:stylesheet>
--------------------------
My output:
<?xml version="1.0" encoding="utf-8"?>
<root xmlns="http://corrigo.com/wonpay.xsd">
<WONPAY WorkOrderNumber="" AmountPaid="" CheckNumber="" PaidDate="" />
</root>
--------------------------
in my ouptu i am not seeing data in the attributes...
any idea?
Thanks
ASKER
Thanks...still missing something..data is not showing up..
-------------------------- -------
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:won="http://corrigo.com/wonpay.xsd">
<xsl:output method="xml" indent="yes" />
<!-- ITP is expecting multiple rows to be wrapped with batch -->
<xsl:template match="/">
<!-- Create new root -->
<root>
<!-- Copy all children of the root node. -->
<WONPAY>
<xsl:attribute name="WorkOrderNumber">
<xsl:value-of select="won:PaymentDetails /won:Payme ntDetail/w on:Additio nalCoding/ won:WorkOr derNumber" />
</xsl:attribute>
<xsl:attribute name="AmountPaid">
<xsl:value-of select="won:Remittance/won :PaymentDe tails/won: PaymentDet ail/won:Pa ymentAmoun t" />
</xsl:attribute>
<xsl:attribute name="CheckNumber">
<xsl:value-of select="won:Remittance/won :PaymentNu mber" />
</xsl:attribute>
<xsl:attribute name="PaidDate">
<xsl:value-of select="won:Remittance/won :PaymentDa te" />
</xsl:attribute>
</WONPAY>
</root>
</xsl:template>
</xsl:stylesheet>
--------------------------
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:won="http://corrigo.com/wonpay.xsd">
<xsl:output method="xml" indent="yes" />
<!-- ITP is expecting multiple rows to be wrapped with batch -->
<xsl:template match="/">
<!-- Create new root -->
<root>
<!-- Copy all children of the root node. -->
<WONPAY>
<xsl:attribute name="WorkOrderNumber">
<xsl:value-of select="won:PaymentDetails
</xsl:attribute>
<xsl:attribute name="AmountPaid">
<xsl:value-of select="won:Remittance/won
</xsl:attribute>
<xsl:attribute name="CheckNumber">
<xsl:value-of select="won:Remittance/won
</xsl:attribute>
<xsl:attribute name="PaidDate">
<xsl:value-of select="won:Remittance/won
</xsl:attribute>
</WONPAY>
</root>
</xsl:template>
</xsl:stylesheet>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
It worked. Thanks
ASKER
https://www.experts-exchange.com/questions/28214261/XSLT-Generate-CSV-file-with-CSV-extension.html
Although i accepted the answer... i want your feedback to this question...
Thanks
Although i accepted the answer... i want your feedback to this question...
Thanks
If there is a problem with z2c's advise, you need to post there.
I do not interfere in closed questions, it just confuses the database and it seems as if I want to unnecessarily correct a different expert... that is a policy issue.
I see things in the XSLT I don't necessarily like. But the advice about renaming seems correct
I do not interfere in closed questions, it just confuses the database and it seems as if I want to unnecessarily correct a different expert... that is a policy issue.
I see things in the XSLT I don't necessarily like. But the advice about renaming seems correct
ASKER
Thanks
xmlns:won="http://corrigo.com/wonpay.xsd"
in the xsl:stylesheet element
and use that prefix in all of the XPath expressions
<xsl:value-of select="won:Remittance/won