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</PaymentId>
  <PayeeId>100296</PayeeId>
  <PayeeDescription>"A&amp;A MAINTENANCE ENTERPRISE INC"</PayeeDescription>
  <PaymentDate>2006-01-04T00:00:00</PaymentDate>
  <PaymentNumber>35653</PaymentNumber>
  <PaymentMethodCode>PK</PaymentMethodCode>
  <PaymentMethodDescription>C</PaymentMethodDescription>
  <TotalPaymentAmount>-10705.35</TotalPaymentAmount>
  <CurrencyCode>USD</CurrencyCode>
  <IsVoid>0</IsVoid>
  <PaymentDetails>
    <PaymentDetail>
      <PaymentLineNumber>1</PaymentLineNumber>
      <OriginatingInvoiceNumber>43538</OriginatingInvoiceNumber>
      <OriginatingInvoiceLineNumber>001</OriginatingInvoiceLineNumber>
      <InvoiceDate>2005-12-01T00:00:00</InvoiceDate>
      <PONumber></PONumber>
      <POLineNumber>0.0</POLineNumber>
      <DocumentType>PV</DocumentType>
      <DocumentCompany>00100</DocumentCompany>
      <DocumentNumber>138181</DocumentNumber>
      <PaymentAmount>-10705.35</PaymentAmount>
      <Remark>"DECEMBER JANITORIAL CONTRACT "</Remark>
      <GLAccount>
        <CompanyId>00100</CompanyId>
        <GLAccountCode>50200 </GLAccountCode>
        <Subsidiary></Subsidiary>
        <SubLedger>1056</SubLedger>
        <SubLedgerType>C</SubLedgerType>
        <CostCenter>560090-06</CostCenter>
        <AccountBlock>.50200</AccountBlock>
        <GLAccountDescription>"Contract Cleaning Service"</GLAccountDescription>
        <ClientAccountCode>6628</ClientAccountCode>
      </GLAccount>
      <AdditionalCoding>
        <WBSCode></WBSCode>
        <OriginatingProjectNumber></OriginatingProjectNumber>
        <OriginatingProjectSystem></OriginatingProjectSystem>
        <ClientPONumber></ClientPONumber>
        <WorkOrderNumber>444343</WorkOrderNumber>
        <WorkOrderCompletedDate></WorkOrderCompletedDate>
        <WorkOrderCreatedDate></WorkOrderCreatedDate>
        <CodingBlock1></CodingBlock1>
        <CodingBlock2></CodingBlock2>
        <CodingBlock3></CodingBlock3>
        <CodingBlock4></CodingBlock4>
        <CodingBlock5></CodingBlock5>
        <CodingBlock6></CodingBlock6>
        <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/PaymentDetails/PaymentDetail/AdditionalCoding/WorkOrderNumber" />
                        </xsl:attribute>

        <xsl:attribute name="AmountPaid">
          <xsl:value-of select="Remittance/PaymentDetails/PaymentDetail/PaymentAmount" />
        </xsl:attribute>

        <xsl:attribute name="CheckNumber">
          <xsl:value-of select="Remittance/PaymentNumber" />
        </xsl:attribute>

        <xsl:attribute name="PaidDate">
          <xsl:value-of select="Remittance/PaymentDate" />
        </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
LVL 8
mani_saiAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Geert BormansInformation ArchitectCommented:
you need to bind the default namespace of the input to a prefix
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:PaymentDetails/won:PaymentDetail/won:AdditionalCoding/won:WorkOrderNumber" />
0
mani_saiAuthor Commented:
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:PaymentDetail/won:AdditionalCoding/won:WorkOrderNumber" />
                        </xsl:attribute>

        <xsl:attribute name="AmountPaid">
          <xsl:value-of select="won:Remittance/won:PaymentDetails/won:PaymentDetail/won:PaymentAmount" />
        </xsl:attribute>

        <xsl:attribute name="CheckNumber">
          <xsl:value-of select="won:Remittance/won:PaymentNumber" />
        </xsl:attribute>

        <xsl:attribute name="PaidDate">
          <xsl:value-of select="won:Remittance/won:PaymentDate" />
        </xsl:attribute>      
       
                  </WONPAY>
            </root>
      </xsl:template>
 
</xsl:stylesheet>
0
Geert BormansInformation ArchitectCommented:
I see, I pasted in the wrong namespace uri

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:cbre="http://integration.cbre.com/schemas/gcs/remittance/v1">
    
    
    <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="cbre:Remittance/cbre:PaymentDetails/cbre:PaymentDetail/cbre:AdditionalCoding/cbre:WorkOrderNumber" />
                </xsl:attribute>
                
                <xsl:attribute name="AmountPaid">
                    <xsl:value-of select="cbre:Remittance/cbre:PaymentDetails/cbre:PaymentDetail/cbre:PaymentAmount" />
                </xsl:attribute>
                
                <xsl:attribute name="CheckNumber">
                    <xsl:value-of select="cbre:Remittance/cbre:PaymentNumber" />
                </xsl:attribute>
                
                <xsl:attribute name="PaidDate">
                    <xsl:value-of select="cbre:Remittance/cbre:PaymentDate" />
                </xsl:attribute>       
                
            </WONPAY>
        </root>
    </xsl:template>
    
</xsl:stylesheet> 

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

mani_saiAuthor Commented:
It worked. Thanks
0
mani_saiAuthor Commented:
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/XML/Q_28214261.html

Although i accepted the answer... i want your feedback to this question...

Thanks
0
Geert BormansInformation ArchitectCommented:
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
0
mani_saiAuthor Commented:
Thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
XML

From novice to tech pro — start learning today.