所以我有这个xml片段
<cybox:Properties xsi:type="FileObj:FileObjectType">
<FileObj:File_Path>C:\Users\Administrator\AppData\Local\Temp\9b581244f88e7f51d55e7654cf443ffb.exe</FileObj:File_Path>
<FileObj:Size_In_Bytes>2374144</FileObj:Size_In_Bytes>
<FileObj:File_Format>exe</FileObj:File_Format>
<FileObj:Hashes>
<cyboxCommon:Hash>
<cyboxCommon:Type>MD5</cyboxCommon:Type>
<cyboxCommon:Simple_Hash_Value>9b581244f88e7f51d55e7654cf443ffb</cyboxCommon:Simple_Hash_Value>
</cyboxCommon:Hash>
<cyboxCommon:Hash>
<cyboxCommon:Type>SHA1</cyboxCommon:Type>
<cyboxCommon:Simple_Hash_Value>9c34d683700476ebafd7cb08bb460947b55b1af1</cyboxCommon:Simple_Hash_Value>
</cyboxCommon:Hash>
</FileObj:Hashes>
</cybox:Properties>
我试图把它变成这个:
<cybox:Properties xsi:type="FileObj:FileObjectType">
<File_Object>
<FileObj:File_Path>C:\Users\Administrator\AppData\Local\Temp\9b581244f88e7f51d55e7654cf443ffb.exe</FileObj:File_Path>
<FileObj:Size_In_Bytes>2374144</FileObj:Size_In_Bytes>
<FileObj:File_Format>exe</FileObj:File_Format>
<FileObj:Hashes>
<cyboxCommon:Hash>
<cyboxCommon:Type>MD5</cyboxCommon:Type>
<cyboxCommon:Simple_Hash_Value>9b581244f88e7f51d55e7654cf443ffb</cyboxCommon:Simple_Hash_Value>
</cyboxCommon:Hash>
<cyboxCommon:Hash>
<cyboxCommon:Type>SHA1</cyboxCommon:Type>
<cyboxCommon:Simple_Hash_Value>9c34d683700476ebafd7cb08bb460947b55b1af1</cyboxCommon:Simple_Hash_Value>
</cyboxCommon:Hash>
</FileObj:Hashes>
</File_Object>
</cybox:Properties>
所以我知道我必须通过xsi:type获取</cybox:Properties>
元素,这很好,但是我真的不知道如何在{{{{}}下的所有内容中添加<File_Object>
包装器。 1}}
答案 0 :(得分:0)
包装内容就像将打开和关闭节点插入模板一样简单:
import Ember from 'ember';
export default Ember.Controller.extend({
// Username for the new user
username: '',
// Password for the new user
password: '',
actions: {
// Create a new user
createUser() {
const username = this.get('username');
const password = this.get('password');
this.get('store').createRecord('user', {
username,
password
}).save()
.then(() => {
this.send('clearForm'); // Invokes the `clearForm` action on the controller
})
.catch(() => {
// Do some kind of error handling if the creation fails
});
},
// Clear the form
clearForm() {
this.set('username', '');
this.set('password', '');
}
}
});
然后,问题的解决方案可能是这样的:
<xsl:template match="InputNode">
<InputNode>
<wrapper>
<xsl:copy-of select="children nodes..."/>
</wrapper>
</InputNode>
</xsl:template>