我正在尝试通过 XSLT 将我的 XML 转换为 HTML...并且基于另一种情况,提出了以下内容。 XML @ my:myFields/my:CargoItemsSection 中有一个数据“重复表”...我希望将此数据放入表中,而忽略“my:myFields”中的所有其他字段...实际上,XSLT下面没有产生任何东西;我得到一个空白结果。 :( 有什么想法吗?
//更新——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>
最佳答案
您将 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
因此您的 match 和 select 表达式不匹配任何内容,因为它们在错误的命名空间中查找元素。
关于xml - 使用 XSLT 映射 XML 数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17835057/
我正在学习如何使用Nokogiri,根据这段代码我遇到了一些问题:require'rubygems'require'mechanize'post_agent=WWW::Mechanize.newpost_page=post_agent.get('http://www.vbulletin.org/forum/showthread.php?t=230708')puts"\nabsolutepathwithtbodygivesnil"putspost_page.parser.xpath('/html/body/div/div/div/div/div/table/tbody/tr/td/div
我有一个Ruby程序,它使用rubyzip压缩XML文件的目录树。gem。我的问题是文件开始变得很重,我想提高压缩级别,因为压缩时间不是问题。我在rubyzipdocumentation中找不到一种为创建的ZIP文件指定压缩级别的方法。有人知道如何更改此设置吗?是否有另一个允许指定压缩级别的Ruby库? 最佳答案 这是我通过查看rubyzip内部创建的代码。level=Zlib::BEST_COMPRESSIONZip::ZipOutputStream.open(zip_file)do|zip|Dir.glob("**/*")d
类classAprivatedeffooputs:fooendpublicdefbarputs:barendprivatedefzimputs:zimendprotecteddefdibputs:dibendendA的实例a=A.new测试a.foorescueputs:faila.barrescueputs:faila.zimrescueputs:faila.dibrescueputs:faila.gazrescueputs:fail测试输出failbarfailfailfail.发送测试[:foo,:bar,:zim,:dib,:gaz].each{|m|a.send(m)resc
很好奇,就使用rubyonrails自动化单元测试而言,你们正在做什么?您是否创建了一个脚本来在cron中运行rake作业并将结果邮寄给您?git中的预提交Hook?只是手动调用?我完全理解测试,但想知道在错误发生之前捕获错误的最佳实践是什么。让我们理所当然地认为测试本身是完美无缺的,并且可以正常工作。下一步是什么以确保他们在正确的时间将可能有害的结果传达给您? 最佳答案 不确定您到底想听什么,但是有几个级别的自动代码库控制:在处理某项功能时,您可以使用类似autotest的内容获得关于哪些有效,哪些无效的即时反馈。要确保您的提
假设我做了一个模块如下:m=Module.newdoclassCendend三个问题:除了对m的引用之外,还有什么方法可以访问C和m中的其他内容?我可以在创建匿名模块后为其命名吗(就像我输入“module...”一样)?如何在使用完匿名模块后将其删除,使其定义的常量不再存在? 最佳答案 三个答案:是的,使用ObjectSpace.此代码使c引用你的类(class)C不引用m:c=nilObjectSpace.each_object{|obj|c=objif(Class===objandobj.name=~/::C$/)}当然这取决于
我正在尝试使用ruby和Savon来使用网络服务。测试服务为http://www.webservicex.net/WS/WSDetails.aspx?WSID=9&CATID=2require'rubygems'require'savon'client=Savon::Client.new"http://www.webservicex.net/stockquote.asmx?WSDL"client.get_quotedo|soap|soap.body={:symbol=>"AAPL"}end返回SOAP异常。检查soap信封,在我看来soap请求没有正确的命名空间。任何人都可以建议我
关闭。这个问题是opinion-based.它目前不接受答案。想要改进这个问题?更新问题,以便editingthispost可以用事实和引用来回答它.关闭4年前。Improvethisquestion我想在固定时间创建一系列低音和高音调的哔哔声。例如:在150毫秒时发出高音调的蜂鸣声在151毫秒时发出低音调的蜂鸣声200毫秒时发出低音调的蜂鸣声250毫秒的高音调蜂鸣声有没有办法在Ruby或Python中做到这一点?我真的不在乎输出编码是什么(.wav、.mp3、.ogg等等),但我确实想创建一个输出文件。
我在我的项目目录中完成了compasscreate.和compassinitrails。几个问题:我已将我的.sass文件放在public/stylesheets中。这是放置它们的正确位置吗?当我运行compasswatch时,它不会自动编译这些.sass文件。我必须手动指定文件:compasswatchpublic/stylesheets/myfile.sass等。如何让它自动运行?文件ie.css、print.css和screen.css已放在stylesheets/compiled。如何在编译后不让它们重新出现的情况下删除它们?我自己编译的.sass文件编译成compiled/t
我想将html转换为纯文本。不过,我不想只删除标签,我想智能地保留尽可能多的格式。为插入换行符标签,检测段落并格式化它们等。输入非常简单,通常是格式良好的html(不是整个文档,只是一堆内容,通常没有anchor或图像)。我可以将几个正则表达式放在一起,让我达到80%,但我认为可能有一些现有的解决方案更智能。 最佳答案 首先,不要尝试为此使用正则表达式。很有可能你会想出一个脆弱/脆弱的解决方案,它会随着HTML的变化而崩溃,或者很难管理和维护。您可以使用Nokogiri快速解析HTML并提取文本:require'nokogiri'h
我想为Heroku构建一个Rails3应用程序。他们使用Postgres作为他们的数据库,所以我通过MacPorts安装了postgres9.0。现在我需要一个postgresgem并且共识是出于性能原因你想要pggem。但是我对我得到的错误感到非常困惑当我尝试在rvm下通过geminstall安装pg时。我已经非常明确地指定了所有postgres目录的位置可以找到但仍然无法完成安装:$envARCHFLAGS='-archx86_64'geminstallpg--\--with-pg-config=/opt/local/var/db/postgresql90/defaultdb/po