以下示例中的curled bracket {}的含义是什么(在前面的行中,变量$ fieldName被初始化并用字符串填充):
<xsl:element name="{$fieldName}">
<xsl:apply-templates select="field"/>
</xsl:element>
Run Code Online (Sandbox Code Playgroud) 输入xml包含以下元素:
<numberOfPayments>14.0</numberOfPayments>
Run Code Online (Sandbox Code Playgroud)
我需要将数字转换为整数,但有以下限制:
我有一条消息
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns="http://xmlns.oracle.com/policyautomation/hub/12.0/metadata/types">
<soapenv:Header/>
<soapenv:Body>
<load-request root="Vehicles" region="en-US" language="en-US" timezone="Etc/GMT">
<tables>
<table name="Vehicles">
<link name="Cars" target="Car" />
</table>
</tables>
</load-request>
</soapenv:Body>
Run Code Online (Sandbox Code Playgroud)
我需要对其进行两次转换:
我知道如何变形加载请求,并尝试使用此解决方案来删除 SOAP,但无法设法将两者结合起来并删除信封并使用单个 xslt转换正文(加载请求)。结果 XML 应该是:
<load-request>
<root>Vehicles</root>
<region>en-US</region>
<language>en-US</language>
<timezone>Etc/GMT</timezone>
<request-context>
<parameter>
<name>MyParam1</name>
<value>MyValue</value>
</parameter>
</request-context>
<tables>
<table>
<name>Vehicles</name>
<link>
<name>Cars</name>
<target>Car</target>
</link>
</table>
</tables>
</load-request>
Run Code Online (Sandbox Code Playgroud)
我使用的 XSLT:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" >
<xsl:output method="xml" indent="yes"/>
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template> …
Run Code Online (Sandbox Code Playgroud)