XSLT_SHRED_BATCH Repeating Data Elements ignored

Database
The Teradata Database channel includes discussions around advanced Teradata features such as high-performance parallel database technology, the optimizer, mixed workload management solutions, and other related technologies.

XSLT_SHRED_BATCH Repeating Data Elements ignored

When XSLT_SHRED_BATCH encounters a repeating set of elements in XML as below, it ignores the second set.  That is, I get, "PF9005 The state must match the property state entered on the appraisal" only.  I expected to get two lines of data.

 

<ns5:Decision>

<ns5:DecisionName>Determine Appraisal Compliance</ns5:DecisionName>

<ns5:Result>RED</ns5:Result>

<ns5:MessageCode>PF9005</ns5:MessageCode>

<ns5:MessageText>The state must match the property state entered on the appraisal.</ns5:MessageText>

<ns5:MessageCode>PF9003</ns5:MessageCode>

<ns5:MessageText>The postal zip code must match the Property ZIP Code entered on the appraisal.</ns5:MessageText>

</ns5:Decision>

 

Is this the expected behavior?  I need a hint as to how to extract that second line of data.

 

BTW: Altova XML Spy says the the XML is well formed and valid.  I can import the data into Excel without loss of data.

3 REPLIES
Teradata Employee

Re: XSLT_SHRED_BATCH Repeating Data Elements ignored

What does your XSLT look like? You can use xsl:for-each to handle a repeating element, but not a repeating sequence of elements (all at the same level). 

 

In other words, your document structure needs to have something like <Message> <Code> ...</Code><Text>...</Text></Message> and then you can generate a row "for each Message". 

 

 

 

Re: XSLT_SHRED_BATCH Repeating Data Elements ignored

(sorry for slow response ... not sure why I did not see your reply earlier)

 I am wondering if you are saying I should have the "for-each select" repeated at each place where I might have multiple values for a given column.

 

The shred, only having one "for each", looks like:


CALL TD_SYSXML.XSLT_SHRED_BATCH('sel id, xmldoc from adwp_work1.Input_Docs WHERE id = 3',
                 CREATEXML('<?xml version="1.0" encoding="UTF-8" ?>
                      <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
                      <xsl:template match="/">
                      <Transaction>
                       <Insert>
                        <Table>
                         <adwp_work1.LIQUID_STG_LQA>
                          <xsl:for-each select="LQABatchResultsResponse">
                           <Row>
                         <Loan_Number><xsl:value-of select="/SellerLnId"/></Loan_Number>
                        <LP_Key><xsl:value-of select="/LPKeyId"/></LP_Key>
                        <Conclusion><xsl:value-of select="/Conclusion"/></Conclusion>
                        <LPTransactionNumber><xsl:value-of select="/LPTransNo"/></LPTransactionNumber>
                        <LPSubmissionDateTime><xsl:value-of select="/LPSubDT"/></LPSubmissionDateTime>
                        <LPLoanStatus><xsl:value-of select="/LPLoanstatus"/></LPLoanStatus>
                        <LPRiskClassificationType><xsl:value-of select="/LPRiskClassType"/></LPRiskClassificationType>
                        <DataFieldName><xsl:value-of select="/DataFieldName"/></DataFieldName>
                        <LQAValue><xsl:value-of select="/LQAvalue"/></LQAValue>
                        <LPValue><xsl:value-of select="/LPvalue"/></LPValue>
                        <Conclusion2><xsl:value-of select="/Conclusion2"/></Conclusion2>
                        <MessageCode><xsl:value-of select="/MessageCode"/></MessageCode>
                        <MessageText><xsl:value-of select="/MessageText"/></MessageText>
                        <MessageCode5><xsl:value-of select="/MessageCode5"/></MessageCode5>
                        <MessageText6><xsl:value-of select="/MessageText6"/></MessageText6>
                        <Conclusion7><xsl:value-of select="/Conclusion7"/></Conclusion7>
                        <Conclusion8><xsl:value-of select="/Conclusion8"/></Conclusion8>
                        <MessageCode9><xsl:value-of select="/MessageCode9"/></MessageCode9>
                        <DecisionName><xsl:value-of select="/DecisionName"/></DecisionName>
                        <Result_Txt><xsl:value-of select="/Result"/></Result_Txt>
                        <MessageText10><xsl:value-of select="/MessageText10"/></MessageText10>
                        <BATCH_ID><xsl:value-of select="/BatchID"/></BATCH_ID>
                        <v1BatchStatus><xsl:value-of select="/BatchStatus"/></v1BatchStatus>
                        <v1BatchSubmissionDate><xsl:value-of select="/BatchSubmissionDate"/></v1BatchSubmissionDate>
                        <v1LoansEvaluatedCount><xsl:value-of select="/LoansEvaluatedCount"/></v1LoansEvaluatedCount>
                        <v1LoansSubmittedCount><xsl:value-of select="/LoansSubmittedCount"/></v1LoansSubmittedCount>
                        <v1LoansUnevaluatedCount><xsl:value-of select="/LoansUnevaluatedCount"/></v1LoansUnevaluatedCount>
                        <v1LoansValidCount><xsl:value-of select="/LoansValidCount"/></v1LoansValidCount>
                        <v1SellerNumber><xsl:value-of select="/SellerNumber"/></v1SellerNumber>
                        <v1UserSubmissionID><xsl:value-of select="/UserSubmissionID"/></v1UserSubmissionID>
                        <v3AddressLineText><xsl:value-of select="/AddressLineText"/></v3AddressLineText>
                        <v3AppraisalIdentifier><xsl:value-of select="/AppraisalIdentifier"/></v3AppraisalIdentifier>
                        <v3CityName><xsl:value-of select="/CityName"/></v3CityName>
                        <v3Conclusion11><xsl:value-of select="/Conclusion11"/></v3Conclusion11>
                        <v3DecisionName14><xsl:value-of select="/DecisionName14"/></v3DecisionName14>
                        <v3FirstName><xsl:value-of select="/FirstName"/></v3FirstName>
                        <v3FullName><xsl:value-of select="/FullName"/></v3FullName>
                        <v3IndividualFullName><xsl:value-of select="/IndividualFullName"/></v3IndividualFullName>
                        <v3LastName><xsl:value-of select="/LastName"/></v3LastName>
                        <v3LoanAmortizationPeriodCount><xsl:value-of select="/LoanAmortizationPeriodCount"/></v3LoanAmortizationPeriodCount>
                        <v3LoanAmortizationPeriodType><xsl:value-of select="/LoanAmortizationPeriodType"/></v3LoanAmortizationPeriodType>
                        <v3LoanAmortizationType><xsl:value-of select="/LoanAmortizationType"/></v3LoanAmortizationType>
                        <v3LoanProductName><xsl:value-of select="/LoanProductName"/></v3LoanProductName>
                        <v3LoanPurposeType><xsl:value-of select="/LoanPurposeType"/></v3LoanPurposeType>
                        <v3LoanTransactionIdentifier><xsl:value-of select="/LoanTransactionIdentifier"/></v3LoanTransactionIdentifier>
                        <v3LPValue4><xsl:value-of select="/LPValue4"/></v3LPValue4>
                        <v3LQAReadyFlag><xsl:value-of select="/LQAReadyFlag"/></v3LQAReadyFlag>
                        <v3LQAValue3><xsl:value-of select="/LQAValue3"/></v3LQAValue3>
                        <v3MasterCommitmentIdentifier><xsl:value-of select="/MasterCommitmentIdentifier"/></v3MasterCommitmentIdentifier>
                        <v3MasterCommitmentIdentifier12><xsl:value-of select="/MasterCommitmentIdentifier12"/></v3MasterCommitmentIdentifier12>
                        <v3MessageCode13><xsl:value-of select="/MessageCode13"/></v3MessageCode13>
                        <v3MessageText16><xsl:value-of select="/MessageText16"/></v3MessageText16>
                        <v3MortgageConformityType><xsl:value-of select="/MortgageConformityType"/></v3MortgageConformityType>
                        <v3Name><xsl:value-of select="/Name"/></v3Name>
                        <v3NoteAmount><xsl:value-of select="/NoteAmount"/></v3NoteAmount>
                        <v3NoteRatePercent><xsl:value-of select="/NoteRatePercent"/></v3NoteRatePercent>
                        <v3PostalCode><xsl:value-of select="/PostalCode"/></v3PostalCode>
                        <v3PropertyUsageType><xsl:value-of select="/PropertyUsageType"/></v3PropertyUsageType>
                        <v3PropertyValuationAmount><xsl:value-of select="/PropertyValuationAmount"/></v3PropertyValuationAmount>
                        <v3PurchasePriceAmount><xsl:value-of select="/PurchasePriceAmount"/></v3PurchasePriceAmount>
                        <v3Result15><xsl:value-of select="/Result15"/></v3Result15>
                        <v3StateCode><xsl:value-of select="/StateCode"/></v3StateCode>
                        <v3SubDataFieldName><xsl:value-of select="/SubDataFieldName"/></v3SubDataFieldName>
                        <v3Value><xsl:value-of select="/Value"/></v3Value>

                           </Row>
                          </xsl:for-each>
                         </adwp_work1.LIQUID_STG_LQA>
                        </Table>
                       </Insert>
                      </Transaction>
                      </xsl:template>
                      </xsl:stylesheet>
                      '
                      ),
                 'errorTable=adwp_work1.RPSCHMI_SHRED_ERR',
                 :res);

Teradata Employee

Re: XSLT_SHRED_BATCH Repeating Data Elements ignored

I don't think you can have a <for-each> inside the <Row> element.

 

If you have multiple repeating elements, what would you want the table rows look like after shredding?