我有以下输入 XML:
<?xml version="1.0" encoding="UTF-8"?>
<Input>
<MESSAGE>Success</MESSAGE>
<OBJECT>Task</OBJECT>
</Input>
我需要将其转换为以下内容:
<ExecuteMultipleOperations xmlns="http://www.MySoftware.com">
<Operations>
<Operation>
<Action>UpdateOrCreate</Action>
<Object>
<Object xmlns:p1="http://www.w3.org/2001/XMLSchema-instance" p1:type="Task">
<Name>Success</Name>
</Object>
</Object>
</Operation>
<OneTransaction>false</OneTransaction>
<ContinueOnError>true</ContinueOnError>
</Operations>
</ExecuteMultipleOperations>
下面是 XSLT 正在使用但无法在 p1:type 中获取“对象”的值:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<ExecuteMultipleOperations xmlns="http://www.MySoftware.com">
<Operations>
<Operation>
<Action>UpdateOrCreate</Action>
<Object>
<Object p1:type="//OBJECT" xmlns:p1="http://www.w3.org/2001/XMLSchema-instance">
<Name>
<xsl:value-of select="//MESSAGE"/>
</Name>
</Object>
</Object>
</Operation>
<OneTransaction>false</OneTransaction>
<ContinueOnError>true</ContinueOnError>
</Operations>
</ExecuteMultipleOperations>
</xsl:template>
</xsl:stylesheet>
您能否告知我如何在 p1:type 中获取 //OBJECT 标记的值
感谢所有的帮助