【发布时间】:2023-03-03 10:59:01
【问题描述】:
我是 XSL 文件的新手,在解读以下代码的作用时遇到了一些麻烦。我搜索了互联网,找不到任何东西可以告诉我“nsl”的确切含义。 有人可以为我解释一下吗? 这是 SOA 系统的一部分。
<xsl:when test='ns1:Payment/ns1:PaymentHeader/ns1:ConsolidationType = "STANDARD"'>
<xsl:for-each select="ns1:Payment/ns1:PaymentModeDetail/ns1:GenericDetail/ns1:GenericLineItem">
<ns0:ApInvoiceLinesInterface>
<ns0:invoiceLineId>
<xsl:value-of select="oraext:sequence-next-val('AP_INVOICE_LINES_INTERFACE_S',$CONN)"/>
</ns0:invoiceLineId>
<xsl:choose>
<xsl:when test="ns1:CommonInvoiceLineElements/ns1:AdjustmentReasonGid/ns1:Gid/ns1:Xid!=''">
<ns0:lineTypeLookupCode>
<xsl:text disable-output-escaping="no">MISCELLANEOUS</xsl:text>
</ns0:lineTypeLookupCode>
</xsl:when>
<xsl:otherwise>
<ns0:lineTypeLookupCode>
<xsl:text disable-output-escaping="no">FREIGHT</xsl:text>
</ns0:lineTypeLookupCode>
</xsl:otherwise>
</xsl:choose>
<ns0:amount>
<xsl:value-of select="ns1:CommonInvoiceLineElements/ns1:FreightRate/ns1:FreightCharge/ns1:FinancialAmount/ns1:MonetaryAmount"/>
</ns0:amount>
<ns0:description>
<xsl:value-of select='concat(substring-after(../../../ns1:PaymentHeader/ns1:InvoiceRefnum[ns1:InvoiceRefnumQualifierGid/ns1:Gid/ns1:Xid="INVOICE_DESCRIPTION"]/ns1:InvoiceRefnumValue,"BNM."),ns1:CostTypeGid/ns1:Gid/ns1:Xid)'/>
</ns0:description>
<ns0:taxClassificationCode>
<xsl:value-of select='concat(../../../ns1:PaymentHeader/ns1:VatAnalysis/ns1:VatCodeGid/ns1:Gid/ns1:Xid,"%")'/>
</ns0:taxClassificationCode>
<ns0:distCodeConcatenated>
<xsl:value-of select="ns1:CommonInvoiceLineElements/ns1:GeneralLedgerGid/ns1:Gid/ns1:Xid"/>
</ns0:distCodeConcatenated>
</ns0:ApInvoiceLinesInterface>
</xsl:for-each>
</xsl:when>
我最想了解的是:
<ns0:amount>
<xsl:value-of select="ns1:CommonInvoiceLineElements/ns1:FreightRate/ns1:FreightCharge/ns1:FinancialAmount/ns1:MonetaryAmount"/>
</ns0:amount>
我想了解这一点的原因是,我相信带有此块的以下代码段在传递给它的负数时会为该数字返回一个正值。
提前致谢!
【问题讨论】:
-
不是
nsl,而是ns1,最后一个字符是一个。不幸的是,我没有时间给出完整的答案,但请寻找“XML 名称空间”。这些命名空间也可以在 XPath 查询中使用(select=""中的内容)。 -
“我已经在网上搜索了...” 你需要找到更有效的学习策略。如果您不知道 ns1 是名称空间前缀,那么互联网不会告诉您。阅读一本关于 XPath 的书(甚至阅读 W3C 规范)会给你更快的答案。