Xslt 如何添加新的空元素
有以下信息:Xslt 如何添加新的空元素,xslt,Xslt,有以下信息: <Employees xmlns="https://services"> <Employee> <SNILS>111-111-111-2</SNILS> <Name>Elena</Name> </Employee> </Employees> 111-111-111-2 埃琳娜 输出应如下所示: <Employees xmlns:
<Employees xmlns="https://services">
<Employee>
<SNILS>111-111-111-2</SNILS>
<Name>Elena</Name>
</Employee>
</Employees>
111-111-111-2
埃琳娜
输出应如下所示:
<Employees xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://services">
<Employee>
<SNILS>111-111-111-2</SNILS>
<Name>Elena</Name>
<Sex i:nil="true"/>
</Employee>
</Employees>
111-111-111-2
埃琳娜
如何获得这样的结果?您可以使用身份转换
<xsl:template match="node() | @*">
<xsl:copy>
<xsl:apply-templates select="node() | @*" />
</xsl:copy>
</xsl:template>
<xsl:template match="t:Employee">
<xsl:copy>
<xsl:apply-templates select="node() | @*" />
<t:Sex i:nil="true" />
</xsl:copy>
</xsl:template>
t:是命名空间的前缀
https://services
你自己试一试已经走了多远?到目前为止,您能展示您的XSLT吗?