小编use*_*912的帖子

将XSLT变量放入花括号中

以下示例中的curled bracket {}的含义是什么(在前面的行中,变量$ fieldName被初始化并用字符串填充):

<xsl:element name="{$fieldName}">
    <xsl:apply-templates select="field"/>
</xsl:element>
Run Code Online (Sandbox Code Playgroud)

xslt

23
推荐指数
2
解决办法
1万
查看次数

如何在xpath中将十进制转换为整数?

输入xml包含以下元素:

<numberOfPayments>14.0</numberOfPayments>
Run Code Online (Sandbox Code Playgroud)

我需要将数字转换为整数,但有以下限制:

  • XML来自外部源,我不能让他们给我发整数
  • 它必须是一个XPath,我不能使用任何其他语言

xml xpath casting

4
推荐指数
1
解决办法
2906
查看次数

如何使用 XSLT 删除 SOAP 信封和名称空间

我有一条消息

<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 信封
  • 转换正文的内容(加载请求标签)

我知道如何变形加载请求,并尝试使用此解决方案来删除 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)

xml xslt soap

1
推荐指数
1
解决办法
9027
查看次数

标签 统计

xml ×2

xslt ×2

casting ×1

soap ×1

xpath ×1