2013-07-24 3 views
4

XML을 XSLT를 통해 HTML로 변환하려하고 있습니다. 다른 상황을 기반으로 아래에 나와 있습니다. XML @ my에 "반복되는 테이블"데이터가 있습니다. myFields/my : CargoItemsSection ...이 데이터를 테이블에 넣고 "my : myFields"의 다른 모든 필드를 무시합니다. 실제로는 XSLT 아래에는 아무것도 생성되지 않습니다. 나는 빈 결과를 얻는다. ? :(어떤 아이디어XSLT를 사용하여 XML 데이터 매핑하기

// UPDATE - XML ​​파일은 아래 DOWN POSTED :

<?xml version="1.0" encoding="utf-8"?> 
<xsl:stylesheet version="1.0" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
    xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2012-12-05T14:55:38" 
    exclude-result-prefixes="my"> 

    <xsl:output method="html" indent="yes"/> 

    <xsl:template match="/"> 
    <xsl:apply-templates select="my:myFields"/> 
    </xsl:template> 

    <xsl:template match="my:myFields"> 
    <table border="1" cellpadding="1"> 
     <tr bgcolor="skyblue"> 
     <th>Equ</th> 
     <th>#Items</th> 
     <th>Commodity</th> 
     <th>Dimensions</th> 
     <th>Weight</th> 
     <th>CENSPC Action</th> 
     <th>Quote Type</th> 
     <th>Quote</th> 
     <th>QM Ref</th> 
     <th>QM Text</th> 
     </tr> 
     <xsl:apply-templates select="my:CargoItemsSection"/> 
    </table> 
    </xsl:template> 

    <xsl:template match="my:CargoItemsSection"> 
    <tr align="center"> 
     <td><xsl:value-of select="my:Equipment-Size" /><xsl:value-of select="my:Equipment-Type" /></td> 
     <td><xsl:value-of select="my:NumberOfContainers" /></td> 
     <td><xsl:value-of select="my:CommodityName" /></td> 
     <td>L:<xsl:value-of select="my:Length" />,W:<xsl:value-of select="my:Width" />,H:<xsl:value-of select="my:Height" /></td> 
     <td><xsl:value-of select="my:Weight" /></td> 
     <td><xsl:value-of select="my:AcceptedOrRejected" /></td> 
     <td><xsl:value-of select="my:QuoteAmountType" /></td> 
     <td><xsl:value-of select="my:QuoteAmount" /> <xsl:value-of select="my:Currency" /></td> 
     <td><xsl:value-of select="my:QMReferenceNumber" /></td> 
     <td><xsl:value-of select="my:QuoteText" /></td> 
    </tr> 
    </xsl:template> 

</xsl:stylesheet> 

XML 파일 :

<?xml version="1.0" encoding="utf-8"?> 
<?mso-infoPathSolution name="urn:schemas-microsoft-com:office:infopath:SPC--Special-Cargo:-myXSD-2013-04-09T08-39-48" solutionVersion="1.0.0.1816" productVersion="14.0.0.0" PIVersion="1.0.0.0" href="http://team.apmoller.net/sites/NNP-One-Stop-Shop/SPC%20%20Special%20Cargo/Forms/template.xsn"?> 
<?mso-application progid="InfoPath.Document" versionProgid="InfoPath.Document.3"?> 
<?mso-infoPath-file-attachment-present?> 
<my:myFields xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:pc="http://schemas.microsoft.com/office/infopath/2007/PartnerControls" xmlns:ma="http://schemas.microsoft.com/office/2009/metadata/properties/metaAttributes" xmlns:d="http://schemas.microsoft.com/office/infopath/2009/WSSList/dataFields" xmlns:q="http://schemas.microsoft.com/office/infopath/2009/WSSList/queryFields" xmlns:dfs="http://schemas.microsoft.com/office/infopath/2003/dataFormSolution" xmlns:dms="http://schemas.microsoft.com/office/2009/documentManagement/types" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2013-04-09T08:39:48" xmlns:xd="http://schemas.microsoft.com/office/infopath/2003" xml:lang="en-US"> 
    <my:SpecialCargoTeamSection> 
     <my:ActionTaken></my:ActionTaken> 
     <my:SCTComment>In order to make a detailed handling assessment and to verify unitised/OOG handling with the applicable terminals, appreciate if you can provide a provide a technical drawing (ideally) or a photo of the cargo detailing cargo configuration and location of center of gravity.</my:SCTComment> 
     <my:QMAttachment xsi:nil="true"></my:QMAttachment> 
     <my:ActionTakenReEval></my:ActionTakenReEval> 
     <my:AmountForCounterOffer xsi:nil="true"></my:AmountForCounterOffer> 
     <my:RequestedRateAmountTypeSPC></my:RequestedRateAmountTypeSPC> 
     <my:formReEvalCounterOfferClicked>false</my:formReEvalCounterOfferClicked> 
     <my:SCTReviewer>VPI015</my:SCTReviewer> 
     <my:AssignToGSC>false</my:AssignToGSC> 
     <my:frmStatusChecker>0</my:frmStatusChecker> 
     <my:FinalOffer>false</my:FinalOffer> 
     <my:QuoteAmountChangeCounter>0</my:QuoteAmountChangeCounter> 
    </my:SpecialCargoTeamSection> 
    <my:RequestTypeSection> 
     <my:RequestType>OOG Quotation</my:RequestType> 
     <my:RequestType_ReEval></my:RequestType_ReEval> 
    </my:RequestTypeSection> 
    <my:RequestFields> 
     <my:SalesPerson>ARA202</my:SalesPerson> 
     <my:RequestOnBehalfOf>MF_GSCSCLNEUQTCCRB\gscsclneuqtcUser</my:RequestOnBehalfOf> 
     <my:Brand>SAFMARINE</my:Brand> 
     <my:ContractualCustomerCode></my:ContractualCustomerCode> 
     <my:ShipmentDate xsi:nil="true"></my:ShipmentDate> 
     <my:CustomerOrShipperName>CEVA Logistics </my:CustomerOrShipperName> 
     <my:Origin>UAE</my:Origin> 
     <my:Destination>Qatar</my:Destination> 
     <my:OriginPortNameOrCODE>Jebel Ali</my:OriginPortNameOrCODE> 
     <my:DestinationPortNameCODE>Doha</my:DestinationPortNameCODE> 
     <my:RequestComment>Phote of the cargo attached</my:RequestComment> 
     <my:Region>EUR</my:Region> 
     <my:PersonOnBehalfOf> 

     <pc:Person xmlns:pc="http://schemas.microsoft.com/office/infopath/2007/PartnerControls"><pc:DisplayName>MF_GSCSCLNEUQTC</pc:DisplayName><pc:AccountId>CRB\gscsclneuqtc</pc:AccountId><pc:AccountType>User</pc:AccountType></pc:Person><pc:Person xmlns:pc="http://schemas.microsoft.com/office/infopath/2007/PartnerControls"><pc:DisplayName>Khatua, Pankaj</pc:DisplayName><pc:AccountId>CRB\PKH025</pc:AccountId><pc:AccountType>User</pc:AccountType></pc:Person><pc:Person xmlns:pc="http://schemas.microsoft.com/office/infopath/2007/PartnerControls"><pc:DisplayName>Ramasamy, Vivek</pc:DisplayName><pc:AccountId>CRB\VRA083</pc:AccountId><pc:AccountType>User</pc:AccountType></pc:Person></my:PersonOnBehalfOf> 
     <my:CommodityDescription></my:CommodityDescription> 
     <my:WaitingOnCustomerLabelSection></my:WaitingOnCustomerLabelSection> 
     <my:group7></my:group7> 
     <my:group8></my:group8> 
     <my:group9></my:group9> 
     <my:group10></my:group10> 
     <my:RequestorPerson> 
      <pc:Person> 
       <pc:DisplayName></pc:DisplayName> 
       <pc:AccountId>ARA202</pc:AccountId> 
       <pc:AccountType></pc:AccountType> 
      </pc:Person> 
     </my:RequestorPerson> 
     <my:DestRegion>EUR</my:DestRegion> 
     <my:RequestorReference>Fw: Invitation to bid SP2013072300025 FROM AE TO QA</my:RequestorReference> 
     <my:OnBehalfOfConcat>MF_GSCSCLNEUQTC;Khatua, Pankaj;Ramasamy, Vivek;</my:OnBehalfOfConcat> 
    </my:RequestFields> 
    <my:ReEvaluationSection> 
     <my:ReasonForReevaluation></my:ReasonForReevaluation> 
     <my:RequestedValidityExpireDate xsi:nil="true"></my:RequestedValidityExpireDate> 
     <my:VolumePlusTimePeriod></my:VolumePlusTimePeriod> 
     <my:CompetitionInformation></my:CompetitionInformation> 
     <my:RequestedRateAmountType></my:RequestedRateAmountType> 
     <my:RequestedRateAmount xsi:nil="true"></my:RequestedRateAmount> 
     <my:RateAmountDetail></my:RateAmountDetail> 
     <my:OtherReasonofReEvaluation></my:OtherReasonofReEvaluation> 
     <my:AmountCurrency></my:AmountCurrency> 
     <my:QMRefNumberForReEvaluation></my:QMRefNumberForReEvaluation> 
     <my:ReasonForReevalSection></my:ReasonForReevalSection> 
     <my:NotBASRateSubjectToSection></my:NotBASRateSubjectToSection> 
     <my:OtherReasonSection></my:OtherReasonSection> 
     <my:group3></my:group3> 
    </my:ReEvaluationSection> 
    <my:CargoItemsSection> 
     <my:Length>1010</my:Length> 
     <my:Width>410</my:Width> 
     <my:Height>460</my:Height> 
     <my:Weight>20000</my:Weight> 
     <my:AcceptedOrRejected>Clarification Needed</my:AcceptedOrRejected> 

     <my:QuotePdfAttachment xsi:nil="true"></my:QuotePdfAttachment> 
     <my:QuoteAmountType></my:QuoteAmountType> 
     <my:Currency></my:Currency> 
     <my:QuoteAmount xsi:nil="true"></my:QuoteAmount> 
     <my:QMReferenceNumber></my:QMReferenceNumber> 
     <my:Equipment-Type>Flat Rack</my:Equipment-Type> 
     <my:Equipment-Size>40</my:Equipment-Size> 
     <my:CommodityName>Machinery</my:CommodityName> 
     <my:group1></my:group1> 
     <my:NumberOfContainers xsi:nil="true"></my:NumberOfContainers> 
     <my:QuoteText></my:QuoteText> 
     <my:WaitingOnCustomer></my:WaitingOnCustomer> 
     <my:group5></my:group5> 
     <my:field6></my:field6> 
     <my:field7></my:field7> 
     <my:field8></my:field8> 
     <my:field9></my:field9> 
    </my:CargoItemsSection> 
    <my:AcceptedViewSection> 
     <my:ReasonForAcceptance></my:ReasonForAcceptance> 
     <my:OtherReasonOfAccept></my:OtherReasonOfAccept> 
    </my:AcceptedViewSection> 
    <my:RejectViewSection> 
     <my:ReasonForRejection></my:ReasonForRejection> 
     <my:OtherReasonForRejection></my:OtherReasonForRejection> 
    </my:RejectViewSection> 
    <my:FormAndButtons> 
     <my:SpecialCargoType>OOG</my:SpecialCargoType> 
     <my:FormAction></my:FormAction> 
     <my:NonReEvalButtonSection></my:NonReEvalButtonSection> 
     <my:RequestStatus>Pending SPC Review</my:RequestStatus> 
     <my:LastUpdateFrom>Form</my:LastUpdateFrom> 
     <my:IsFormEdit>true</my:IsFormEdit> 
     <my:Approvers>VPI015; CCH052; SSJ032; JEL025; XMZ004; ABO055; PKU014; SJD015; TDA042; TRA071; KRA126; DRA108; VIR004; KLU007</my:Approvers> 
     <my:ProcessStatus>Active</my:ProcessStatus> 
     <my:FileName>SPC_2013-07-24T04:43:09_ARA202</my:FileName> 
     <my:ReEvalViewSection></my:ReEvalViewSection> 
     <my:RequestID>1</my:RequestID> 
     <my:frmCurrentView>Request Form</my:frmCurrentView> 
     <my:TestSection> 
      <my:CurrentUser> 
       <pc:Person> 
        <pc:DisplayName></pc:DisplayName> 
        <pc:AccountId>VRA083</pc:AccountId> 
        <pc:AccountType></pc:AccountType> 
       </pc:Person> 
      </my:CurrentUser> 
      <my:field5></my:field5> 
     </my:TestSection> 
     <my:RequestTypeDescription>Choose this option to get a quotation for an Out Of Gauge rate based on cargo dimensions, weight, origin/destination and standard cost involved for the shipment.</my:RequestTypeDescription> 
     <my:IsNewRequest>false</my:IsNewRequest> 
     <my:EmailSubscription>false</my:EmailSubscription> 
     <my:TestFieldData></my:TestFieldData> 
     <my:frmCounterOfferDisplayHelp>Please update the details in the request form below and save to submit your counteroffer.</my:frmCounterOfferDisplayHelp> 
     <my:CustomerResponse></my:CustomerResponse> 
     <my:frmWaitingOnCustomerHelp>The SPC team will not review the request further until you un-tick all "Waiting on Customer" boxes.</my:frmWaitingOnCustomerHelp> 
     <my:Access>Requestor</my:Access> 
     <my:Engine>ClarificationResponse</my:Engine> 
     <my:UndoGSCAssignment>false</my:UndoGSCAssignment> 
     <my:frmCurrentUser>vra083</my:frmCurrentUser> 
     <my:frmCargoLineItemValidator>0</my:frmCargoLineItemValidator> 
     <my:IntroText></my:IntroText> 
     <my:ListItemID>SPC2369</my:ListItemID> 
     <my:RequestorEmail>mailto:ARA202?subject=Regarding Special Cargo Request SPC2369&amp;cc=</my:RequestorEmail> 
     <my:RequestorMySite>http://my.apmoller.net/person.aspx?accountname=CRB%5CARA202</my:RequestorMySite> 
    </my:FormAndButtons> 
    <my:TimeStamps> 
     <my:RepliedBy></my:RepliedBy> 
     <my:RepliedOnTimestamp xsi:nil="true"></my:RepliedOnTimestamp> 
     <my:CloseTimestamp xsi:nil="true"></my:CloseTimestamp> 
    </my:TimeStamps> 
    <my:group2> 
     <my:field3></my:field3> 
     <my:field4></my:field4> 
    </my:group2> 
    <my:group6></my:group6> 
    <my:field10></my:field10> 
    <my:group11></my:group11> 
</my:myFields> 
+0

XML 파일도 여기에 넣을 수 있습니까? – kpater87

+0

완료 - XML ​​파일이 추가되었습니다. 이걸 시도하는 – runelynx

답변

2

을 당신은 두 개의 서로 다른 이름 공간 URI에 매핑 된 my 접두사가. XML 문서에서이

http://schemas.microsoft.com/office/infopath/2003/myXSD/2013-04-09T08:39:48 

있어 및 XSLT에서 당신의 경기는 따라서

http://schemas.microsoft.com/office/infopath/2003/myXSD/2012-12-05T14:55:38 

을 그리고 그들이 잘못된 네임 스페이스의 요소를 찾고 있기 때문에 표현이 전혀 일치하지 선택합니다.

+0

.... – runelynx

+0

ahhhhhh !!! 그것은 작동합니다! 정말 고마워요 :)) 그 주소의 요점이 무엇인지 이해하지는 못합니다. 그러나 작동합니다! – runelynx

+0

@runelynx 그것은 "주소"가 아니지만 다양한 요소의 신원을 구성합니다. XML에서 이름이 "'{http://schemas.microsoft.com/office/infopath/2003/myXSD/2013-04-09T08:39:48} myFields' 인 요소가 있지만 XSLT가 찾고 있습니다. 이름이 "{http://schemas.microsoft.com/office/infopath/2003/myXSD/2012-12-05T14:55:38} myFields' 인 경우 "XML 네임 스페이스"를 검색하면 그물에 대한 많은 정보가 있습니다. –

관련 문제