我正在尝试通过XSLT将我的XML转换为HTML ...并根据另一种情况,提出了以下内容。在XML @ my:myFields / my:CargoItemsSection中有一个“重复表”的数据...我想把这些数据放到一个表中,而“my:myFields”中的所有其他字段都被忽略了...在实践中,XSLT下面没有产生任何东西;我得到一个空白的结果。 :(任何想法?
// UPDATE - 下面发布的XML文件:)
<?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&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 :(得分:2)
您将my
前缀映射到两个不同的名称空间URI。在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
因此,您的匹配和选择表达式不匹配,因为它们在错误的命名空间中查找元素。